You are here

function node_features_export in Features 6

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

Implementation of 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_get_types('module', $type)) {
      if ($module_name != $info && module_exists($info)) {
        $export['dependencies'][$info] = $info;
      }

      // 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, array(
        'node',
        'features',
      )) || isset($map[$type])) {
        $export['features']['node'][$type] = $type;
      }

      // Create a pipe for CCK fields
      if (module_exists('content')) {
        $content_info = content_types($type);
        if (!empty($content_info['fields'])) {
          foreach ($content_info['fields'] as $key => $field) {
            $pipe['content'][] = "{$type}-{$field['field_name']}";
          }

          // If strongarm is present, create a pipe for the extra field weights
          // variable to be exported.
          if (module_exists('strongarm')) {
            $pipe['variable'][] = "content_extra_weights_{$type}";
          }
        }

        // Create a pipe for Fieldgroups
        if (function_exists('fieldgroup_groups') && ($groups = fieldgroup_groups($type))) {
          foreach ($groups as $group) {
            $pipe['fieldgroup'][] = "{$type}-{$group['group_name']}";
          }
        }
      }
    }
  }
  return $pipe;
}