/** * @param string $name the name of the Materialize plugin */ protected function registerPlugin($name) { $view = $this->getView(); MaterializePluginAsset::register($view); if ($this->clientOptions !== false && is_array($this->clientOptions)) { $options = empty($this->clientOptions) ? '' : Json::htmlEncode($this->clientOptions); $js = "Materialize.{$name}.apply(null, {$options});"; $view->registerJs($js); } }
/** * Renders the widget. */ public function run() { MaterializePluginAsset::register($this->getView()); $this->registerClientEvents(); return $this->renderItems($this->items, $this->options); }