You are here

public function ExampleEmptyBlock::build in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 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

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