You are here

function features_include in Features 7.2

Same name and namespace in other branches
  1. 6 features.module \features_include()
  2. 7 features.module \features_include()

Includes PHP files where features components are defined.

The function does the following:

  • Include the files in 'includes/features.*.inc', where features defines components on behalf of other modules.
  • Dynamically declare the functions for features components based on ctools.
  • Include files that contain component hooks, as specified in the 'file' property of each component.

Parameters

bool $reset: (optional) If TRUE, the operation will run again even if it has run before in the same request. This is useful e.g. if additional modules were enabled since then.

19 calls to features_include()
drush_features_revert in ./features.drush.inc
Drush command callback for 'features-revert'.
FeaturesCtoolsIntegrationTest::testModuleEnable in tests/features.test
Run test.
FeaturesUserTestCase::_test_filter in tests/features.test
Loads or saves an example filter format for testing.
features_access_override_actions in ./features.module
Menu access callback for 'admin/structure/features/%feature/diff'.
features_admin_components_revert in ./features.admin.inc
Submit handler for the 'Revert components' button.

... See full list

1 string reference to 'features_include'
features_update_6101 in ./features.install
Update 6101: Set codestate signature for all features.

File

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

Code

function features_include($reset = FALSE) {
  static $once;
  if (!isset($once) || $reset) {
    $once = TRUE;

    // Features provides integration on behalf of these modules.
    // The features include provides handling for the feature dependencies.
    // Note that ctools is placed last because it implements hooks "dynamically"
    // for other modules.
    $modules = array(
      'features',
      'block',
      'contact',
      'context',
      'field',
      'filter',
      'image',
      'locale',
      'menu',
      'node',
      'taxonomy',
      'user',
      'views',
      'ctools',
    );
    foreach (array_filter($modules, 'module_exists') as $module) {
      module_load_include('inc', 'features', "includes/features.{$module}");
    }
    if (module_exists('ctools')) {

      // Finally, add ctools eval'd implementations.
      ctools_features_declare_functions($reset);
    }

    // Clear static cache, since we've now included new implementers.
    foreach (features_get_components(NULL, 'file', $reset) as $file) {
      if (is_file(DRUPAL_ROOT . '/' . $file)) {
        require_once DRUPAL_ROOT . '/' . $file;
      }
    }
  }
}