Problem/Motivation
There is "legacy code" in three Views handlers that was removed from core in #1552396: Convert vocabularies into configuration but immediately and accidentally reintroduced in #1850792-26: Make init() method consistent across all views plugins. Because of the isset() check, it has been dead code this entire time, and the whole init() method can be removed in both cases.
The init() code was to handle the conversion of legacy Vocabulary IDs to the newer Vocabulary machine names.
While that init() patch was being worked on, the larger conversion was committed.
Due to a bad rebase, the legacy workaround was reintroduced.
Steps to reproduce
N/A
Proposed resolution
Remove the init() code
Remaining tasks
Comment #3 raises questions about backwards compatibility and how it should be addressed. This needs to be discussed for the issue to move on.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
| Comment | File | Size | Author |
|---|
Issue fork drupal-3221149
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:
- 3221149-taxonomy-dead-code
changes, plain diff MR !889
Comments
Comment #2
tim.plunkettThis would be broken when #3039039: Deprecate some procedural functions in taxonomy.module lands, so I wrote the patch assuming that lands. Not queueing for testing until that lands.
Comment #3
tedbowIs there any BC concerns with just removing this class? What if code is extending it? Should we deprecate it?
Comment #4
longwaveClosing #3220647: Remove "legacy vids" handling from taxonomy Views plugins as duplicate.
Comment #5
longwaveComment #6
daffie commented+1 for comment #3 by @tedbow
Comment #7
guilhermevp commentedRe-rolled patch. Moved to needs review for testing but comment #3 needs to be addressed.
Comment #9
tim.plunkett@guilhermevp The patch in #2 is purposefully rolled to assume that #3039039: Deprecate some procedural functions in taxonomy.module lands first. It did not need automatic testing or a reroll yet.
I do not think core/modules/taxonomy/src/Plugin/views/argument_validator/Term.php needs a deprecation. Views handlers are plugins which are internal and not part of the API.
Postponing to prevent any unnecessary work for now.
Comment #10
andypostThe #3039039-39: Deprecate some procedural functions in taxonomy.module convinces to unpostpone it
Comment #11
andypostI think it needs deprecation and update hook with test
Comment #12
claudiu.cristeaUn-postponing as per #3039039-39: Deprecate some procedural functions in taxonomy.module.
No sure this is correct. Why is this argument validator dropped?
Comment #13
tim.plunkettI don't know why either. That's only in @guilhermevp's patch, not mine. Rerolling mine for 9.3.x
Comment #14
tim.plunkettDoesn't need an update path because all the config is pointing to
entity:taxonomy_term.Probably does need an empty post_update hook just to clear caches, though.
Comment #15
alexpottI think we need to deprecate \Drupal\taxonomy\Plugin\views\argument_validator\Term because it is being used in contrib and this change as is will break some modules - see http://grep.xnddx.ru/search?text=Drupal%5Ctaxonomy%5CPlugin%5Cviews%5Car...
I think we remove \Drupal\taxonomy\Plugin\views\argument_validator\Term::init() and add a constructor with an @trigger_error - as per usual plugin deprecation.
Also I think we can remove taxonomy_views_plugins_argument_validator_alter() entirely. The title change doesn't seem necessary and the provider is now incorrect.
Comment #16
claudiu.cristeaAssigning to work on it.
Comment #18
claudiu.cristeaImplemented #15.
Regarding cache clear on post-update:
\Drupal\taxonomy\Plugin\views\argument_validator\Termis back, I don't think we need it anymoretaxonomy_views_plugins_argument_validator_alter()should not raise cache concerns as the function is checked for existence before is called.Comment #19
claudiu.cristeaComment #20
alexpottRe #18 we need a cache clear so that sites don't use the deprecate code after updating. An empty post-update should suffice.
Re #15 and adding a constructor with a deprecation - I was thinking \Drupal\taxonomy\Plugin\views\argument_validator\Term was a proper plugin - but it's not. It's not using annotated class discovery - it's hacked in with the alter - so a deprecation in the main section of the code will work just fine.
Comment #21
claudiu.cristeaRebased after #3039039: Deprecate some procedural functions in taxonomy.module has been committed.
Comment #22
longwaveThis looks good to me. The three instances of dead code are gone, the entire alter hook that swapped in the dead class is gone, the one remaining non plugin class is empty and deprecated, and there is a post update hook to clear cache. There is nothing left to do here so RTBC.
Comment #23
alexpottCommitted 26c6cd6 and pushed to 9.3.x. Thanks!
Nice to have this fixed before 9.3.x so we have a performance improvement rather than a degradation due to #3039039: Deprecate some procedural functions in taxonomy.module