/**
  * Registers a specific Materialize plugin to jquery and the related events
  * @param string $name the name of the Materialize plugin
  */
 protected function registerPlugin($name)
 {
     $view = $this->getView();
     if ($this->materializeAsset) {
         MaterializeAsset::register($view);
     }
     if ($this->customAsset) {
         MaterializeCustomAsset::register($view);
     }
     $id = $this->options['id'];
     if ($this->clientOptions !== false) {
         $options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
         $js = "jQuery('#{$id}').{$name}({$options});";
         $view->registerJs($js);
     }
     $this->registerClientEvents();
 }
Example #2
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     MaterializeAsset::register($this->getView());
     $this->registerClientEvents();
     return $this->renderItems($this->items, $this->options);
 }