scriptBlock() публичный Метод

### Options - safe (boolean) Whether or not the $script should be wrapped in - block Set to true to append output to view block "script" or provide custom block name.
public scriptBlock ( string $script, array $options = [] ) : string | null
$script string The script to wrap
$options array The options to use. Options not listed above will be treated as HTML attributes.
Результат string | null String or null depending on the value of `$options['block']`
Пример #1
0
 /**
  * Returns a Javascript code block
  * @param string $code Javascript code
  * @param array $options Array of options and HTML attributes
  * @return mixed A script tag or `null`
  */
 public function scriptBlock($code, array $options = [])
 {
     $options = $this->optionsDefaults(['block' => true], $options);
     return parent::scriptBlock($code, $options);
 }