You are here

function config_pages_config_pages_context_label in Config Pages 7

Implements hook_config_pages_context_label().

File

./config_pages.module, line 111
This module is based on Model module (https://drupal.org/project/model) and most of the comments left untouched but have entity types renamed. Suuport for features added.

Code

function config_pages_config_pages_context_label($key, $value) {
  global $language;

  // Default value.
  $label = NULL;

  // Get value for specified context key.
  switch ($key) {
    case 'language':
      $list = language_list();
      if (!empty($list[$value])) {
        $label = t('Language = @lang', array(
          '@lang' => $list[$value]->name,
        ));
      }
      break;
    case 'host':
      $label = t('Host = @host', array(
        '@host' => $_SERVER['HTTP_HOST'],
      ));
      break;
    case 'domain':
      if (module_exists('domain')) {
        $domain = domain_get_domain();
        $label = t('Domain = @name (@path)', array(
          '@name' => $domain['machine_name'],
          '@path' => $domain['path'],
        ));
      }
      else {
        $label = t('All Domains (module not enabled)');
      }
      break;
  }
  return $label;
}