You are here

public function ExampleEmptyBlock::build in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/block_example/src/Plugin/Block/ExampleEmptyBlock.php \Drupal\block_example\Plugin\Block\ExampleEmptyBlock::build()

The return value of the build() method is a renderable array. Returning an empty array will result in empty block contents. The front end will not display empty blocks.

Overrides BlockPluginInterface::build

File

block_example/src/Plugin/Block/ExampleEmptyBlock.php, line 24

Class

ExampleEmptyBlock
Provides a 'Example: empty block' block.

Namespace

Drupal\block_example\Plugin\Block

Code

public function build() {

  // We return an empty array on purpose. The block will thus not be rendered
  // on the site. See BlockExampleTest::testBlockExampleBasic().
  return [];
}