You are here

public function LivechatWidgetHandler::renderWidgetWithJavaScriptKeys in Rocket.Chat 8

Same name and namespace in other branches
  1. 8.2 modules/livechat/src/LivechatWidgetHandler.php \Drupal\livechat\LivechatWidgetHandler::renderWidgetWithJavaScriptKeys()

Render Widget.

Parameters

array|null $keys: Array to render.

Return value

array Rendered Widget.

File

modules/livechat/src/LivechatWidgetHandler.php, line 92
Contains \Drupal\rocket_chat\WidgetHandler.

Class

LivechatWidgetHandler
Glue class to make the widget dynamically build the javascript file.

Namespace

Drupal\livechat

Code

public function renderWidgetWithJavaScriptKeys(array $keys) {
  if (!empty($keys)) {
    $this
      ->setAssets();
    foreach ($keys as $value) {
      $this
        ->setJavascriptParams($value);
    }
    return $this
      ->widgetParams();
  }
  return [];
}