Exemplo n.º 1
0
 /**
  * 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();
 }
Exemplo n.º 2
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     MaterializeAsset::register($this->getView());
     $this->registerClientEvents();
     return $this->renderItems($this->items, $this->options);
 }