You are here

public function TrumbaPromoControlSpudBlock::build in Trumba 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/Block/TrumbaPromoControlSpudBlock.php \Drupal\trumba\Plugin\Block\TrumbaPromoControlSpudBlock::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

src/Plugin/Block/TrumbaPromoControlSpudBlock.php, line 68

Class

TrumbaPromoControlSpudBlock
Provides a 'TrumbaPromoControlSpudBlock' block.

Namespace

Drupal\trumba\Plugin\Block

Code

public function build() {
  $params = [
    'spudId' => $this->spudId,
    'webName' => $this->configuration['trumba_web_name'],
    'teaserBase' => $this
      ->convertUriToAbsolutePathOrUrl($this->configuration['trumba_spud_url']),
    'spudType' => $this->configuration['trumba_promo_control_spud_type'],
    'spudConfig' => $this->configuration['trumba_promo_control_spud_configuration'],
  ];
  $cache_spud_id = str_ireplace('_', '-', $this
    ->getPluginId());
  return _trumba_spud_embed($this->spudId, $params, $cache_spud_id);
}