Loading core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php 0 → 100644 +40 −0 Changes for core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php: 40 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @file * Contains \Drupal\Core\Cache\UncacheableDependencyTrait. */ namespace Drupal\Core\Cache; /** * Trait to implement CacheableDependencyInterface for uncacheable objects. * * Use this for objects that are never cacheable. * * @see \Drupal\Core\Cache\CacheableDependencyInterface */ trait UncacheableDependencyTrait { /** * {@inheritdoc} */ public function getCacheContexts() { return []; } /** * {@inheritdoc} */ public function getCacheTags() { return []; } /** * {@inheritdoc} */ public function getCacheMaxAge() { return 0; } } core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php +3 −8 Changes for core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php: 3 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\history\Plugin\views\filter; use Drupal\Core\Cache\UncacheableDependencyTrait; use Drupal\Core\Form\FormStateInterface; use Drupal\views\Plugin\views\filter\FilterPluginBase; Loading @@ -17,6 +18,8 @@ */ class HistoryUserTimestamp extends FilterPluginBase { use UncacheableDependencyTrait; // Don't display empty space where the operator would be. var $no_operator = TRUE; Loading Loading @@ -93,12 +96,4 @@ public function adminSummary() { } } /** * {@inheritdoc} */ public function getCacheMaxAge() { // This filter depends on the current time and therefore is never cacheable. return 0; } } core/modules/system/tests/modules/early_rendering_controller_test/src/CacheableTestDomainObject.php +2 −20 Changes for core/modules/system/tests/modules/early_rendering_controller_test/src/CacheableTestDomainObject.php: 2 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -3,28 +3,10 @@ namespace Drupal\early_rendering_controller_test; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\UncacheableDependencyTrait; class CacheableTestDomainObject extends TestDomainObject implements CacheableDependencyInterface { /** * {@inheritdoc} */ public function getCacheContexts() { return []; } /** * {@inheritdoc} */ public function getCacheTags() { return []; } /** * {@inheritdoc} */ public function getCacheMaxAge() { return 0; } use UncacheableDependencyTrait; } core/modules/views/src/Plugin/views/sort/Random.php +3 −21 Changes for core/modules/views/src/Plugin/views/sort/Random.php: 3 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\views\Plugin\views\sort; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\UncacheableDependencyTrait; use Drupal\Core\Form\FormStateInterface; /** Loading @@ -12,6 +13,8 @@ */ class Random extends SortPluginBase implements CacheableDependencyInterface { use UncacheableDependencyTrait; /** * {@inheritdoc} */ Loading @@ -28,25 +31,4 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['order']['#access'] = FALSE; } /** * {@inheritdoc} */ public function getCacheMaxAge() { return 0; } /** * {@inheritdoc} */ public function getCacheContexts() { return []; } /** * {@inheritdoc} */ public function getCacheTags() { return []; } } Loading
core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php 0 → 100644 +40 −0 Changes for core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php: 40 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @file * Contains \Drupal\Core\Cache\UncacheableDependencyTrait. */ namespace Drupal\Core\Cache; /** * Trait to implement CacheableDependencyInterface for uncacheable objects. * * Use this for objects that are never cacheable. * * @see \Drupal\Core\Cache\CacheableDependencyInterface */ trait UncacheableDependencyTrait { /** * {@inheritdoc} */ public function getCacheContexts() { return []; } /** * {@inheritdoc} */ public function getCacheTags() { return []; } /** * {@inheritdoc} */ public function getCacheMaxAge() { return 0; } }
core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php +3 −8 Changes for core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php: 3 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\history\Plugin\views\filter; use Drupal\Core\Cache\UncacheableDependencyTrait; use Drupal\Core\Form\FormStateInterface; use Drupal\views\Plugin\views\filter\FilterPluginBase; Loading @@ -17,6 +18,8 @@ */ class HistoryUserTimestamp extends FilterPluginBase { use UncacheableDependencyTrait; // Don't display empty space where the operator would be. var $no_operator = TRUE; Loading Loading @@ -93,12 +96,4 @@ public function adminSummary() { } } /** * {@inheritdoc} */ public function getCacheMaxAge() { // This filter depends on the current time and therefore is never cacheable. return 0; } }
core/modules/system/tests/modules/early_rendering_controller_test/src/CacheableTestDomainObject.php +2 −20 Changes for core/modules/system/tests/modules/early_rendering_controller_test/src/CacheableTestDomainObject.php: 2 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -3,28 +3,10 @@ namespace Drupal\early_rendering_controller_test; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\UncacheableDependencyTrait; class CacheableTestDomainObject extends TestDomainObject implements CacheableDependencyInterface { /** * {@inheritdoc} */ public function getCacheContexts() { return []; } /** * {@inheritdoc} */ public function getCacheTags() { return []; } /** * {@inheritdoc} */ public function getCacheMaxAge() { return 0; } use UncacheableDependencyTrait; }
core/modules/views/src/Plugin/views/sort/Random.php +3 −21 Changes for core/modules/views/src/Plugin/views/sort/Random.php: 3 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\views\Plugin\views\sort; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\UncacheableDependencyTrait; use Drupal\Core\Form\FormStateInterface; /** Loading @@ -12,6 +13,8 @@ */ class Random extends SortPluginBase implements CacheableDependencyInterface { use UncacheableDependencyTrait; /** * {@inheritdoc} */ Loading @@ -28,25 +31,4 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['order']['#access'] = FALSE; } /** * {@inheritdoc} */ public function getCacheMaxAge() { return 0; } /** * {@inheritdoc} */ public function getCacheContexts() { return []; } /** * {@inheritdoc} */ public function getCacheTags() { return []; } }