function BlockHooks::blockBuildLocalActionsBlockAlter

Implements hook_block_build_BASE_BLOCK_ID_alter().

File

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

Class

BlockHooks
Hook implementations for block.

Namespace

Drupal\block\Hook

Code

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

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