Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up from #1885564: theme.maintenance.inc (authorize.php) - Convert theme_ functions to Twig.
<?php
$message = '<strong>' . $log_message['message'] . '</strong>';
$classes = array('failure');
?>
The strong should be moved to CSS of .failure.
Comments
Comment #1
longwaveThe same function also sets an HTML ID which doesn't appear to be referenced from CSS or JS:
If this can be safely removed, then perhaps the wrapper div can also be safely removed, and then we appear to be left with just an item_list - meaning it may be possible to remove this template entirely?
Comment #2
joelpittetI agree, title changed and lets do that here. The class name may need to be BEMized. @see component in https://drupal.org/node/1887918
Maybe move authorize-results to a class and rename .failure to .authorize-results__failure?
Comment #3
mrjmd CreditAttribution: mrjmd commentedGoing to try my hand at this one.
Comment #4
mrjmd CreditAttribution: mrjmd commentedMy attempt at a patch.
Comment #6
mrjmd CreditAttribution: mrjmd commentedMy patch was made against the patch in https://drupal.org/node/1885564#comment-8733979, which hasn't been committed yet. I think that's why it has failed testing.
Comment #7
vollepeer CreditAttribution: vollepeer commentedComment #8
vollepeer CreditAttribution: vollepeer commentedComment #9
vollepeer CreditAttribution: vollepeer commentedComment #10
Antti J. Salminen CreditAttribution: Antti J. Salminen commentedComment #11
joelpittetThis patch should be possible on it's own. That other issue is a conversion from theme_ function to twig template so other than maybe a merge conflict this should be still good to go. Conversion issues should be straight conversions as much as possible, no new features added.
#4 Looks fairly good. Just make the patch against 8.x branch.
the class is called .failure and it would be inside .authorize-results and not bemized yet. Though you could "bemize" them I think that is scope for a different issue.
Sorry for the late response @mrjmd, but thanks for the patch nevertheless.
Comment #12
mrjmd CreditAttribution: mrjmd commentedjoelpittet, thanks for the feedback. i'll roll a new patch against HEAD.
Comment #13
mrjmd CreditAttribution: mrjmd commentedlatest patch.
Comment #14
mrjmd CreditAttribution: mrjmd commentedComment #15
joelpittet@mrjmd thanks for the new patch, here's a review:
This is the only change that may be a bit premature though I like the idea very much. The problem is you added a class that that never gets used(may get used in the twig template... I don't know). Two options here, just remove the div all together, or the more pragmatic approach just change the id to class in the string. I'd favour the latter.
This should be prefixed with
.authorize-results
class just like:.update-results .failure
further up the page.Or for bonus points do the bem naming like you did earlier and not worry about naming collisions. I'm not sure when/where those bem naming are to go in or which issues they are from but worth a shot. But to be on the safe side you could just copy the pattern before you.
This needs a newline.
Comment #16
LewisNymanComment #17
alexrayu CreditAttribution: alexrayu commentedPlease check it out.
Comment #18
alexrayu CreditAttribution: alexrayu commentedComment #19
LewisNymanThis still needs work to be brought in line with our CSS standards, apart from that it looks good.
Comment #20
olemedia CreditAttribution: olemedia commentedComment #21
olemedia CreditAttribution: olemedia commentedRenamed the classes to conform with Drupal naming convention: See https://drupal.org/node/1886770
Comment #22
joelpittetShould we do success here too? to make them consistent in naming pattern? Otherwise this is RTBC from me.
Comment #23
Antti J. Salminen CreditAttribution: Antti J. Salminen commentedComment #24
Antti J. Salminen CreditAttribution: Antti J. Salminen commentedChanged the success classname to be consistent with failure. Also added type hinting to function signature/docblock for the functions this patch touches. Hopefully that change is not out of scope.
Comment #25
star-szrIt looks out of scope to me, try and keep the changes focussed, it makes patches easier to maintain (reroll) and review/commit. Thanks!
Comment #26
Antti J. Salminen CreditAttribution: Antti J. Salminen commentedGot it, here's the patch with only the consistent class naming modification.
Comment #27
joelpittetAwesome, this looks great to me. I double checked and there are no css or js in core using the ID or class for these theme so we should be good there.
Not exactly sure how to get to the page to see this though for manual testing...
One part of the puzzle is turning on allow_authorize_operations = TRUE in settings.php from the authorize.php docblock.
Comment #28
Antti J. Salminen CreditAttribution: Antti J. Salminen commentedallow_authorize_operations appears to be TRUE by default so you don't have to change that. I tried to test by installing a module through the UI but seems like the process is broken. #842620: Update manager can't install modules using FTP due broken FileTransferAuthorizeForm is a related but old issue which doesn't contain the exact error I'm getting now... Looks to be difficult that way currently.
Comment #29
LewisNymanThis patch looks done? RTBC!
Comment #30
alexpottHow does this go with the effort to move classes into template files? Or have we decided to not move the authorise theme functions into templates?
Comment #31
star-szrWe are still converting authorize.php to Twig, when it's Twig then we can move at least some of this to the template.
#1885564: theme.maintenance.inc (authorize.php) - Convert theme_ functions to Twig
Comment #32
alexpottCommitted 69c5468 and pushed to 8.0.x. Thanks!
Comment #34
joelpittetThank you @alexpott :)