Problem/Motivation
Local tasks and actions do not build their own render arrays, so they cannot themselves inject cacheability metadata into them. The code that does build these render arrays (LocalTasksBlock and LocalActionManager) has no way of extracting this metadata from the plugins when building the render arrays for them.
Proposed resolution
Make local task and action plugins implement CacheableDependencyInterface and allow static metadata to be set through their plugin definitions.
Make LocalTasksBlock and LocalActionManager apply this metadata to the render arrays they build.
Remaining tasks
None.
User interface changes
None.
API changes
Local tasks and actions are required to implement CacheableDependencyInterface. We can make this optional (and probably) should. It requires some more work on the tests, though.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupal_2564011_2.patch | 16.15 KB | xano |
Comments
Comment #2
xanoComment #3
xanoThis is already done for menu links in
MenuLinktree::buildItems(), for example.Comment #4
xanoLocalTaskManagerbuilds render arrays for local tasks in several different methods. They'll all need to apply cacheability metadata.Comment #6
lauriii#2511516: Make local tasks and actions hooks provide cacheability metadata, to make the blocks showing them cacheable has enabled render caching for local tasks and actions