Problem/Motivation

We use Seven as an administrator menu and have a custom theme for non admin pages.

In our custom theme we wanted to implement the color module so users are able to select colors on the theme settings page, after copying the color folder from Bartik and making the necessary changes we decided we didn't want to have a preview html.

There is no requirement set on having to provide a preview.html with content, so leaving the variable empty

'preview_library' => '',
'preview_html' => '',

in our theme's version of color.inc seemed to do the trick, almost.

When leaving this blank, there is still a Preview title in the Color scheme form.

Color scheme preview

Proposed resolution

Check if there is actually a file provided by the theme for $info['preview_html'] otherwise we make sure $variables['html_preview']['#markup'] isn't set in template_preprocess_color_scheme_form()

Also check in the template for these variables correctly so we don't render a title that's not necessary.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ronaldtebrake created an issue. See original summary.

ronaldtebrake’s picture

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Status: Needs work » Needs review
Issue tags: +Needs change record, +Needs tests
FileSize
1.19 KB

This could be done in BC way

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

anya_m’s picture

Removed "Preview" word if 'preview_html' is empty

anya_m’s picture

Hello
1) I have questions about tests. I can check that we have Preview title and Preview area in Bartik theme, it has color scheme and preview. But how should I check it for Seven theme? It doesn't have any color/color.inc file. Should we have some default color.inc file for themes? Also there is color_test_theme for tests in color module, it has color.inc file and has preview_html setting: 'preview_html' => 'color/preview.html'. And for tests for example I can create one more test theme with no preview_html setting (but in this case this theme would have duplicates from color_test_theme) or I can just change string in color.inc file of color_test_theme 'preview_html' => 'color/preview.html' to 'preview_html' => '' directly in tests in order to check that Preview area is empty and there is no "Preview" title.

2) Also there is a question about stable and classy themes. Bartik and Seven has classy theme as base. I can add classy/templates/admin/color-scheme-form.html.twig file to classy with needed code from the patch

...
{% if html_preview|first is not empty %}
    <h2>{{ 'Preview'|t }}</h2>
    {{ html_preview }}
{% endif %}
...

But should we change stable also? Because if any theme will have stable as base and if there will be empty 'preview_html' setting, it'll have Preview title visible anyway because there is no checking in template for preview_html in stable theme.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

DamienMcKenna’s picture

This was at least partly solved in #2347783 where the site loads the color module's preview.html file if one is not provided by the module. Will this suffice?

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Project: Drupal core » Color backport
Version: 9.5.x-dev » 2.x-dev
Component: color.module » Code

Color has been removed from core, #3270899: Remove Color module from core.