You are here

function node_features_export in Features 7

Same name and namespace in other branches
  1. 6 includes/features.node.inc \node_features_export()
  2. 7.2 includes/features.node.inc \node_features_export()

Implements hook_features_export.

File

includes/features.node.inc, line 26

Code

function node_features_export($data, &$export, $module_name = '') {
  $pipe = array();
  $map = features_get_default_map('node');
  foreach ($data as $type) {

    // Poll node module to determine who provides the node type.
    if ($info = node_type_get_type($type)) {

      // If this node type is provided by a different module, add it as a dependency
      if (isset($map[$type]) && $map[$type] != $module_name) {
        $export['dependencies'][$map[$type]] = $map[$type];
      }
      elseif (in_array($info->base, array(
        'node_content',
        'features',
      ))) {
        $export['features']['node'][$type] = $type;
        $export['dependencies']['node'] = 'node';
        $export['dependencies']['features'] = 'features';
      }
      $fields = field_info_instances('node', $type);
      foreach ($fields as $name => $field) {
        $pipe['field'][] = "node-{$field['bundle']}-{$field['field_name']}";
      }
    }
  }
  return $pipe;
}