core/modules/editor/src/Element.php | 3 ++- core/modules/filter/src/Element/TextFormat.php | 3 ++- core/modules/language/language.module | 3 ++- core/modules/language/src/Element/LanguageConfiguration.php | 3 ++- core/modules/node/src/Controller/NodePreviewController.php | 5 +++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/modules/editor/src/Element.php b/core/modules/editor/src/Element.php index 41ffedf..4af65a1 100644 --- a/core/modules/editor/src/Element.php +++ b/core/modules/editor/src/Element.php @@ -7,6 +7,7 @@ namespace Drupal\editor; +use Drupal\Core\Cache\Cache; use Drupal\editor\Entity\Editor; use Drupal\filter\Entity\FilterFormat; use Drupal\Component\Plugin\PluginManagerInterface; @@ -53,7 +54,7 @@ function preRenderTextFormat(array $element) { $format_ids = array_keys($element['format']['format']['#options']); // Early-return if no text editor is associated with any of the text formats. - $element['#cache']['tags'][] = 'config:editor_list'; + $element['#cache']['tags'] = Cache::mergeTags(isset($element['#cache']['tags']) ? $element['#cache']['tags'] : [], \Drupal::entityManager()->getDefinition('editor')->getListCacheTags()); $editors = Editor::loadMultiple($format_ids); foreach ($editors as $key => $editor) { $definition = $this->pluginManager->getDefinition($editor->getEditor()); diff --git a/core/modules/filter/src/Element/TextFormat.php b/core/modules/filter/src/Element/TextFormat.php index 9b3000f..08ec542 100644 --- a/core/modules/filter/src/Element/TextFormat.php +++ b/core/modules/filter/src/Element/TextFormat.php @@ -7,6 +7,7 @@ namespace Drupal\filter\Element; +use Drupal\Core\Cache\Cache; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element\RenderElement; use Drupal\Core\Render\Element; @@ -210,7 +211,7 @@ public static function processFormat(&$element, FormStateInterface $form_state, $user_has_access = isset($formats[$element['#format']]); $user_is_admin = $user->hasPermission('administer filters'); - $element['#cache']['tags'][] = 'config:filter_format_list'; + $element['#cache']['tags'] = Cache::mergeTags(isset($element['#cache']['tags']) ? $element['#cache']['tags'] : [], \Drupal::entityManager()->getDefinition('filter_format')->getListCacheTags()); // If the stored format does not exist or if it is not among the allowed // formats for this textarea, administrators have to assign a new format. diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 6326a58..750c36a 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -6,6 +6,7 @@ */ use Drupal\Core\Access\AccessResult; +use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\ContentEntityFormInterface; use Drupal\Core\Entity\EntityFormInterface; use Drupal\Core\Entity\EntityInterface; @@ -157,7 +158,7 @@ function language_process_language_select($element) { foreach (\Drupal::languageManager()->getLanguages($element['#languages']) as $langcode => $language) { $element['#options'][$langcode] = $language->isLocked() ? t('- @name -', array('@name' => $language->getName())) : $language->getName(); } - $element['#cache']['tags'][] = 'config:language_content_settings_list'; + $element['#cache']['tags'] = Cache::mergeTags(isset($element['#cache']['tags']) ? $element['#cache']['tags'] : [], \Drupal::entityManager()->getDefinition('language_content_settings')->getListCacheTags()); } return $element; } diff --git a/core/modules/language/src/Element/LanguageConfiguration.php b/core/modules/language/src/Element/LanguageConfiguration.php index 6dc2833..a7e0f1e 100644 --- a/core/modules/language/src/Element/LanguageConfiguration.php +++ b/core/modules/language/src/Element/LanguageConfiguration.php @@ -7,6 +7,7 @@ namespace Drupal\language\Element; +use Drupal\Core\Cache\Cache; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element\FormElement; @@ -56,7 +57,7 @@ public static function processLanguageConfiguration(&$element, FormStateInterfac '#title' => t('Show language selector on create and edit pages'), '#default_value' => ($default_config != NULL) ? $default_config->isLanguageAlterable() : FALSE, ); - $element['#cache']['tags'][] = 'config:language_content_settings_list'; + $element['#cache']['tags'] = Cache::mergeTags(isset($element['#cache']['tags']) ? $element['#cache']['tags'] : [], \Drupal::entityManager()->getDefinition('language_content_settings')->getListCacheTags()); // Add the entity type and bundle information to the form if they are set. // They will be used, in the submit handler, to generate the names of the diff --git a/core/modules/node/src/Controller/NodePreviewController.php b/core/modules/node/src/Controller/NodePreviewController.php index e8ad426..540adc6 100644 --- a/core/modules/node/src/Controller/NodePreviewController.php +++ b/core/modules/node/src/Controller/NodePreviewController.php @@ -25,8 +25,9 @@ public function view(EntityInterface $node_preview, $view_mode_id = 'full', $lan $build['#attached']['library'][] = 'node/drupal.node.preview'; // Don't render cache previews. - unset($build['#cache']); - $build['#cache']['max-age'] = 0; + $build['#cache'] = [ + 'max-age' => 0 + ]; foreach ($node_preview->uriRelationships() as $rel) { // Set the node path as the canonical URL to prevent duplicate content.