Beispiel #1
0
 /**
  * (non-PHPdoc)
  *
  * @see \Core\Html\Bootstrap\Navbar\NavbarElementAbstract::build()
  *
  */
 public function build()
 {
     // Create brand
     $html = $this->content instanceof Img ? $this->page->build() : $this->content;
     // Brand wrapped by a link
     if ($this->link instanceof A) {
         $this->link->addCss('navbar-brand');
         $this->link->setInner($html);
         $html = $this->link->build();
     }
     return $html;
 }
Beispiel #2
0
 /**
  * Builds and returns button html code
  *
  * @param string $wrapper
  *
  * @throws Error
  *
  * @return string
  */
 public function build()
 {
     if ($this->mode == 'ajax') {
         $this->data['ajax'] = 'link';
     }
     // Set text and set icon means we have a button of type imagebutton
     if ($this->text && $this->icon) {
         $this->type = 'imgbutton';
     }
     // icon/image
     if ($this->type == 'icon') {
         $this->css['icon'] = 'icon';
         $this->icon->noStack();
         $this->inner = $this->icon->build();
     }
     // textbutton
     if ($this->type == 'button') {
         $this->inner = '<span class="button-text">' . $this->text . '</span>';
     }
     // simple link
     if ($this->type == 'link') {
         $this->css['link'] = 'link';
         $this->inner = '<span class="link-text">' . $this->text . '</span>';
     }
     // imgbutton
     if ($this->type == 'imgbutton') {
         $this->icon->noStack();
         $this->inner = $this->icon->build() . ' ' . $this->text;
     }
     // Do we need to set the default button css code for a non link?
     if ($this->type != 'link') {
         $this->css['btn'] = 'btn';
         $check = ['btn-primary', 'btn-success', 'btn-warning', 'btn-info', 'btn-default'];
         if ($this->checkCss($check) == false) {
             $this->addCss('btn-default');
         }
     }
     return parent::build();
 }