[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/features/includes/ -> features.features.inc (source)

   1  <?php
   2  // $Id: features.features.inc,v 1.1.2.2 2010/08/20 14:51:59 yhahn Exp $
   3  
   4  /**
   5   * Implementation of hook_features_api().
   6   */
   7  function features_features_api() {
   8    return array(
   9      'dependencies' => array(
  10        'name' => 'Dependencies',
  11        'feature_source' => TRUE,
  12        'duplicates' => FEATURES_DUPLICATES_ALLOWED,
  13      ),
  14    );
  15  }
  16  
  17  /**
  18   * Implementation of hook_features_export_options().
  19   */
  20  function dependencies_features_export_options() {
  21    // Excluded modules.
  22    $excluded = drupal_required_modules();
  23    $options = array();
  24    foreach (features_get_modules() as $module_name => $info) {
  25      if (!in_array($module_name, $excluded) && $info->status && !empty($info->info)) {
  26        $options[$module_name] = $info->info['name'];
  27      }
  28    }
  29    return $options;
  30  }
  31  
  32  /**
  33   * Implementation of hook_features_export().
  34   */
  35  function dependencies_features_export($data, &$export, $module_name = '') {
  36    // Don't allow a module to depend upon itself.
  37    if (!empty($data[$module_name])) {
  38      unset($data[$module_name]);
  39    }
  40  
  41    // Clean up existing dependencies and merge.
  42    $export['dependencies'] = _features_export_minimize_dependencies($export['dependencies'], $module_name);
  43    $export['dependencies'] = array_merge($data, $export['dependencies']);
  44    $export['dependencies'] = array_unique($export['dependencies']);
  45  }
  46  
  47  /**
  48   * Implementation of hook_features_revert().
  49   */
  50  function dependencies_features_revert($module) {
  51    dependencies_features_rebuild($module);
  52  }
  53  
  54  /**
  55   * Implementation of hook_features_rebuild().
  56   * Ensure that all of a feature's dependencies are enabled.
  57   */
  58  function dependencies_features_rebuild($module) {
  59    $feature = features_get_features($module);
  60    if (!empty($feature->info['dependencies'])) {
  61      $install = array();
  62      foreach ($feature->info['dependencies'] as $dependency) {
  63        if (!module_exists($dependency)) {
  64          $install[] = $dependency;
  65        }
  66      }
  67      if (!empty($install)) {
  68        features_install_modules($install);
  69      }
  70    }
  71  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7