class ExampleEmptyBlock
Same name in other branches
- 3.x modules/block_example/src/Plugin/Block/ExampleEmptyBlock.php \Drupal\block_example\Plugin\Block\ExampleEmptyBlock
- 4.0.x modules/block_example/src/Plugin/Block/ExampleEmptyBlock.php \Drupal\block_example\Plugin\Block\ExampleEmptyBlock
Provides a 'Example: empty block' block.
Plugin annotation
@Block(
id = "example_empty",
admin_label = @Translation("Example: empty block")
)
Hierarchy
- class \Drupal\block_example\Plugin\Block\ExampleEmptyBlock extends \Drupal\Core\Block\BlockBase
Expanded class hierarchy of ExampleEmptyBlock
File
-
block_example/
src/ Plugin/ Block/ ExampleEmptyBlock.php, line 15
Namespace
Drupal\block_example\Plugin\BlockView source
class ExampleEmptyBlock extends BlockBase {
/**
* {@inheritdoc}
*
* 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.
*/
public function build() {
// We return an empty array on purpose. The block will thus not be rendered
// on the site. See BlockExampleTest::testBlockExampleBasic().
return [];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ExampleEmptyBlock::build | public | function | 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. |