You are here

public static function BaseSettings::attachLibraryElementSubmit in Charts 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Element/BaseSettings.php \Drupal\charts\Element\BaseSettings::attachLibraryElementSubmit()

Attaches the #charts_library_settings_element_submit functionality.

Parameters

array $element: The form element being processed.

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

array $complete_form: The complete form structure.

Return value

array The processed form element.

File

src/Element/BaseSettings.php, line 614

Class

BaseSettings
Provides a form element for setting a chart.

Namespace

Drupal\charts\Element

Code

public static function attachLibraryElementSubmit(array $element, FormStateInterface $form_state, array &$complete_form) {
  if (isset($complete_form['#charts_library_settings_element_submit_attached'])) {
    return $element;
  }

  // The #validate callbacks of the complete form run last.
  // That allows executeElementSubmitHandlers() to be completely certain that
  // the form has passed validation before proceeding.
  $complete_form['#validate'][] = [
    get_class(),
    'executeLibraryElementSubmitHandlers',
  ];
  $complete_form['#charts_library_settings_element_submit_attached'] = TRUE;
  return $element;
}