Problem/Motivation
The Views Handler Manager has a comment:
// @todo This is crazy. Find a way to remove the override functionality.
Which is not very helpful and is causing confusion in #3458099: Views handler loading should respect configuration as per comments from @catch:
https://git.drupalcode.org/project/drupal/-/merge_requests/8588#note_334202
Steps to reproduce
Take a look at ViewsHandlerManager::getHandler()
Proposed resolution
Update the comment and variable name to say what it actually does
Remaining tasks
Provide the merge request
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
None
Issue fork drupal-3458312
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
scott_euser commentedComment #4
scott_euser commentedIf you want to find the two uses of this override in core, easiest is to search the codebase for
Views::handlerManager(as the 'type' passed is dynamic. Anyways easy to spot the two cases where the 2nd arg is passed via a phpstorm code search for that. Both cases trace back to Drupal\views\Plugin\views\query\Sql::getAggregationInfo() (and would be similar for something other than Sql if we supported aggregation with another database engine).Comment #5
andypostI find
$override_handler_plugin_idover-complicated - handler is always plugin and the method name already suppose to return handlergetHandler()so$override_plugin_idis more reasonableComment #6
scott_euser commentedThanks for the feedback! I also added the return typehint ViewsHandlerInterface + renamed the variable as suggestion.
Comment #7
scott_euser commentedRetrying pipeline, the failed block cache test seems unrelated and passes locally when I run it, so I think its a gitlab ci anomaly.
Comment #8
scott_euser commentedTests passing again
Comment #9
scott_euser commentedThanks! Resolved grammar fix
Comment #10
smustgrave commentedSmall request can MR be updated for 11.x vs 11.0.x
Comment #13
scott_euser commentedThanks for flagging, updated to 11.x (issue & MR)
Comment #14
smustgrave commentedComment reads fine, not 100% sure about the variable name if there is any BC for that but going to mark.
Comment #15
scott_euser commentedThanks! Re variable name, since its not an interface change, even if someone is for some reason extending this (I can't see why), I believe it would not cause a breaking change if they have named their variable differently.
Comment #17
catchThis is a good improvement for a very confusing and complicated bit of code.
Wondered about the bc implications of adding the type hint to ViewsHandlerManager but: 1. overriding this seems extremely unlikely 2. downstream code could just add the type hint to be compatible with all Drupal versions again.
Committed/pushed to 11.x, thanks!