function NavigationRenderer::removeLocalTasks
Alter the build of any local_tasks_block plugin block.
If we are showing the local tasks in the top bar, hide the local tasks from display to avoid duplicating the links.
Parameters
array $build: A renderable array representing the local_tasks_block plugin block to be rendered.
\Drupal\Core\Block\BlockPluginInterface $block: Block plugin object representing a local_tasks_block.
See also
navigation_block_build_local_tasks_block_alter()
File
- 
              core/
modules/ navigation/ src/ NavigationRenderer.php, line 244  
Class
- NavigationRenderer
 - Handle rendering for different pieces of the navigation.
 
Namespace
Drupal\navigationCode
public function removeLocalTasks(array &$build, BlockPluginInterface $block) : void {
  if ($block->getPluginId() !== 'local_tasks_block') {
    return;
  }
  if ($this->hasLocalTasks()) {
    $build['#access'] = FALSE;
  }
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.