\Drupal\Core\Plugin\ContextAwarePluginBase has the following three methods:

  • getCacheContexts()
  • getCacheTags
  • getCacheMaxAge

In a programming language like GO we would be ready. This class would implement the \Drupal\Core\Cache\CacheableDependencyInterface.

Proposed resolution

We are using PHP so we should better make that explicit, otherwise some could would simply not work.

Remaining tasks

User interface changes

API changes

Data model changes

Members fund testing for the Drupal project. Drupal Association Learn more


dawehner created an issue. See original summary.

dawehner’s picture

Status: Active » Needs review
723 bytes

Here is a patch for it.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +D8 cacheability
Jaesin’s picture

Title: ContextAwarePluginBase doesn't implement CacheableDependencyInterface » ContextAwarePluginBase should implement CacheableDependencyInterface

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

EclipseGc’s picture

Can I +10000000 this?


  • effulgentsia committed a15d01f on 8.4.x
    Issue #2847334 by dawehner, Wim Leers, Jaesin, EclipseGc:...

  • effulgentsia committed b5739ed on 8.3.x
    Issue #2847334 by dawehner, Wim Leers, Jaesin, EclipseGc:...
effulgentsia’s picture

Version: 8.4.x-dev » 8.3.x-dev
Status: Reviewed & tested by the community » Fixed

Yeah, this is clearly a bug, especially since the PHPDoc of these 3 methods is {@inheritdoc}, but prior to this patch, that doesn't link to anything. #2375695: Condition plugins should provide cache contexts AND cacheability metadata needs to be exposed was the issue that introduced this bug by moving the implementation from classes that did implement the interface.

Therefore, pushed to 8.4.x and cherry picked to 8.3.x.

EclipseGc’s picture


Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.