You are here

function skinr_ui_get_element_title in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 skinr_ui.admin.inc \skinr_ui_get_element_title()

File

skinr_ui/skinr_ui.admin.inc, line 423
Admin page callbacks for the Skinr UI module.

Code

function skinr_ui_get_element_title($module, $element, $theme = NULL) {
  static $current_theme;
  static $themes;
  if (empty($theme)) {
    if (!isset($current_theme)) {
      $current_theme = skinr_current_theme(TRUE);
    }
    $theme = $current_theme;
  }
  $title = skinr_invoke_all('skinr_ui_element_title', $module, $element, $theme);
  $title = reset($title);
  if (!$title) {
    if (!isset($themes)) {
      $theme_handler = \Drupal::service('theme_handler');
      $themes = $theme_handler
        ->listInfo();
    }
    foreach ($themes as $t) {
      if (!empty($t->info['hidden'])) {
        continue;
      }
      if ($t->name == $theme) {

        // Already tried this one.
        continue;
      }
      if ($title = skinr_invoke_all('skinr_ui_element_title', $module, $element, $t->name)) {
        $title = reset($title);
        break;
      }
    }
  }
  return $title;
}