/** * Set the referenced input for this label. * @param AbstractFormControl $control_element that label should reference * @return $this */ public function forControl(AbstractFormControl $control_element) { $this->for_control_element = $control_element; $this->withAttribute('for', function () { return $this->getControlElement()->getId(); }); $this->withDefaultContent(function () use($control_element) { return $control_element->getLabel(); }); return $this; }
/** * @param callable|string $name of input */ public function __construct($name) { parent::__construct(); $this->withHtmlElementName('textarea'); $this->withName($name); $this->withDefaultContent(function (TextareaElement $input) { return $input->getValue(); }); }
/** * @param string|Htmlable|array|Arrayable $tag_contents * @param string $button_type */ public function __construct($tag_contents, $button_type = "submit") { parent::__construct(); $this->withHtmlElementName('button'); $this->withContent($tag_contents); $this->withAttribute('type', $button_type); $this->withAttribute('value', function (AbstractFormControl $input) { return $input->getValue(); }); }
/** * @param callable|string $name of input * @param string $input_type of input, defaults to text */ public function __construct($name, $input_type = 'text') { parent::__construct(); $this->withHtmlElementName('input'); $this->withName($name); $this->withAttribute('type', $input_type); $this->withAttribute('value', function (AbstractFormControl $input) { return $input->getValue(); }); }
public function __construct($name, $options = null) { parent::__construct(); $this->options = new Collection(); $this->selected_options = new Collection(); $this->disabled_options = new MapCollection(); $this->withHtmlElementName('select'); $this->withName($name); $this->withOptions($options); $this->withContent(function () { return $this->getOptionElements(); }); }