You are here

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

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

Calls the #charts_library_settings_element_submit callbacks recursively.

Parameters

array &$element: The current element.

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

1 call to BaseSettings::doExecuteLibrarySubmitHandlers()
BaseSettings::executeLibraryElementSubmitHandlers in src/Element/BaseSettings.php
Submits elements by calling their #charts_library_settings_element_submit.

File

src/Element/BaseSettings.php, line 664

Class

BaseSettings
Provides a form element for setting a chart.

Namespace

Drupal\charts\Element

Code

public static function doExecuteLibrarySubmitHandlers(array &$element, FormStateInterface $form_state) {

  // Recurse through all children.
  foreach (Element::children($element) as $key) {
    if (!empty($element[$key])) {
      static::executeLibraryElementSubmitHandlers($element[$key], $form_state);
    }
  }

  // If there are callbacks on this level, run them.
  if (!empty($element['#charts_library_settings_element_submit'])) {
    foreach ($element['#charts_library_settings_element_submit'] as $callback) {
      call_user_func_array($callback, [
        &$element,
        &$form_state,
      ]);
    }
  }
}