You are here

function features_load_feature in Features 7

Same name and namespace in other branches
  1. 7.2 features.module \features_load_feature()

Feature object loader.

8 calls to features_load_feature()
drush_features_diff in ./features.drush.inc
Show the diff of a feature module.
drush_features_export in ./features.drush.inc
Add a component to a features module, or create a new module with the selected components.
drush_features_revert in ./features.drush.inc
Revert a feature to it's code definition. Optionally accept a list of components to revert.
drush_features_update in ./features.drush.inc
Update an existing feature module.
features_modules_disabled in ./features.module
Implements hook_modules_disabled().

... See full list

File

./features.module, line 408
Module file for the features module, which enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together statisfy a certain use-case.

Code

function features_load_feature($name, $reset = FALSE) {

  // Use an alternative code path during installation, for better performance.
  if (variable_get('install_task') != 'done') {
    static $features;
    if (!isset($features[$name])) {

      // Set defaults for module info.
      $defaults = array(
        'dependencies' => array(),
        'description' => '',
        'package' => 'Other',
        'version' => NULL,
        'php' => DRUPAL_MINIMUM_PHP,
        'files' => array(),
        'bootstrap' => 0,
      );
      $info = drupal_parse_info_file(drupal_get_path('module', $name) . '/' . $name . '.info');
      $features[$name] = FALSE;
      if (!empty($info['features']) && empty($info['hidden'])) {

        // Build a fake file object with the data needed during installation.
        $features[$name] = new stdClass();
        $features[$name]->name = $name;
        $features[$name]->filename = drupal_get_path('module', $name) . '/' . $name . '.module';
        $features[$name]->type = 'module';
        $features[$name]->info = $info + $defaults;
      }
    }
    return $features[$name];
  }
  else {
    return features_get_features($name, $reset);
  }
}