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.
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | interdiff-4-8.txt | 858 bytes | anya_m |
#8 | 2844190-color-preview-8.patch | 2.31 KB | anya_m |
#2 | color-optional-html-preview-2844190-2.patch | 2.1 KB | ronaldtebrake |
Comments
Comment #2
ronaldtebrake CreditAttribution: ronaldtebrake as a volunteer and for Open Social commentedFirst attempt
Comment #4
andypostThis could be done in BC way
Comment #8
anya_m CreditAttribution: anya_m as a volunteer and at Skilld commentedRemoved "Preview" word if 'preview_html' is empty
Comment #9
anya_m CreditAttribution: anya_m as a volunteer and at Skilld commentedHello
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 defaultcolor.inc
file for themes? Also there iscolor_test_theme
for tests in color module, it hascolor.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 incolor.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 patchBut 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.
Comment #16
DamienMcKennaThis 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?
Comment #18
quietone CreditAttribution: quietone at PreviousNext commentedColor has been removed from core, #3270899: Remove Color module from core.