Ejemplo n.º 1
0
 public function __invoke(HtmlContainer $tr, array $data, Table $table)
 {
     if (isset($data['_rowheader']) && $data['_rowheader']) {
         $tr->addClass('rowheader');
     }
     return $tr;
 }
Ejemplo n.º 2
0
 /**
  * @param array $links
  *
  * @return $this|self
  */
 private function setOl(array $links = []) : self
 {
     $this->ol = new HtmlContainer('<ol>');
     $this->ol->addClass('breadcrumb');
     $last = null;
     foreach ($links as $uri => $link) {
         if (!$uri) {
             $last = $link;
         } else {
             $this->ol->add((new HtmlContainer('<li>'))->add(new Link($link, $uri)));
         }
     }
     if ($last) {
         $this->ol->add((new HtmlElement('<li>', $last))->addClass('active'));
     }
     $this->add($this->ol);
     return $this;
 }
Ejemplo n.º 3
0
 public function __invoke(HtmlContainer $tr, array $data)
 {
     if (isset($data['_deleted']) && $data['_deleted']) {
         $tr->addClass('deleted');
         /** @var HtmlElement $current */
         foreach ($tr->getElements() as $current) {
             if ($current->hasClass('row-action') && stripos($current->getContent(), 'fa-trash') !== false) {
                 if ($data['_deleted'] instanceof DateTime) {
                     $current->setContent('<i title="' . $data['_deleted']->display() . '" class="fa fa-info-circle" aria-hidden="true"></i>');
                 } else {
                     $current->setContent('');
                 }
             }
         }
     }
     return $tr;
 }
Ejemplo n.º 4
0
 /**
  * @param string $size
  *
  * @return $this|self
  */
 public function setSize(string $size) : self
 {
     $this->ul->addClass($size);
     return $this;
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 protected function layout() : Container
 {
     if ($this instanceof Group || $this instanceof Fieldset) {
         $this->applyContainerSize($this->container->elements);
     } else {
         $this->applySize($this);
     }
     if ($this->getGridSize()) {
         $container = new Container();
         // label
         if ($this->getLabel()) {
             $this->getLabel()->addClass('col-sm-' . $this->getGridSize())->addClass('control-label');
             $container->add($this->getLabel());
         }
         // field
         if ($this instanceof Group) {
             $fieldWrapper = $this->getContainer();
         } else {
             if (sizeof($this->inputGroups)) {
                 $fieldWrapper = new HtmlContainer('<div>');
                 $fieldWrapper->add($inputGroupWrapper = (new HtmlContainer('<div>'))->addClass('input-group'));
                 if (isset($this->inputGroups[true])) {
                     foreach ($this->inputGroups[true] as $inputGroup) {
                         $inputGroupWrapper->add($inputGroup);
                     }
                 }
                 $inputGroupWrapper->add($this->getField());
                 if (isset($this->inputGroups[false])) {
                     foreach ($this->inputGroups[false] as $inputGroup) {
                         $inputGroupWrapper->add($inputGroup);
                     }
                 }
             } else {
                 $fieldWrapper = new HtmlContainer('<div>');
                 $fieldWrapper->add($this->getField());
             }
         }
         if ($this instanceof MultipleGroup) {
             $fieldWrapper->getElement()->addClass('col-sm-' . (12 - $this->getGridSize()));
         } else {
             $fieldWrapper->addClass('col-sm-' . (12 - $this->getGridSize()));
         }
         // label
         if (!$this->getLabel()) {
             $fieldWrapper->addClass('col-sm-offset-' . $this->getGridSize());
         }
         // help wrap
         if ($this->helpText) {
             $fieldWrapper->add($this->helpText);
         }
         $container->add($fieldWrapper);
         return $container;
     } else {
         $container = parent::layout();
         if ($this->helpText) {
             $container->add($this->helpText);
         }
         return $container;
     }
 }