function BlockHooks::blockBuildLocalActionsBlockAlter

Implements hook_block_build_BASE_BLOCK_ID_alter().

Attributes

#[Hook('block_build_local_actions_block_alter')]

File

core/modules/block/src/Hook/BlockHooks.php, line 249

Class

BlockHooks
Hook implementations for block.

Namespace

Drupal\block\Hook

Code

public function blockBuildLocalActionsBlockAlter(array &$build, BlockPluginInterface $block) : void {
  $build['#lazy_builder_preview'] = [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'invisible',
      ],
    ],
    'actions' => [
      '#theme' => 'menu_local_action',
      '#link' => [
        'title' => $this->t('Add'),
        'url' => Url::fromUserInput('#'),
      ],
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.