Builds and returns the renderable array for this block plugin.
array A renderable array representing the content of the block.
Overrides BlockPluginInterface::build
\Drupal\block\BlockRenderController
public function build() {
// @todo Clean up when http://drupal.org/node/1874498 lands.
list(, $uuid) = explode(':', $this
->getPluginId());
if ($block = entity_load_by_uuid('custom_block', $uuid)) {
return entity_view($block, $this->configuration['view_mode']);
}
else {
return array(
'#markup' => t('Block with uuid %uuid does not exist. <a href="!url">Add custom block</a>.', array(
'%uuid' => $uuid,
'!url' => url('block/add'),
)),
'#access' => user_access('administer blocks'),
);
}
}