Example #1
0
 /**
  * Registers a specific Metro UI plugin and the related events
  * @param string $name the name of the Bootstrap plugin
  */
 protected function registerPlugin($name)
 {
     $view = $this->getView();
     MetroUiPluginAsset::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);
     }
     if (!empty($this->clientEvents)) {
         $js = [];
         foreach ($this->clientEvents as $event => $handler) {
             $js[] = "jQuery('#{$id}').on('{$event}', {$handler});";
         }
         $view->registerJs(implode("\n", $js));
     }
 }
Example #2
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     echo Html::endTag('div');
     $tag = ArrayHelper::remove($this->options, 'tag', 'div');
     echo Html::endTag($tag, $this->options);
     MetroUiPluginAsset::register($this->getView());
 }