function uuid_panelizer_features_export_render in UUID Features Integration 7
Implements hook_features_export_render().
File
- includes/
uuid_panelizer.features.inc, line 92 - Features hooks for the panelizer features component.
Code
function uuid_panelizer_features_export_render($module, $data) {
$translatables = $code = array();
$code[] = ' $uuid_panelizer = array();';
$code[] = '';
foreach ($data as $key) {
$exploded_key = explode(':', $key);
if (count($exploded_key) < 3) {
continue;
}
list($entity_type, $entity_uuid, $view_mode) = $exploded_key;
$entity = entity_uuid_load($entity_type, array(
$entity_uuid,
), array(), TRUE);
$entity = reset($entity);
// Only export the display if the related entity exists and its a modified
// display with an uuid.
if ($entity === FALSE || empty($entity->panelizer[$view_mode]->did) || empty($entity->panelizer[$view_mode]->display->uuid)) {
continue;
}
$panelizer_settings = $entity->panelizer[$view_mode];
// Clone object to avoid changes by reference.
$export = clone $panelizer_settings->display;
drupal_alter('uuid_panelizer_features_export_render', $export, $entity, $module);
$code[] = ' // Modified panelizer display for ' . $entity_type . ' ' . $entity_uuid . '.';
$code[] = panels_export_display($export, ' ') . " \$uuid_panelizer[] = \$display;";
}
// Add translatables if any.
if (!empty($translatables)) {
$code[] = features_translatables_export($translatables, ' ');
}
$code[] = "\n return \$uuid_panelizer;";
$code = implode("\n", $code);
return array(
'uuid_features_default_panelizer' => $code,
);
}