You are here

function uuid_node_features_export_options in UUID Features Integration 7

Same name and namespace in other branches
  1. 6 includes/uuid_node.features.inc \uuid_node_features_export_options()

Implements hook_features_export_options().

File

includes/uuid_node.features.inc, line 10
Features hooks for the uuid_node features component.

Code

function uuid_node_features_export_options() {
  $options = array();

  // Check what content types are enabled for uuid features export.
  $enabled_types = array();
  $entity_info = entity_get_info('node');
  foreach ($entity_info['bundles'] as $key => $value) {
    if (variable_get("uuid_features_entity_node_{$key}", FALSE)) {
      $enabled_types[$key] = $key;
    }
  }
  if (!empty($enabled_types)) {
    $types = node_type_get_names();
    $query = db_select('node', 'n');
    $query
      ->fields('n', array(
      'nid',
      'title',
      'type',
      'uuid',
    ))
      ->condition('type', $enabled_types)
      ->orderBy('type')
      ->orderBy('title')
      ->addTag('uuid_node_features_export_options');
    $nodes = $query
      ->execute()
      ->fetchAll();
    foreach ($nodes as $node) {
      $options[$node->uuid] = t('@type: @title', array(
        '@type' => $types[$node->type],
        '@title' => $node->title,
      ));
    }
  }
  drupal_alter('uuid_node_features_export_options', $options);
  return $options;
}