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.
Problem/Motivation
The method names generated by ThemeSuggestions::getAlterMethods()
are created prepending 'alter' to each suggestion, after making the first letter of each suggestion uppercase. This produces method names like this:
alterInput
alterSelect
alterUser
which are fine. However, it also produces method names like this:
alterStatus_messages
alterForm_element
alterForm_element_label
which technically will work, but violate coding standards for following lowerCamelCase naming for methods. Instead, they should be like this:
alterStatusMessages
alterFormElement
alterFormElementLabel
Proposed resolution
Change ThemeSuggestions::getAlterMethods()
so that all method names are fully lowerCamelCase, with no underscores.
Comment | File | Size | Author |
---|---|---|---|
#7 | 3008004-7.patch | 2.09 KB | markhalliwell |
Comments
Comment #2
alexdmccabeComment #3
alexdmccabeComment #4
alexdmccabeComment #6
alexdmccabeI don't think themes can be tested yet, so setting this back to Needs Review.
Comment #7
markhalliwellAh, good catch. This needs a bit of work though to support backwards compatibility with sub-themes that may have already used the malformed method name. This is a complete rework of the above patch, so no interdiff is necessary.
edit: also, themes can now be tested... this project just hasn't really set all that up just yet.
Comment #9
markhalliwell