You are here

public function DsRegionBlock::build in Display Suite 8.2

Same name and namespace in other branches
  1. 8.3 modules/ds_extras/src/Plugin/Block/DsRegionBlock.php \Drupal\ds_extras\Plugin\Block\DsRegionBlock::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.

Overrides BlockPluginInterface::build

See also

\Drupal\block\BlockViewBuilder

File

modules/ds_extras/src/Plugin/Block/DsRegionBlock.php, line 22

Class

DsRegionBlock
Provides the region block plugin.

Namespace

Drupal\ds_extras\Plugin\Block

Code

public function build() {
  $id = $this
    ->getDerivativeId();
  $data = drupal_static('ds_block_region');
  if (!empty($data[$id])) {
    return array(
      '#markup' => drupal_render_children($data[$id]),
    );
  }
  else {
    return array();
  }
}