You are here

public function LiveChatBlock::build in Rocket.Chat 8.2

Same name and namespace in other branches
  1. 8 modules/livechat/src/Plugin/Block/LiveChatBlock.php \Drupal\livechat\Plugin\Block\LiveChatBlock::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/livechat/src/Plugin/Block/LiveChatBlock.php, line 22

Class

LiveChatBlock
Provides a block to contain the widget code.

Namespace

Drupal\livechat\Plugin\Block

Code

public function build() {
  $livechatWidget = new LivechatWidgetHandler('livechat', 'rocket_chat_conf');
  $block = $livechatWidget
    ->renderWidgetWithJavaScriptKeys([
    'server',
  ]);
  $block['#cache'] = [
    'max-age' => 0,
  ];
  return $block;
}