Adding this as a follow up. I just wanted a place to put preprocess functions we might have missed in the other issues. They can all be done in one patch, if at all, since there don't seem to be many. This will, hopefully, be the last issue fixed, which would mean phase 1 is complete.
This is what I see so far from searching:
core/includes/menu.inc
template_preprocess_menu_local_task
template_preprocess_menu_local_action (the attributes go into a #type link render array)
core/includes/theme.inc
template_preprocess_datetime_form
template_preprocess_html (db_is_active is available at the template so we might be able to move that db-offline class.)
template_preprocess_field_multiple_value_form (all classes are used to build a #type table render array)
core/modules/file/file.field.inc
template_preprocess_file_widget_multiple (all classes are used to build a #type table render array)
core/modules/file/file.module
template_preprocess_file_managed_file (form-managed-file is required for JS)
These may end up not needing a fix. Discuss/analyze and strike it out if it doesn't need a fix. If a new one is found, add it to the summary.
Suggested commit message:
Issue #2407565 by epari.siva, davidhernandez, akalata, pakmanlh, lauriii, vedpareek, brianperry: Consensus Banana Phase 1, cleanup
Beta phase evaluation
| Issue category | Task |
|---|---|
| Issue priority | Normal because nothing is broken |
| Unfrozen changes | Unfrozen because it only changes theme functions and templates, which are not frozen. |
| Prioritized changes | The main goal of this issue is to improve themer experience, and is the last component of a META. |
| Disruption | Minor disruption to template files that are changed inthis issue, but easily corrected. |
| Comment | File | Size | Author |
|---|---|---|---|
| #45 | interdiff-240756-44to45.txt | 532 bytes | davidhernandez |
| #45 | consensus_banana_phase-2407565-45.patch | 5.37 KB | davidhernandez |
| #44 | interdiff-2407565-41-44.txt | 750 bytes | akalata |
| #44 | consensus_banana_cleanup-2407565-44.patch | 5.37 KB | akalata |
| #41 | interdiff-2407565-37-41.txt | 2.87 KB | akalata |
Comments
Comment #1
mgiffordWhat is this postponed on?
Comment #2
davidhernandezJust waiting until the all the phase 1 (#2322163: [meta] Consensus Banana Phase 1, move CSS classes from preprocess to twig templates.) child issues are done. Right now, we're really just waiting to get the Views issue done. CKEditor, if we're lucky, but that one might be permanently postponed.
I was using this for cleanup, so we could fix remaining problems in one patch instead of chasing them down individually.
Comment #3
DickJohnson commentedThis is copy/paste from #2329829: Move update classes from preprocess to templates based on what @davidhernandez said.
Update module
I'm not sure how much work there is
While I was working on #2408499: Rewrite update components inline with our CSS standards I noticed that we still have classes at least in core/modules/update/src/Form/UpdateManagerUpdate.php
example:
I also noticed that a lot of markup is coming from somewhere else than templates, so when we start to add new classes to update-modules table-elements I'm pretty sure we will get even more classes to files that are not templates. I haven't yet figure out how much we have these, but my guess is that quite a lot.
As I tried to point out there: https://www.drupal.org/node/2408499#comment-9591331 testing these templates, CSS and which classes are being used and where is relatively difficult, so we should double check things.
Comment #4
davidhernandezI'm unpostponing this now that the Views issue is done. The only outstanding issue is the one for Ckeditor, but we may not get to it as it is still postponed on something else. We can work on this one now, which is just clean up of anything we missed.
Comment #5
davidhernandezGave this a start.
I did not make changes to template_preprocess_menu_local_action, template_preprocess_field_multiple_value_form, and template_preprocess_file_widget_multiple. They all seem like they might require a little re-arranging, especially the ones that involve links. It may not be worth the effort. The UpdateManagerUpdate stuff may not be something we can change either. It looks to build out a table and use the standard table template, not its own.
The functions I didn't touch were ones we've chosen not to modify or fall in the same category of functions building out tables or something else complicated.
Comment #7
davidhernandezJust moved the active variable and added a comment in the template.
Comment #9
lauriiiRerolled the patch
Comment #11
lauriiiComment #12
brianperryCurrently taking a shot at reviewing the most recent patch.
Comment #13
brianperryWasn't able to fully confirm this.
I'm confident that for menu local tasks the active class is coming from menu-local-task.html.twig After applying the patch I still see the active class - for example on the content tab at admin/content. To confirm that this was in fact coming from the twig template I edited the template to remove the active class. After doing so, the active class no longer remains and no tab is styled as active.
On the other hand, I don't believe that the change in file-managed-file.html.twig is actually being used. After applying the patch I do still see the form-managed-file class - for example on the image file widget on the article node edit form. But if I change the class in the template, I don't see the resulting change to the class for the form widget. Best I can tell in this case the class is actually coming from template_preprocess_file_widget in file.field.inc But even just removing the class there didn't result in the class in the template being used. So I'm missing something, or possibly even trying to use the wrong approach to verify this. Either way, I'm not sure that this portion of the patch is working as intended.
Comment #14
lauriiiComment #15
star-szrI updated the issue summary to cross out ones that can't be banana-fied and explained why for each one.
form-managed-file in template_preprocess_file_managed_file() is actually required for JS, so it might make sense to move to #2431671: [meta] Add in js- prefixed classes for separation of JS & CSS functionality, although that patch is already quite large.
That would just leave the local task cleanup, and the template_preprocess_html should be done, very banana-able.
Comment #16
star-szrComment #17
star-szrThis also needs a reroll now.
Comment #18
vedpareek commentedRerolled.
Comment #19
siva_epari commentedComment #20
pakmanlhI attached a new simplified patch following the #15 instructions.
Comment #21
davidhernandezRegarding form-managed-file, we still want to remove that from preprocess. We just need to add to the core template as well as the Classy template, since it is functional. Also, the comment added to menu-local-task should also be added in the core template since that variable will be available to both.
Comment #22
pakmanlhUps, sorry. I attached again a new patch, hope this one will be better.
Comment #24
pakmanlhI passed the test which failed in local.
Comment #26
akalata commented1. Reviewer question: What should I be looking at to test the menu_local_task change?
2. It doesn't look like the change needed in template_preprocess_html has been addressed yet?
3. Again, how can I test this? (Or put another way, how do you know that the changes you made had the effect you intended?)
Comment #27
davidhernandez@akalata, you would need to determine what condition makes the respective CSS class appear in the page markup and then make sure it is working the same after the patch. Menu local task, for example, is adding the 'active' class for an active menu item. It will be on the
<li>.Yes, this is still missing the change to template_preprocess_html. I believe the only class to move is 'db-offline'. To test that you need to make the db connection fail (,put a bad password in your settings file maybe) but still get a page to load. You might have to change your PHP settings to get it to continue on error, so you don't just get a white screen.
Comment #28
akalata commented@davidhernandez - yep, that's exactly my question. Since there aren't "menu-local-task" classes anymore, I don't know which menu is the local task menu -- primary tabs? secondary tabs? While I could dig around in the code, changing classes until I see what is being acted upon so that I know I'm in the right place, that's sort of a waste of my time when the person who wrote the patch should know that information and can share it.
Comment #29
davidhernandezTabs should work, on the user page or a node page. View, Edit, etc.
Comment #30
davidhernandezThis will at least need a reroll. The 'active' class name has been changed to 'iis-active'. See #2031641: Change active class to is-active
Comment #31
siva_epari commentedPatch rerolled.
Comment #32
davidhernandezThe class needs changing here, as well.
Comment #34
siva_epari commentedClass changed.
Comment #36
davidhernandezIn the preprocess function, the variable name was changed to is-active, It has to be the same here.
Comment #37
siva_epari commentedFixed.
Comment #39
akalata commented+ $variables['is-active'] = TRUE;To match coding standards, this variable should use an underscore instead of a hyphen.
core/modules/system/templates/menu-local-task.html.twigandcore/themes/classy/templates/navigation/menu-local-task.html.twigneed to be updated with the correct variable name.Comment #40
akalata commented@davidhernandez, for testing out the template_preprocess_html > html.html.twig change, is it okay to just override the value before the check (ie temporarily hardcoding
$variables['db_is_active'] = FALSE;) to make the class show up?It won't change the visual display of the page to what db-offline really looks like (since there won't be an error message for other content), but DOES apply the class, which is really all we're looking to test in this case?
Comment #41
akalata commentedComment #42
davidhernandezNormally, I would say it is better to find a real way to simulate the result, but in this case I cannot find a way to reliably test this. So forcing the variable should be ok.
Comment #43
davidhernandezmenu_local_task checks out. The db-offline class was moved to the template, but was not removed from template_preprocess_html.
Comment #44
akalata commentedNot sure what happened there.
Comment #45
davidhernandezmenu_local_task checks out. html checks out. file managed file checks out.
I'm uploading a patch just to add a comma to the end of the classes array. Not a big deal.
Comment #46
davidhernandezComment #47
davidhernandezComment #48
lauriiiRTBC+1
Comment #50
webchickAwesome work, everyone!
Committed and pushed to 8.0.x. YEAH!