Skip to content
Snippets Groups Projects
Select Git revision
  • 8.x-1.x
  • 3478842-alternate
  • d11
  • 3054218
  • 8.x-1.13
  • 8.x-1.12
  • 8.x-1.11
  • 8.x-1.10
  • 8.x-1.9
  • 8.x-1.8
  • 8.x-1.7
  • 8.x-1.6
  • 8.x-1.5
  • 8.x-1.4
  • 8.x-1.3
  • 8.x-1.2
  • 8.x-1.1
  • 8.x-1.0
  • 8.x-1.0-rc2
  • 8.x-1.0-rc1
  • 8.x-1.0-beta4
  • 8.x-1.0-beta3
  • 8.x-1.0-beta2
  • 8.x-1.0-beta1
24 results

PageCacheRequestPrepareSubscriber.php

Blame
  • Lee Rowlands's avatar
    Revert "Issue #3435061: Automated Drupal 11 compatibility fixes for tome"
    Lee Rowlands authored
    This reverts commit 940fd236.
    76e31bbf
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    PageCacheRequestPrepareSubscriber.php 1.09 KiB
    <?php
    
    namespace Drupal\tome_static\EventSubscriber;
    
    use Drupal\tome_static\Event\TomeStaticEvents;
    use Drupal\tome_static\StackMiddleware\ResettablePageCache;
    use Symfony\Component\EventDispatcher\EventSubscriberInterface;
    
    /**
     * Prepares for a new request when using page cache.
     *
     * @internal
     */
    class PageCacheRequestPrepareSubscriber implements EventSubscriberInterface {
    
      /**
       * The resettable page cache.
       *
       * @var \Drupal\tome_static\StackMiddleware\ResettablePageCache
       */
      protected $pageCache;
    
      /**
       * Constructs the EntityPathSubscriber object.
       *
       * @param \Drupal\tome_static\StackMiddleware\ResettablePageCache $page_cache
       *   The resettable page cache.
       */
      public function __construct(ResettablePageCache $page_cache) {
        $this->pageCache = $page_cache;
      }
    
      /**
       * Reacts to a collect paths event.
       */
      public function prepareForRequest() {
        $this->pageCache->resetCache();
      }
    
      /**
       * {@inheritdoc}
       */
      public static function getSubscribedEvents() {
        $events[TomeStaticEvents::REQUEST_PREPARE][] = ['prepareForRequest'];
        return $events;
      }
    
    }