You are here

function _webform_bootstrap_is_active_theme in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_bootstrap/webform_bootstrap.module \_webform_bootstrap_is_active_theme()

Determine if Bootstrap is the active theme.

Return value

bool TRUE if Bootstrap is the active theme.

8 calls to _webform_bootstrap_is_active_theme()
webform_bootstrap_link_alter in modules/webform_bootstrap/webform_bootstrap.module
Implements hook_link_alter().
webform_bootstrap_page_attachments in modules/webform_bootstrap/webform_bootstrap.module
Implements hook_page_attachments().
webform_bootstrap_preprocess_fieldset in modules/webform_bootstrap/webform_bootstrap.module
Implements template_preprocess_fieldset().
webform_bootstrap_preprocess_file_managed_file in modules/webform_bootstrap/webform_bootstrap.module
Implements template_preprocess_file_managed_file().
webform_bootstrap_preprocess_form_element in modules/webform_bootstrap/webform_bootstrap.module
Implements hook_preprocess_form_element() for form element templates.

... See full list

File

modules/webform_bootstrap/webform_bootstrap.module, line 244
Helps support Webform to Bootstrap integration.

Code

function _webform_bootstrap_is_active_theme() {
  $is_active_theme =& drupal_static(__FUNCTION__);
  if (isset($is_active_theme)) {
    return $is_active_theme;
  }

  // Catch 'TypeError' in Drupal\webform\WebformThemeManager::__construct()
  // which is triggered by service argument changes before the cache is cleared.
  try {

    /** @var \Drupal\webform\WebformThemeManagerInterface $theme_manager */
    $theme_manager = \Drupal::service('webform.theme_manager');
    $is_active_theme = $theme_manager
      ->isActiveTheme('bootstrap');
  } catch (\TypeError $error) {
    $is_active_theme = FALSE;
  }
  return $is_active_theme;
}