93 return new self(self::TYPE_BUTTON);
99 self::FORM_TARGET_BLANK,
100 self::FORM_TARGET_PARENT,
101 self::FORM_TARGET_SELF,
102 self::FORM_TARGET_TOP
109 self::FORM_METHOD_POST,
110 self::FORM_METHOD_GET
117 self::FORM_ENC_TYPE_APPLICATION,
118 self::FORM_ENC_TYPE_MULTI_PART,
119 self::FORM_ENC_TYPE_PLAIN
126 self::BUTTON_TYPE_SUBMIT,
127 self::BUTTON_TYPE_BUTTON,
128 self::BUTTON_TYPE_RESET
144 if (!is_bool($form_novalidate)) {
146 "Please pass a value of type 'boolean' to specify whether the form is not to be validated when it is submitted" 168 if (!in_array($form_target, self::getValidFormTargets())) {
171 "Invalid form target passed, must be one of these: %s",
172 implode(
', ', self::getValidFormTargets())
192 if (!in_array($form_method, self::getValidFormMethods())) {
195 "Invalid form method passed, must be one of these: %s",
196 implode(
', ', self::getValidFormMethods())
216 if (!in_array($form_enc_type, self::getValidFormEncTypes())) {
219 "Invalid form enc type passed, must be one of these: %s",
220 implode(
', ', self::getValidFormEncTypes())
241 if (!is_string($form_action)) {
243 "The form action must be of type 'string'" 266 if (!is_string($form)) {
268 "The form id must be of type 'string'" 287 if (!is_string($value)) {
289 "The initial value of the button must be of type 'string'" 307 public function setName(
string $name,
bool $is_command =
true): self
309 if (!is_string($name)) {
311 "The name of the button must be of type 'string'" 315 $this->name = $is_command ?
'cmd[' . $name .
']' :
$name;
329 if (!in_array($button_type, self::getValidButtonTypes())) {
332 "Invalid button type passed, must be one of these: %s",
333 implode(
', ', self::getValidButtonTypes())
348 $attr[
'name'] = $this->
getName() ??
'';
349 $attr[
'value'] = $this->
getValue() ??
'';
350 $attr[
'form'] = $this->
getForm() ??
'';
358 $attr[
'rel'] =
'noopener';
form( $class_path, string $cmd)