Example #1
0
 /**
  * @param string|callable|null $html_element_name
  * @param string|Htmlable|array|Arrayable $tag_contents
  * @param array|Arrayable $tag_attributes
  */
 public function __construct($html_element_name = null, $tag_contents = [], $tag_attributes = [])
 {
     parent::__construct();
     $this->withHtmlElementName($html_element_name);
     $this->withContent($tag_contents);
     $this->withAttribute($tag_attributes);
 }
 public function __construct()
 {
     parent::__construct();
     $this->withHtmlElementName(function () {
         return $this->isInline() ? 'span' : 'div';
     });
     $this->errors = new Collection();
     $this->warnings = new Collection();
     $this->alignment_elements = [$this->createFluentHtmlElement(function () {
         return $this->isAligned() || $this->isInline() ? 'span' : 'div';
     })->withContent(function () {
         return $this->getLabelElement();
     })->withClass(function () {
         return $this->getAlignmentClasses(1);
     })->onlyDisplayedIfHasContent(), $this->createFluentHtmlElement(function () {
         return $this->isAligned() || $this->isInline() ? 'span' : 'div';
     })->withClass(function () {
         return $this->getAlignmentClasses(2);
     }), function () {
         return $this->isDescriptionPulled() ? null : $this->getDescriptionElement();
     }];
     $this->withContent($this->alignment_elements);
     $this->withClass([$this->form_block_class, $this->form_block_aligned_class => function () {
         return $this->isAligned();
     }, $this->form_block_disabled_class => function () {
         return $this->isDisabled();
     }, $this->form_block_required_class => function () {
         return $this->isRequired();
     }, function () {
         return $this->getStateClass();
     }]);
     $this->withAttribute('disabled', function () {
         return $this->isDisabled() and $this->getHtmlElementName() == 'fieldset';
     });
 }
 public function __construct()
 {
     parent::__construct();
     $this->value_maps = new MapCollection();
     $this->label_maps = new MapCollection();
     $this->form_block_elements = new Collection();
     $this->form_block_container_elements = new Collection();
     $this->error_messages = new MessageBag();
     $this->warning_messages = new MessageBag();
     $this->success_maps = new MapCollection();
     $this->disabled_maps = new MapCollection();
     $this->readonly_maps = new MapCollection();
     $this->required_maps = new MapCollection();
     $this->withClass([$this->form_block_container_class, $this->form_block_container_aligned_class => function () {
         return $this->isAligned();
     }, $this->form_block_container_inline_class => function () {
         return $this->isInline();
     }]);
     $this->withContent(function () {
         //This prints blocks' description elements at top of the container under certain conditions
         if ($this->isInline()) {
             $container = $this->getControlBlockContainer();
             if (empty($container) or !$container->isInline()) {
                 return $this->pullSubBlocksDescriptionElements();
             }
         }
         return null;
     });
 }
Example #4
0
 /**
  * @param string|Htmlable|array|Arrayable|null $html_contents
  */
 public function __construct($html_contents = null)
 {
     parent::__construct();
     $this->onlyDisplayedIfHasContent();
     $this->withContent($html_contents);
 }