function BlockPluginInterface::build

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Block/BlockPluginInterface.php \Drupal\Core\Block\BlockPluginInterface::build()
  2. 10 core/lib/Drupal/Core/Block/BlockPluginInterface.php \Drupal\Core\Block\BlockPluginInterface::build()
  3. 8.9.x core/lib/Drupal/Core/Block/BlockPluginInterface.php \Drupal\Core\Block\BlockPluginInterface::build()

Builds and returns the renderable array for this block plugin.

If a block should not be rendered because it has no content, then this method must also ensure to return no content: it must then only return an empty array, or an empty array with #cache set (with cacheability metadata indicating the circumstances for it being empty).

Return value

array A renderable array representing the content of the block.

See also

\Drupal\block\BlockViewBuilder

10 methods override BlockPluginInterface::build()
ExtraFieldBlock::build in core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php
Builds and returns the renderable array for this block plugin.
FieldBlock::build in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
Builds and returns the renderable array for this block plugin.
HelpBlock::build in core/modules/help/src/Plugin/Block/HelpBlock.php
Builds and returns the renderable array for this block plugin.
InlineBlock::build in core/modules/layout_builder/src/Plugin/Block/InlineBlock.php
Builds and returns the renderable array for this block plugin.
LanguageBlock::build in core/modules/language/src/Plugin/Block/LanguageBlock.php
Builds and returns the renderable array for this block plugin.

... See full list

File

core/lib/Drupal/Core/Block/BlockPluginInterface.php, line 77

Class

BlockPluginInterface
Defines the required interface for all block plugins.

Namespace

Drupal\Core\Block

Code

public function build();

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