You are here

function theme_switcher_available_conditions_alter in Theme Switcher Rules 8

Implements available_conditions_alter().

File

./theme_switcher.module, line 39
Contains hook implementations for Theme Switcher module.

Code

function theme_switcher_available_conditions_alter(&$definitions) {
  foreach ($definitions as $condition_id => $definition) {

    // Don't display the current theme condition (this creates a internal loop).
    if ($condition_id == 'current_theme') {
      unset($definitions[$condition_id]);
    }
    elseif ($condition_id == 'language') {
      $language_manager = Drupal::service('language_manager');
      if (!$language_manager
        ->isMultilingual()) {
        unset($definitions[$condition_id]);
      }
    }
  }
}