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.
Issue Summary
Incorrect way to fetch view id in hook_views_query_alter in views.api.php
https://api.drupal.org/api/drupal/core%21modules%21views%21views.api.php...
$view->name == 'my_view'
should be changed to
$view->storage->id() == 'my_view'
Beta phase evaluation
Issue category | Bug |
---|---|
Issue priority | Not critical because minor |
Unfrozen changes | Unfrozen because it only changes code to improve DX by making ViewExecutable more in line with View objects (and other entity types) |
Comment | File | Size | Author |
---|---|---|---|
#12 | interdiff.txt | 682 bytes | mrjmd |
#12 | 2388941-update-helper-12.patch | 1.54 KB | mrjmd |
#8 | 2388941-diff-1-8.txt | 1.5 KB | vijaycs85 |
#8 | 2388941-update-helper-8.patch | 1.49 KB | vijaycs85 |
#1 | fix_for_hook_views_query_alter-2388941.patch | 906 bytes | abhishek-anand |
Comments
Comment #1
abhishek-anand CreditAttribution: abhishek-anand commentedComment #2
abhishek-anand CreditAttribution: abhishek-anand commentedComment #3
jhodgdonCan you just use $view->id() rather than $view->storage->id()?
Comment #4
dawehnerNo you can't, $view is no the entity but the view executable which contains the logic of executing a view.
Comment #5
jhodgdonAh, OK. Then is this RTBC dawehner?
Comment #6
dawehnerI'm drunken and fine with that
Comment #7
alexpottIs it not worth adding a method to ViewExecutable called
id()
that just delegates to the $this->storage->id()?Comment #8
vijaycs85Here we go.
Comment #9
dawehnerWhy should it ever be an int?
Comment #10
jhedstromSetting to needs work based on #9. I don't think it ever would return an int.
Also:
While we're here, can we update this '@todo' to an actual docblock comment?
Comment #11
jhodgdonNot docs any more. :)
Comment #12
mrjmd CreditAttribution: mrjmd commentedFixes from #10 .
Comment #13
jhedstromI think this now addresses #7.
Comment #14
webchickIndeed.
Committed and pushed to 8.0.x. Thanks!