You are here

function features_load_feature in Features 7.2

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

Gets an object with information about a feature module.

Parameters

string $name: Name of a (feature) module.

bool $reset: (optional) If TRUE, the cache will be cleared before fetching.

Return value

\stdClass|false Object with module info, or FALSE if not found or not a feature.

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
Drush command callback for 'features-export'.
drush_features_revert in ./features.drush.inc
Drush command callback for 'features-revert'.
drush_features_update in ./features.drush.inc
Drush command callback for 'features-update'.
features_modules_disabled in ./features.module
Implements hook_modules_disabled().

... See full list

File

./features.module, line 568
Main *.module file for the 'features' module.

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]->status = module_exists($name);
        $features[$name]->info = $info + $defaults;
      }
    }
    return $features[$name];
  }
  else {
    return features_get_features($name, $reset);
  }
}