private function LivechatWidgetHandler::buildJavaScriptArray in Rocket.Chat 8
Same name and namespace in other branches
- 8.2 modules/livechat/src/LivechatWidgetHandler.php \Drupal\livechat\LivechatWidgetHandler::buildJavaScriptArray()
Build Javascript Settings Array.
The values to send to the Javascript file declared in your library's route drupalSettings is a javascript global object declared by the Drupal API to get values within your js file, use e.g. drupalSettings.library.route.key.
Parameters
string $key: Key to set the value in.
mixed $value: Value to set in the key register.
1 call to LivechatWidgetHandler::buildJavaScriptArray()
- LivechatWidgetHandler::setJavascriptParams in modules/
livechat/ src/ LivechatWidgetHandler.php - Setter Javascript Parameters.
File
- modules/
livechat/ src/ LivechatWidgetHandler.php, line 202 - Contains \Drupal\rocket_chat\WidgetHandler.
Class
- LivechatWidgetHandler
- Glue class to make the widget dynamically build the javascript file.
Namespace
Drupal\livechatCode
private function buildJavaScriptArray($key, $value) {
$ds = $this->form['#attached']['drupalSettings'][$this
->getWidgetLibraryName()][$this
->getWidgetLibraryRoute()][$key] = $value;
return $ds;
}