Button

class Button

Provides an action button form element.

When the button is pressed, the form will be submitted to Drupal, where it is validated and rebuilt. The submit handler is not invoked.

Properties:

  • #limit_validation_errors: An array of form element keys that will block form submission when validation for these elements or any child elements fails. Specify an empty array to suppress all form validation errors.
  • #value: The text to be shown on the button.

Usage Example:

$form['actions']['preview'] = array(
  '#type' => 'button',
  '#value' => $this->t('Preview'),
);

Plugin annotation

@FormElement("button")

Hierarchy