You are here

function node_configuration_export in Configuration Management 7

Implements hook_configuration_export.

File

includes/configuration.node.inc, line 27

Code

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

    // 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) {
        $new_dependencies[$map[$type]] = $map[$type];
      }

      // Otherwise export the node type.
      if (in_array($info->base, array(
        'node_content',
        'configuration',
      ))) {
        $export['configuration']['node'][$type] = $type;
        $new_dependencies['node'] = 'node';
        $new_dependencies['configuration'] = 'configuration';
      }

      // Merge new dependencies with global.
      $export['dependencies'] = array_merge($export['dependencies'], $new_dependencies);
      $fields = field_info_instances('node', $type);
      foreach ($fields as $name => $field) {
        $export['configuration_dependency']['configuration']['field']["node-{$field['bundle']}-{$field['field_name']}"] = $type;
        $export['configuration_dependency']['modules']['field']["node-{$field['bundle']}-{$field['field_name']}"] = serialize($new_dependencies);
        $pipe['field'][] = "node-{$field['bundle']}-{$field['field_name']}";
      }
    }
  }
  return $pipe;
}