function 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.

Return value

array A renderable array representing the content of the block.

Overrides BlockPluginInterface::build

File

modules/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 [];
}