Skip to content
Snippets Groups Projects
Commit c7e9ec89 authored by Philip Frilling's avatar Philip Frilling Committed by tolvr_oom
Browse files

Update the preprocess page to use cache tags/contexts.

parent 27b1fb9b
Branches 1.0.x
No related tags found
1 merge request!2Update the preprocess page to use cache tags/contexts.
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
declare(strict_types=1); declare(strict_types=1);
use Drupal\Core\Cache\Cache;
/** /**
* Implements hook_page_attachments_alter(). * Implements hook_page_attachments_alter().
*/ */
...@@ -22,6 +24,8 @@ function quick_exit_page_attachments(array &$attachments): void { ...@@ -22,6 +24,8 @@ function quick_exit_page_attachments(array &$attachments): void {
* Implements hook_preprocess_page(). * Implements hook_preprocess_page().
*/ */
function quick_exit_preprocess_page(array &$variables): void { function quick_exit_preprocess_page(array &$variables): void {
$exit_urls = \Drupal::config('quick_exit.settings')->get('exit_urls'); $config = \Drupal::config('quick_exit.settings');
$variables['#attached']['drupalSettings']['quick_exit']['exit_urls'] = $exit_urls; $variables['#attached']['drupalSettings']['quick_exit']['exit_urls'] = $config->get('exit_urls');
$variables['page']['#cache']['tags'] = Cache::mergeTags($variables['page']['#cache']['tags'], $config->getCacheTags());
$variables['page']['#cache']['contexts'] = Cache::mergeContexts($variables['page']['#cache']['contexts'], $config->getCacheContexts());
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment