You are here

function features_get_normal in Features 7.2

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

Get normal objects for a given module/component pair.

Parameters

string $component: The component name, e.g. 'field_instance'.

string $module_name: The name of the exported module.

bool $reset: If TRUE, the static cache will be reset.

Return value

mixed|false The normal objects that would be written into the feature on update.

2 calls to features_get_normal()
features_detect_overrides in ./features.export.inc
Detect differences between DB and code components of a feature.
features_get_signature in ./features.export.inc
Gets an md5 signature for a the state of an object in code or database.

File

./features.export.inc, line 1111
Contains functions that export configuration into feature modules.

Code

function features_get_normal($component, $module_name, $reset = FALSE) {
  if ($reset) {
    drupal_static_reset(__FUNCTION__);
  }
  $cache =& drupal_static(__FUNCTION__, array());
  if (!isset($cache[$module_name][$component])) {
    features_include();
    $code = NULL;
    $module = features_get_features($module_name);

    // Special handling for dependencies component.
    if ($component === 'dependencies') {
      $cache[$module_name][$component] = isset($module->info['dependencies']) ? array_filter($module->info['dependencies'], '_features_module_exists') : array();
    }
    else {
      $default_hook = features_get_default_hooks($component);
      if ($module && $default_hook && isset($module->info['features'][$component]) && features_hook($component, 'features_export_render')) {
        $code = features_invoke($component, 'features_export_render', $module_name, $module->info['features'][$component], NULL);
        $cache[$module_name][$component] = isset($code[$default_hook]) ? eval($code[$default_hook]) : FALSE;
      }
    }

    // Clear out vars for memory's sake.
    unset($code);
    unset($module);
  }
  return isset($cache[$module_name][$component]) ? $cache[$module_name][$component] : FALSE;
}