You are here

function ctools_component_features_export in Features 6

Same name and namespace in other branches
  1. 7.2 includes/features.ctools.inc \ctools_component_features_export()
  2. 7 includes/features.ctools.inc \ctools_component_features_export()

Master implementation of hook_features_export() for all ctools components.

1 call to ctools_component_features_export()
context_features_export in includes/features.context.inc
Implementation of hook_features_export().

File

includes/features.ctools.inc, line 125

Code

function ctools_component_features_export($component, $data, &$export, $module_name = '') {

  // Add the actual implementing module as a dependency
  $info = _ctools_features_get_info();
  if ($module_name !== $info[$component]['module']) {
    $export['dependencies'][$info[$component]['module']] = $info[$component]['module'];
  }

  // Add the components
  foreach ($data as $object_name) {
    if ($object = _ctools_features_export_crud_load($component, $object_name)) {

      // If this object is provided as a default by a different module, don't
      // export and add that module as a dependency instead.
      if (!empty($object->export_module) && $object->export_module !== $module_name) {
        $export['dependencies'][$object->export_module] = $object->export_module;
        if (isset($export['features'][$component][$object_name])) {
          unset($export['features'][$component][$object_name]);
        }
      }
      else {
        $export['features'][$component][$object_name] = $object_name;
      }
    }
  }

  // Let CTools handle API integration for this component.
  return array(
    'ctools' => array(
      $component,
    ),
  );
}