diff --git a/core/modules/language/src/Form/ContentLanguageSettingsForm.php b/core/modules/language/src/Form/ContentLanguageSettingsForm.php index 99052a0..aa5302c 100644 --- a/core/modules/language/src/Form/ContentLanguageSettingsForm.php +++ b/core/modules/language/src/Form/ContentLanguageSettingsForm.php @@ -7,7 +7,7 @@ namespace Drupal\language\Form; -use Drupal\Core\Cache\Cache; +use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Entity\ContentEntityTypeInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Form\FormBase; @@ -28,13 +28,23 @@ class ContentLanguageSettingsForm extends FormBase { protected $entityManager; /** + * The cache tags invalidator. + * + * @var \Drupal\Core\Cache\CacheTagsInvalidatorInterface + */ + protected $cacheTagsInvalidator; + + /** * Constructs a ContentLanguageSettingsForm object. * * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. + * @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cache_tags_invalidator + * The cache tags invalidator. */ - public function __construct(EntityManagerInterface $entity_manager) { + public function __construct(EntityManagerInterface $entity_manager, CacheTagsInvalidatorInterface $cache_tags_invalidator) { $this->entityManager = $entity_manager; + $this->cacheTagsInvalidator = $cache_tags_invalidator; } /** @@ -42,7 +52,8 @@ public function __construct(EntityManagerInterface $entity_manager) { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager') + $container->get('entity.manager'), + $container->get('cache_tags.invalidator') ); } @@ -157,9 +168,9 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ->save(); } } - // Invalidate the render cache because we need to show new actions in blocks - // with tabs. eg. "Translate". - Cache::invalidateTags(['rendered']); + // Invalidate the rendered tag cache because we need to show new actions in + // blocks with tabs. eg. "Translate". + $this->cacheTagsInvalidator->invalidateTags(['rendered']);; drupal_set_message($this->t('Settings successfully updated.')); }