Example #1
0
 /**
  * @inheritDoc
  */
 protected function setParent(FluentHtmlElement $parent = null)
 {
     if (is_null($parent) or $parent->getHtmlElementName() == 'fieldset') {
         parent::setParent($parent);
     } else {
         throw new \Exception('<legend> should only be inserted into <fieldset>, not <' . $parent->getHtmlElementName() . '>');
     }
 }
 /**
  * Render element as html string.
  *
  * @return string containing rendered html of this element and all its descendants
  */
 public function branchToHtml()
 {
     // Description elements should always print with an id for referencing
     $this->getId();
     return parent::branchToHtml();
 }
Example #3
0
 /**
  * @param string|Htmlable|array|Arrayable|null $html_contents
  */
 public function __construct($html_contents = null)
 {
     parent::__construct($html_contents);
     $this->withHtmlElementName('label');
 }
 /**
  * Set the label element of the block.
  * @param AbstractLabel $label_element
  * @return $this
  */
 protected function withLabelElement(AbstractLabel $label_element)
 {
     $label_element->withClass($this->form_block_label_class);
     $this->label_element = $label_element;
     return $this;
 }