diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php index 0acf4bc..e2a2499 100644 --- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php @@ -126,7 +126,7 @@ public function __construct(ControllerResolverInterface $controller_resolver, Re $this->accessManager = $access_manager; $this->account = $account; $this->alterInfo($module_handler, 'local_tasks'); - $this->setCacheBackend($cache, $language_manager, 'local_task_plugins', array('local_task' => 1)); + $this->setCacheBackend($cache, $language_manager, 'local_task_plugins', array('local_task' => TRUE)); } /** diff --git a/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php b/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php index bec3d21..9c09b39 100644 --- a/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php +++ b/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php @@ -6,6 +6,7 @@ namespace Drupal\search\Form; +use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -49,6 +50,13 @@ class SearchSettingsForm extends ConfigFormBase { protected $state; /** + * The local task cache. + * + * @var \Drupal\Core\Cache\CacheBackendInterface + */ + protected $cache; + + /** * Constructs a \Drupal\search\Form\SearchSettingsForm object. * * @param \Drupal\Core\Config\ConfigFactory $config_factory @@ -61,8 +69,10 @@ class SearchSettingsForm extends ConfigFormBase { * The module handler * @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface $state * The state key/value store interface, gives access to state based config settings. + * @param \Drupal\Core\Cache\CacheBackendInterface $cache + * The cache cache bin used to clear the local task cache. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, SearchPluginManager $manager, ModuleHandlerInterface $module_handler, KeyValueStoreInterface $state) { + public function __construct(ConfigFactory $config_factory, ContextInterface $context, SearchPluginManager $manager, ModuleHandlerInterface $module_handler, KeyValueStoreInterface $state, CacheBackendInterface $cache) { parent::__construct($config_factory, $context); $this->searchSettings = $config_factory->get('search.settings'); $this->searchPluginManager = $manager; @@ -79,7 +89,8 @@ public static function create(ContainerInterface $container) { $container->get('config.context.free'), $container->get('plugin.manager.search'), $container->get('module_handler'), - $container->get('state') + $container->get('state'), + $container->get('cache.cache') ); } @@ -263,7 +274,7 @@ public function submitForm(array &$form, array &$form_state) { $this->searchSettings->set('active_plugins', $new_plugins); drupal_set_message($this->t('The active search plugins have been changed.')); $this->state->set('menu_rebuild_needed', TRUE); - \Drupal::cache('cache')->deleteTags(array('local_task' => 1)); + $this->cache->deleteTags(array('local_task' => TRUE)); } $this->searchSettings->save(); }