You are here

function metatag_config_get_parent_instances in Metatag 7

Return all the parents of a given configuration instance.

Parameters

string $instance: A meta tag configuration instance.

Return value

array An array of instances starting with the $instance parameter, with the end of the array being the global instance.

5 calls to metatag_config_get_parent_instances()
metatag_config_is_enabled in ./metatag.module
Checks if a metatag configuration record is enabled.
metatag_config_load_with_defaults in ./metatag.module
Load a metatag configuration record with all the defaults merged in.
metatag_config_overview in ./metatag.admin.inc
Menu callback for the main Metatag configuration page.
_metatag_config_instance_get_available_options in ./metatag.admin.inc
Build an FAPI #options array for the instance select field.
_metatag_config_overview_indent in ./metatag.admin.inc
Indent the output for a given overview item.

File

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

Code

function metatag_config_get_parent_instances($instance, $include_global = TRUE) {
  $parents = array();
  $segments = explode(':', $instance);
  while (count($segments) > 0) {
    $parents[] = implode(':', $segments);
    array_pop($segments);
  }
  if ($include_global && end($parents) !== 'global') {
    $parents[] = 'global';
  }
  reset($parents);
  return $parents;
}