diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php index 0c023b0..afe88fe 100644 --- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php @@ -343,27 +343,27 @@ public function getLocalTasks($level = 0) { if (!isset($this->taskData)) { $route_name = $this->routeMatch->getRouteName(); // Look for route-based tabs. - $this->taskData = [ + $this->taskData[$route_name] = [ 'tabs' => [], 'route_name' => $route_name, ]; - if (!empty($route_name) && !$this->requestStack->getCurrentRequest()->attributes->has('exception')) { + if (!$this->requestStack->getCurrentRequest()->attributes->has('exception')) { $data = array(); $local_tasks = $this->getTasksBuild($route_name); foreach ($local_tasks as $tab_level => $items) { $data[$tab_level] = empty($data[$tab_level]) ? $items : array_merge($data[$tab_level], $items); } - $this->taskData['tabs'] = $data; + $this->taskData[$route_name]['tabs'] = $data; } // Allow modules to alter local tasks. - $this->moduleHandler->alter('menu_local_tasks', $this->taskData, $route_name); + $this->moduleHandler->alter('menu_local_tasks', $this->taskData[$route_name], $route_name); } - if (isset($this->taskData['tabs'][$level])) { + if (isset($this->taskData[$route_name]['tabs'][$level])) { return [ - 'tabs' => $this->taskData['tabs'][$level], - 'route_name' => $this->taskData['route_name'], + 'tabs' => $this->taskData[$route_name]['tabs'][$level], + 'route_name' => $this->taskData[$route_name]['route_name'], ]; } diff --git a/core/modules/system/src/Plugin/Block/SystemLocalTasksBlock.php b/core/modules/system/src/Plugin/Block/SystemLocalTasksBlock.php index 897900a..87a0aaf 100644 --- a/core/modules/system/src/Plugin/Block/SystemLocalTasksBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemLocalTasksBlock.php @@ -144,13 +144,13 @@ public function blockForm($form, FormStateInterface $form_state) { $config = $this->configuration; $defaults = $this->defaultConfiguration(); - $form['levels'] = array( + $form['levels'] = [ '#type' => 'details', '#title' => $this->t('Shown tabs'), '#description' => $this->t('Select tabs being shown in the block'), // Open if not set to defaults. '#open' => $defaults['primary'] !== $config['primary'] || $defaults['secondary'] !== $config['secondary'], - ); + ]; $form['levels']['primary'] = [ '#type' => 'checkbox', '#title' => $this->t('Show primary tabs'), diff --git a/core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php b/core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php index 6e5c049..2c749e2 100644 --- a/core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php +++ b/core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php @@ -33,15 +33,18 @@ protected function setUp() { * Tests that local actions/tasks are being converted into blocks. */ public function testUpdateHookN() { + $this->runUpdates(); + /** @var \Drupal\block\BlockInterface $block_storage */ $block_storage = \Drupal::entityManager()->getStorage('block'); /* @var \Drupal\block\BlockInterface[] $help_blocks */ $help_blocks = $block_storage->loadByProperties(['theme' => 'bartik', 'region' => 'help']); - $this->runUpdates(); $this->assertRaw('Because your site has custom theme(s) installed, we had to set local actions and tasks blocks into the content region. Please manually review the block configurations and remove the removed variables from your templates.'); // Disable maintenance mode. + // @todo Can be removed once maintenance mode is automatically turned off + // after updates in https://www.drupal.org/node/2435135. \Drupal::state()->set('system.maintenance_mode', FALSE); // We finished updating so we can login the user now.