You are here

public static function SystemThemeSettings::getTheme in Express 8

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.

4 calls to SystemThemeSettings::getTheme()
Schemas::updateTheme in themes/contrib/bootstrap/src/Plugin/Setting/Schemas.php
Callback for updating a theme.
SystemThemeSettings::alterFormElement in themes/contrib/bootstrap/src/Plugin/Form/SystemThemeSettings.php
The alter method to store the code.
SystemThemeSettings::submitFormElement in themes/contrib/bootstrap/src/Plugin/Form/SystemThemeSettings.php
Form submission handler.
SystemThemeSettings::validateFormElement in themes/contrib/bootstrap/src/Plugin/Form/SystemThemeSettings.php
Form validation handler.

File

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

Class

SystemThemeSettings
Implements hook_form_system_theme_settings_alter().

Namespace

Drupal\bootstrap\Plugin\Form

Code

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;
}