Move classes out of the preprocess functions and into the Twig templates. Use the addClass() attribute method to add classes in the template. Use the clean_class filter to filter class names, if necessary. Maintain all existing functionality and ensure all existing class names are still in the markup, even ones that are inherited.
See the following issues for more detailed examples:
#2217731: Move field classes out of preprocess and into templates
#2254153: Move node classes out of preprocess and into templates
See this change record for information about using the addClass() method:
https://www.drupal.org/node/2315471
See this change record for more information about the phase 1 process of moving class from preprocess to templates:
https://www.drupal.org/node/2325067
Preprocess Functions Modified
template_preprocess_ckeditor_settings_toolbar
Twig Templates Modified
ckeditor-settings-toolbar.html.twig
Beta phase evaluation
Issue category | Task because it improves the Themer Experience. |
---|---|
Issue priority | Normal. |
Unfrozen changes | Unfrozen because it changes markup. |
Prioritized changes | The main goal of this issue is usability of the new Twig theming layer, and since it adjusts markup it must be completed prior to RC. |
Disruption | This issue is a prioritized change (theme improvements) as per https://www.drupal.org/core/beta-changes and it's benefits outweigh any disruption. |
Comment | File | Size | Author |
---|---|---|---|
#7 | move_ckeditor_toolbar-2329781-7.patch | 3.32 KB | davidhernandez |
#5 | 2329781-ckeditor-toolbar-5.patch | 1020 bytes | sidharthap |
Comments
Comment #1
davidhernandezComment #2
star-szrI'm going to say this one should probably be postponed on #2306515: SafeMarkup in CKEditor toolbar configuration UI — fix by not generating markup in PHP but using Twig Macros.
Comment #3
star-szr#2306515: SafeMarkup in CKEditor toolbar configuration UI — fix by not generating markup in PHP but using Twig Macros is no longer a major bug so un-postponing, we just talked about this on the Twig call. Whatever gets in first gets in first, I think either way we should get a patch up here.
Comment #4
davidhernandezI'm good with un-postponing. I only see a couple classes in preprocess. It shouldn't be terribly difficult to move, and then we can definitely close out phase 1 completely.
Comment #5
sidharthapHere is the first attempt. Please correct me, If it is wrong.
Comment #7
davidhernandez@sidharthap, what we are trying to do here is actually remove the class completely from the preprocess function and put it into the template file.
I'm uploading a patch that I think gets the right classes. The only weirdness is that the 'multiple' buttons seem to only be the separators so they don't get the normal button class. That is why I had to put some logic in there.
I didn't try to remove the class on the icon span tag. We would have to do some serious re-arranging I think. Buuuuuuuut, the "#2306515: SafeMarkup in CKEditor toolbar configuration UI..." issue does all of that, so I don't think that is a problem we need to solve here.
Comment #8
davidhernandezFor anyone reviewing, this template shows up on the admin page, admin/config/content/formats/manage/full_html, not on the node edit page where the wysiwyg editor actually appears.
Comment #9
lauriiiIt doesn't break the functionality and the classes seem to be the same after applying the patch.
I also added the beta evaluation.
Comment #10
alexpottCommitted a02e778 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.