You are here

function metatag_get_info in Metatag 7

Get the meta tag information array of a meta tag.

Parameters

string $name: The meta tag name, e.g. description, for which the info shall be returned, or NULL to return an array with info about all meta tags.

21 calls to metatag_get_info()
metatag.search_api.inc in ./metatag.search_api.inc
Contains MetatagSearchAlterCallback.
MetatagBulkRevertTest::testBulkRevertPageLoads in tests/MetatagBulkRevertTest.test
Test the Bulk Revert functionality works.
metatag_admin_settings_form in ./metatag.admin.inc
Misc settings page.
metatag_bulk_revert_form in ./metatag.admin.inc
Form constructor to revert nodes to their default metatags.
metatag_config_get_replacements in ./metatag.module
Identify the meta tags that have been deprecated and replaced by others.

... See full list

4 string references to 'metatag_get_info'
metatag_config_cache_clear in ./metatag.module
Clear the metatag configuration cache.
metatag_update_delete_config in ./metatag.install
Remove a specific meta tag from all configs.
metatag_update_replace_config_tag in ./metatag.install
Replace one meta tag with another in the configs.
metatag_update_replace_config_value in ./metatag.install
Replace one meta tag with another in the configs.

File

./metatag.module, line 2185
Primary hook implementations for Metatag.

Code

function metatag_get_info($type = NULL, $name = NULL) {

  // Use the advanced drupal_static() pattern, since this is called very often.
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['metatag_info'] =& drupal_static(__FUNCTION__);
  }
  $info =& $drupal_static_fast['metatag_info'];
  global $language;
  if (!isset($info)) {

    // hook_metatag_info() includes translated strings, so each language is
    // cached separately.
    $cid = 'info:' . $language->language;
    if ($cache = metatag_cache_get($cid)) {
      $info = $cache->data;
    }
    else {

      // Obtain all metatag specs defined in other modules using
      // hook_metatag_info().
      $info = module_invoke_all('metatag_info');
      $info += array(
        'tags' => array(),
        'groups' => array(),
      );

      // Merge in default values.
      foreach ($info['tags'] as $key => $data) {
        $info['tags'][$key] += array(
          // Merge in default values.
          'name' => $key,
          'class' => 'DrupalTextMetaTag',
        );
      }

      // Let other modules alter the entity info using
      // hook_metatag_info_alter().
      drupal_alter('metatag_info', $info);
      metatag_cache_set($cid, $info);
    }
  }
  if (isset($type) && isset($name)) {
    return isset($info[$type][$name]) ? $info[$type][$name] : FALSE;
  }
  elseif (isset($type)) {
    return isset($info[$type]) ? $info[$type] : array();
  }
  else {
    return $info;
  }
}