You are here

public static function SystemThemeSettings::validateFormElement in Express 8

Form validation handler.

Parameters

\Drupal\bootstrap\Utility\Element $form: The Element object that comprises the form.

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

Overrides FormBase::validateFormElement

File

themes/contrib/bootstrap/src/Plugin/Form/SystemThemeSettings.php, line 173
Contains \Drupal\bootstrap\Plugin\Form\SystemThemeSettings.

Class

SystemThemeSettings
Implements hook_form_system_theme_settings_alter().

Namespace

Drupal\bootstrap\Plugin\Form

Code

public static function validateFormElement(Element $form, FormStateInterface $form_state) {
  $theme = self::getTheme($form, $form_state);
  if (!$theme) {
    return;
  }

  // Iterate over all setting plugins and allow them to participate.
  foreach ($theme
    ->getSettingPlugin() as $setting) {

    // Allow the setting to participate in the form validation process.
    // Must call the "validateForm" method in case any setting actually uses it.
    // It should, in turn, invoke "validateFormElement", if the setting that
    // overrides it is implemented properly.
    $setting
      ->validateForm($form
      ->getArray(), $form_state);
  }
}