function public static function SystemThemeSettings::getTheme

8.x-3.x SystemThemeSettings.php public static SystemThemeSettings::getTheme(Element $form, FormStateInterface $form_state)

Retrieves the currently selected theme on the settings form.

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.

Return value

\Drupal\bootstrap\Theme|false The currently selected theme object or FALSE if not a Bootstrap theme.

Class

SystemThemeSettings
Implements hook_form_system_theme_settings_alter().

Namespace

Drupal\bootstrap\Plugin\Form

Source src/Plugin/Form/SystemThemeSettings.php (line 160)

public static function getTheme(Element $form, FormStateInterface $form_state) {
  $build_info = $form_state->getBuildInfo();
  $theme = isset($build_info['args'][0]) ? Bootstrap::getTheme($build_info['args'][0]) : FALSE;

  // Do not continue if the theme is not Bootstrap specific.
  if (!$theme || !$theme->isBootstrap()) {
    unset($form['#submit'][0]);
    unset($form['#validate'][0]);
  }

  return $theme;
}