You are here

public static function BaseSettings::executeLibraryElementSubmitHandlers in Charts 8.4

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

Submits elements by calling their #charts_library_settings_element_submit.

Callbacks.

This approach was took from the commerce module to work around the fact. that drupal core doesn't have an element_submit property.

Parameters

array &$form: The form.

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

1 call to BaseSettings::executeLibraryElementSubmitHandlers()
BaseSettings::doExecuteLibrarySubmitHandlers in src/Element/BaseSettings.php
Calls the #charts_library_settings_element_submit callbacks recursively.

File

src/Element/BaseSettings.php, line 638

Class

BaseSettings
Provides a form element for setting a chart.

Namespace

Drupal\charts\Element

Code

public static function executeLibraryElementSubmitHandlers(array &$form, FormStateInterface $form_state) {
  if (!$form_state
    ->isSubmitted() || $form_state
    ->hasAnyErrors()) {

    // The form wasn't submitted (#ajax in progress) or failed validation.
    return;
  }
  $triggering_element = $form_state
    ->getTriggeringElement();
  $button_type = isset($triggering_element['#button_type']) ? $triggering_element['#button_type'] : '';
  if ($button_type != 'primary' && count($form_state
    ->getButtons()) > 1) {

    // The form was submitted, but not via the primary button, which
    // indicates that it will probably be rebuilt.
    return;
  }
  self::doExecuteLibrarySubmitHandlers($form, $form_state);
}