You are here

function uuid_panelizer_features_export_options in UUID Features Integration 7

Implements hook_features_export_options().

File

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

Code

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

  // Fetch entity specific display configurations.
  $results = db_select('panelizer_entity')
    ->fields('panelizer_entity', array(
    'entity_type',
    'entity_id',
    'view_mode',
  ))
    ->isNull('name')
    ->groupBy('entity_type')
    ->groupBy('entity_id')
    ->addTag('uuid_panelizer_features_export_options')
    ->execute();
  foreach ($results as $panelizer_entity) {
    $entity = entity_load_single($panelizer_entity->entity_type, $panelizer_entity->entity_id);

    // Only export the display if its a currently modified display with an uuid.
    if ($entity === FALSE || empty($entity->panelizer[$panelizer_entity->view_mode]->did) || empty($entity->panelizer[$panelizer_entity->view_mode]->display->uuid)) {
      continue;
    }
    $label = entity_label($panelizer_entity->entity_type, $entity);
    $options[$panelizer_entity->entity_type . ':' . $entity->uuid . ':' . $panelizer_entity->view_mode] = t('@entity_type: !label [@id]', array(
      '@entity_type' => $panelizer_entity->entity_type,
      '!label' => $label,
      '@id' => $panelizer_entity->entity_id,
    ));
  }
  return $options;
}