You are here

function features_get_default_map in Features 7

Same name and namespace in other branches
  1. 6 features.export.inc \features_get_default_map()
  2. 7.2 features.export.inc \features_get_default_map()

Get a map of components to their providing modules.

9 calls to features_get_default_map()
features_export_form in ./features.admin.inc
Form constructor for features export form.
field_features_export in includes/features.field.inc
Implements hook_features_export().
image_features_export in includes/features.image.inc
Implements hook_features_export().
menu_custom_features_export in includes/features.menu.inc
Implements hook_features_export().
menu_links_features_export in includes/features.menu.inc
Implements hook_features_export().

... See full list

File

./features.export.inc, line 711

Code

function features_get_default_map($component, $attribute = NULL, $callback = NULL, $reset = FALSE) {
  static $map = array();
  features_include();
  features_include_defaults($component);
  if ((!isset($map[$component]) || $reset) && ($default_hook = features_get_default_hooks($component))) {
    $map[$component] = array();
    foreach (module_implements($default_hook) as $module) {
      if ($defaults = features_get_default($component, $module)) {
        foreach ($defaults as $key => $object) {
          if (isset($callback)) {
            if ($object_key = $callback($object)) {
              $map[$component][$object_key] = $module;
            }
          }
          elseif (isset($attribute)) {
            if (is_object($object) && isset($object->{$attribute})) {
              $map[$component][$object->{$attribute}] = $module;
            }
            elseif (is_array($object) && isset($object[$attribute])) {
              $map[$component][$object[$attribute]] = $module;
            }
          }
          elseif (!isset($attribute) && !isset($callback)) {
            if (!is_numeric($key)) {
              $map[$component][$key] = $module;
            }
          }
          else {
            return FALSE;
          }
        }
      }
    }
  }
  return isset($map[$component]) ? $map[$component] : FALSE;
}