Пример #1
0
 /**
  * @param string $javascript
  *   JS code for execution.
  *
  * @return mixed
  *   Result of JS execution.
  */
 private function execute($javascript)
 {
     return $this->context->executeJs("return {$javascript};");
 }
Пример #2
0
 /**
  * @param string $method
  *   WYSIWYG editor method.
  * @param string $selector
  *   Editor selector.
  * @param array $arguments
  *   Arguments for method of WYSIWYG editor.
  *
  * @throws \Exception
  *   Throws an exception if the editor does not exist.
  *
  * @return string
  *   Result of JS evaluation.
  */
 protected function execute($method, $selector = '', array $arguments = [])
 {
     return $this->context->executeJs("return !object.{$method}(!args);", ['!object' => $this->getInstance($selector), '!args' => substr(drupal_json_encode($arguments), 1, -1)]);
 }