You are here

function content_type_groups_features_export_render in Content type groups 7.2

Same name and namespace in other branches
  1. 7 content_type_groups.features.inc \content_type_groups_features_export_render()

Implementation of hook_features_export_render().

This hook is called to export the component(s) selected via the features UI.

Parameters

string $module_name: The name of the feature module to be exported.

array $data: An array of machine name identifiers for the rendered objects.

array $export: An array with the full export for the feature (only called during update or recreate).

Return value

array The PHP code (an array) that will be rendered.

File

./content_type_groups.features.inc, line 66
Export functionality for the content type groups module.

Code

function content_type_groups_features_export_render($module_name, $data, $export = NULL) {
  $code = array(
    ' $content_type_groups = array();',
    '',
  );
  foreach ($data as $machine_name) {

    // Retrieve the content_type_group
    $group = new ContentTypeGroup($machine_name);

    // Format it in prep for export.
    $group_data = _content_type_groups_format_group_data($group);

    // Add the content type group to the feature.
    $code[] = ' $content_type_groups[\'' . $machine_name . '\'] = ' . features_var_export($group_data, ' ') . ';';
  }
  $code[] = '';
  $code[] = ' return $content_type_groups;';
  $code = implode("\n", $code);
  return array(
    'content_type_groups_features_default_settings' => $code,
  );
}