You are here

public static function WidgetSubmit::attach in Library 8

Attaches the widget submit functionality to the given form.

Parameters

array $form: The form.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

1 call to WidgetSubmit::attach()
library_form_node_form_alter in ./library.module
Implements hook_form_node_form_alter().

File

src/WidgetSubmit.php, line 28

Class

WidgetSubmit
Performs widget submission.

Namespace

Drupal\library

Code

public static function attach(array &$form, FormStateInterface $form_state) {
  foreach ($form['actions'] as $key => $action) {
    if (isset($form['actions'][$key]['#submit'])) {
      $form['actions'][$key]['#submit'][] = [
        get_called_class(),
        'doSubmit',
      ];
    }
  }
}