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.
API page: https://api.drupal.org/api/drupal/core%21modules%21block%21block.api.php...
Enter a descriptive title (above) relating to function hook_block_access, then describe the problem you have found:
cacheUntilEntityChanges in the example is deprecated (https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Access!AccessResu..., https://www.drupal.org/node/2532870), it should use addCacheableDependency instead.
Comment | File | Size | Author |
---|---|---|---|
#15 | updating-deprications-2686765-15.patch | 31 KB | thhafner |
#13 | document-2686765-13.patch | 30.99 KB | sidharthap |
#7 | document-2686765-7.patch | 733 bytes | sidharthap |
#3 | document-2686765-3.patch | 759 bytes | sidharthap |
Comments
Comment #2
tstoecklerGood find, thanks!
Comment #3
sidharthapInitial Try.
Comment #4
tstoeckler@sidharthap: Thanks for the patch. Since this is only ever used for documentation and not actually code that is executed we can directly change it without any deprecation notice though.
Comment #5
sidharthap@tstoeckler thank you. is it mean we can directly remove cacheUntilEntityChanges() from the code by using addCacheableDependency()
for Version: 8.0.x-dev also?
Comment #6
tstoeckler@sidharthap: Yup, exactly.
Comment #7
sidharthapThank you @tstoeckler
Updated patch as per #6. it is only remove from block.api.php.
Comment #8
sidharthapComment #9
tstoecklerYay, thanks a lot. Looks great.
Comment #10
alexpottSee https://www.drupal.org/core/scope - we should replace all the usages of cacheUntilEntityChanges() in core so we are consistent.
Comment #11
thhafner CreditAttribution: thhafner commented@alexpott
Agreed. Should a new issue be opened or should the novice tag be removed from this issue?
Comment #12
alexpottI changed the issue title - so let's use this one. Afaics this is still a novice issue.
Comment #13
sidharthapupdated patch, removed from all the files as per comment #10. I think we can have a separate issue to remove the function cacheUntilEntityChanges() from
core\lib\Drupal\Core\Access\AccessResult.php file.
Comment #14
tstoecklerThe patch itself is great. However, it only applies to 8.0. We should get this in to 8.2 first, so the patch needs to be rerolled.
I personally think we should at least fix the docs in 8.1 and 8.0 as well, but not sure what others think.
Comment #15
thhafner CreditAttribution: thhafner commentedHere is a patch for 8.2.x
Comment #16
tstoecklerYup, this one is good to go for 8.2. (It applies to 8.1 as well, but I guess it's too late for that, if I'm not mistaken.)
Comment #18
catchCommitted/pushed to 8.2.x, thanks!
I'd personally put this into 8.1.x as well since we have a second beta to put out still. It's not newly deprecating anything, just removing deprecated usages. But leaving RTBC against 8.1.x in case someone else thinks it is too late.
One advantage of having this in 8.1.x is it will allow us to actively deprecate the function in 8.2.x with trigger_error() if we want.
Comment #19
tstoecklerSure, even better!
Comment #20
Wim LeersYay! Thanks :)
+1 for 8.1.x.
Comment #22
sashi.kiran CreditAttribution: sashi.kiran at TA Digital commentedI am re-rolling this patch.
Comment #23
alexpott@sashi.kiran it applies to 8.1.x so there is no need to do a reroll.
Comment #26
alexpottMore unrelated test fails..
Comment #28
catchTaking lack of comment as agreement to put this in 8.1.x too, so cherry-picked there as well. Thanks all.
Comment #29
tstoecklerSo the original bug report, i.e. the false documentation on https://api.drupal.org/api/drupal/core!modules!block!block.api.php/funct... is not yet fixed. I don't know in how far api.drupal.org already supports the semantic versioning and what the plans are regarding that, but IMHO it would be nice to commit #7 (i.e. just the docs change) to 8.0, as well. Thoughts?
Comment #30
alexpottI don't think fixing this documentation in 8.0.x is necessary... as far as I remember api.d.o is already on 8.1.x
Comment #31
catchBack to fixed.
Comment #32
tstoecklerSorry to be somewhat obnoxious, but visiting https://api.drupal.org/api/drupal/core!modules!block!block.api.php/funct... still gives the old code, so not sure about #30
Comment #33
alexpott@tstoeckler you have to wait for it run cron I don't think it reflects changes immediately
Comment #34
thhafner CreditAttribution: thhafner commentedWhy did the patch not apply properly?
Comment #35
tstoecklerComment #36
catchYou're right about api.drupal.org, however there's an issue to fix it at #2662812: Figure out how to deal with multiple 8.x branches.
8.0.x won't be getting any further commits unless there's a security release, so moving this to closed again.
Comment #37
tstoecklerAhh OK, fine. Thanks for the link.