/** * FormElement constructor. * @param string $action * @param string $method * @param bool|false $multipart * @param $content * @param array $attributes */ public function __construct($action = '/', $method = 'get', $multipart = false, $content = null, array $attributes = []) { parent::__construct('form', $attributes, null); $this->setAttribute('action', $action)->setAttribute('method', strtoupper($method)); if ($multipart === true) { $this->setAttribute('enctype', 'multipart/form-data'); } $this->setContent($content); }
/** * SelectElement constructor. * @param null $name * @param array $data * @param null $selectedValue * @param array $attributes */ public function __construct($name = null, array $data = [], $selectedValue = null, array $attributes = []) { parent::__construct('select', $attributes, null); $this->setAttribute('name', $name); $this->data('selected', $selectedValue); foreach ($data as $title => $item) { if (is_array($item)) { $group = new OptgroupElement(); foreach ($item as $optionTitle => $optionValue) { $option = new OptionElement($optionTitle); $group->setAttribute('label', $title)->appendContent($option->setAttribute('value', $optionValue)); } $this->appendContent($group); } else { $option = new OptionElement($title); $this->appendContent($option->setAttribute('value', $item)); } } }
/** * H4Element constructor. * @param null $content * @param array $attributes */ public function __construct($content = null, array $attributes = []) { parent::__construct('h4', $attributes, null); $this->setContent($content); }
/** * AElement constructor. * @param $href * @param null $content * @param array $attributes */ public function __construct($href, $content = null, array $attributes = []) { parent::__construct('a', $attributes, null); $this->setSingle(false)->setAttribute('href', $href)->setContent($content); }
public function __construct($content = null, array $attributes = []) { parent::__construct('span', $attributes, null); $this->setSingle(false)->setContent($content); }
/** * InputElement constructor. * @param $name * @param null $value * @param array $attributes */ public function __construct($name, $value = null, array $attributes = []) { parent::__construct('input', $attributes, null); $this->setSingle(true)->setAttribute('name', $name)->setAttribute('value', $value); }
/** * UlElement constructor. * @param array $userList * @param array $attributes */ public function __construct(array $userList = [], array $attributes = []) { parent::__construct('ul', $attributes, null); $this->setSingle(false)->setContent($userList); }
/** * ButtonElement constructor. * @param $name * @param mixed $value * @param array $attributes */ public function __construct($name, $value = null, array $attributes = []) { parent::__construct('button', $attributes, null); $this->setAttribute('name', $name)->setContent($value); }
/** * ScriptElement constructor. * @param null $src * @param array $attributes */ public function __construct($src = null, array $attributes = []) { parent::__construct('script', $attributes); $this->setAttribute('src', $src); }
/** * ImgElement constructor. * @param null $src * @param array $attributes */ public function __construct($src = null, array $attributes = []) { parent::__construct('img', $attributes, null); $this->setAttribute('src', $src)->isSingle(true); }