* InputGroup allows you to add buttons and labels to input classes.
*/
class InputGroup extends \PHPFUI\HTML5Element
{
privatestring$error = '';
private ?string$hint = '';
private ?string$inputLabel = null;
publicfunction__construct()
{
parent::__construct('span');
$this->addClass('input-group');
}
publicfunctionaddButton(Button$button) : static
{
$span = new \PHPFUI\HTML5Element('span');
$span->addClass('input-group-button');
if ('button' == $button->getElement())
{
$button->setElement('span');
$button->deleteAttribute('type');
}
$span->add($button);
$this->add($span);
return$this;
}
/**
* Due to necessary modifications to the Input class (redoing the label), the passed Input class should be fully formed before being added to the InputGroup
* Unlike addInput and addButton, addLabel returns the label added, and not the current InputGroup. This is done so it can be modified by the caller as needed (for example, adding onClick)