Example #1
0
 /**
  * (non-PHPdoc)
  *
  * @see \Core\Html\AbstractHtml::build()
  *
  * @throws UnexpectedValueException
  */
 public function build()
 {
     if (empty($this->attribute['source'])) {
         throw new ElementException('No mediasource set.');
     }
     if (empty($this->attribute['type'])) {
         throw new ElementException('No media type set.');
     }
     return parent::build();
 }
Example #2
0
 /**
  *
  * {@inheritDoc}
  *
  * @see \Core\Html\HtmlBuildableInterface::build()
  */
 public function build()
 {
     if (!$this->html instanceof AbstractHtml) {
         throw new HtmlException('Bootstrap Alert object need a html object that is an instance of HtmlAbstact');
     }
     $this->html->addCss(['alert', 'alert-' . $this->context]);
     if ($this->dismissable) {
         $this->html->addCss('alert-dismissable');
         $this->html->setInner('<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>');
     }
     $this->html->addInner($this->content);
     $this->html->setRole('alert');
     return $this->html->build();
 }
Example #3
0
 /**
  * Icon creation
  *
  * @see \Core\Html::build()
  */
 public function build()
 {
     // first step is to set the icon name itself
     $this->css[] = 'fa-' . $this->icon;
     if (isset($this->on)) {
         $stack = $this->factory->create('Elements\\Span');
         $stack->addCss('fa fa-stack');
         $this->addCss('fa-stack-1x');
         // Create the on icon
         $on = $this->factory->create('Fontawesome\\Icon');
         $on->useIcon($this->on);
         $on->addCss(['fa-stack-2x', 'icon_bg']);
         $icon_1 = $on->build();
     }
     // size set for icon?
     if (isset($this->size)) {
         if (isset($stack)) {
             $stack->addCss('fa-' . $this->size);
         } else {
             $this->addCss('fa-' . $this->size);
         }
     }
     // any floating wanted?
     if (isset($this->pull)) {
         if (isset($stack)) {
             $stack->addCss('fa-pull-' . $this->pull);
         } else {
             $this->addCss('fa-pull-' . $this->pull);
         }
     }
     // draw border?
     if ($this->border && !isset($stack)) {
         $this->css[] = 'fa-border';
     }
     // is muted?
     if ($this->muted) {
         if (isset($stack)) {
             $stack->addCss('fa-muted');
         } else {
             $this->css[] = 'fa-muted';
         }
     }
     // flip icon?
     if (isset($this->flip)) {
         if (isset($stack)) {
             $stack->addCss('fa-flip-' . $this->flip);
         } else {
             $this->css[] = 'fa-flip-' . $this->flip;
         }
     }
     // rotate icon?
     if (isset($this->rotation)) {
         if (isset($stack)) {
             $stack->addCss('fa-rotate-' . $this->rotation);
         } else {
             $this->css[] = 'fa-rotate-' . $this->rotation;
         }
     }
     // spin icon?
     if ($this->spin) {
         if (isset($stack)) {
             $stack->addCss('fa-spin');
         } else {
             $this->css[] = 'fa-spin';
         }
     }
     $icon_2 = parent::build();
     if (isset($stack)) {
         $stack->setInner($icon_1 . PHP_EOL . $icon_2);
         $html = $stack->build();
     } else {
         $html = $icon_2;
     }
     return $html;
 }
Example #4
0
 /**
  * Build method with href and set alt check
  *
  * @see \Core\Abstracts\AbstractHtml::build()
  */
 public function build()
 {
     if (isset($this->attribute['href']) && !isset($this->attribute['alt'])) {
         $this->attribute['alt'] = $this->attribute['href'];
     }
     return parent::build();
 }
Example #5
0
 public function build()
 {
     // Build source elements and add them to inner html
     foreach ($this->sources as $source) {
         $this->inner .= $source->build() . PHP_EOL;
     }
     if (empty($this->no_support_text)) {
         $this->no_support_text = 'Html is not supported';
     }
     $this->inner .= $this->no_support_text;
     return parent::build();
 }