Example #1
0
 /**
  * Generates the toggle button. The one that 'on-click', shows the sidebar.
  *
  * @return null|string the generated toggle button
  */
 public function renderToggleButton()
 {
     if ($this->toggleButton !== false) {
         $tag = ArrayHelper::remove($this->toggleButton, 'tag', 'div');
         $label = ArrayHelper::remove($this->toggleButton, 'label', Html::tag('i', '', ['class' => 'content icon']));
         Html::addCssClass($this->toggleButton, 'ui');
         Html::addCssClass($this->toggleButton, 'launch-sidebar icon');
         Html::addCssClass($this->toggleButton, 'button');
         Html::addCssClass($this->toggleButton, 'fixed');
         Html::addCssClass($this->toggleButton, 'attached');
         if ($this->position === static::POS_LEFT) {
             $position = static::POS_RIGHT;
         } else {
             $position = static::POS_LEFT;
         }
         Html::addCssClass($this->toggleButton, $position);
         $view = $this->getView();
         DosAmigosAsset::register($view);
         $view->registerJs('dosamigos.semantic.init();');
         return Html::tag($tag, $label, $this->toggleButton);
     } else {
         return null;
     }
 }
Example #2
0
 /**
  * Renders the toggle button.
  * @return string the rendering result
  */
 protected function renderToggleButton()
 {
     if ($this->toggleButton !== false) {
         $tag = ArrayHelper::remove($this->toggleButton, 'tag', 'div');
         $label = ArrayHelper::remove($this->toggleButton, 'label', 'Show');
         if ($tag === 'button' && !isset($this->toggleButton['type'])) {
             $this->toggleButton['type'] = 'button';
         }
         if ($tag === 'div') {
             Html::addCssClass($this->toggleButton, 'ui');
             Html::addCssClass($this->toggleButton, 'button');
         }
         $view = $this->getView();
         DosAmigosAsset::register($view);
         $view->registerJs('dosamigos.semantic.init();');
         return Html::tag($tag, $label, $this->toggleButton);
     } else {
         return null;
     }
 }
Example #3
0
 /**
  * Initializes the message closing buttons
  */
 public function registerClientScript()
 {
     if ($this->closeIcon !== false) {
         $view = $this->getView();
         DosAmigosAsset::register($view);
         $view->registerJs("dosamigos.semantic.initMessageCloseButtons();");
     }
 }