Ejemplo n.º 1
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     MaterializeAsset::register($this->getView());
     $this->registerClientEvents();
     $this->getView()->registerJs("\n\$('#{$this->id}-btn').dropdown({\n      inDuration: 300,\n      outDuration: 225,\n      constrain_width: false, // Does not change width of dropdown to that of the activator\n      hover: false, // Activate on click\n      alignment: 'left', // Aligns dropdown to left or right edge (works with constrain_width)\n      gutter: 0, // Spacing from edge\n      belowOrigin: false // Displays dropdown below the button\n});\n        ");
     if ($this->buttonLabel !== null) {
         return Html::tag($this->buttontagName, $this->buttonLabel, $this->buttonOptions) . $this->renderItems($this->items, $this->options);
     } else {
         return $this->renderItems($this->items, $this->options);
     }
 }
Ejemplo n.º 2
0
 /**
  * Registers a specific Materialize plugin and the related events
  * @param string $name the name of the Materialize plugin
  */
 protected function registerPlugin($name)
 {
     $view = $this->getView();
     MaterializeAsset::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();
 }
Ejemplo n.º 3
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     MaterializeAsset::register($this->getView());
     if ($this->buttonCollapse) {
         MaterializeAsset::register($this->getView());
         $this->getView()->registerJs('$("#' . $this->id . '-button-collapse").sideNav();');
     }
     return $this->renderItems() . $this->renderMobileMenuItems();
 }
Ejemplo n.º 4
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     MaterializeAsset::register($this->getView());
     return Html::tag($this->tagName, $this->renderItems(), $this->options);
 }
Ejemplo n.º 5
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     $tag = ArrayHelper::remove($this->options, 'tag', 'nav');
     echo Html::endTag($tag, $this->options);
     if ($this->fixed) {
         echo Html::endTag('div');
     }
     MaterializeAsset::register($this->getView());
 }
Ejemplo n.º 6
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     MaterializeAsset::register($this->getView());
     return Html::tag('div', Html::tag($this->tagName, $this->encodeLabel ? Html::encode($this->label) : $this->label, $this->options) . Html::tag('ul', $this->renderButtons()), $this->wrapOptions);
 }