You are here

function config_pages_features_export_render in Config Pages 7

Implements hook_features_export_render().

File

./config_pages.features.inc, line 109
Integrates with features.

Code

function config_pages_features_export_render($module, $data, $export = NULL) {
  $args = func_get_args();
  $code = array();
  $code[] = '  $config_pages = array();';
  $code[] = '';
  foreach ($data as $name) {
    $data = explode('-', $name);
    $type = array_shift($data);
    $context = implode('-', $data);
    if ($config = config_pages_load_entity($type, $context)) {
      $export = _config_pages_features_export_data('config_pages', $type, $config);

      // Allow other modules to add support for complex data.
      drupal_alter('config_pages_features_export', $export, $config);
      $config_export = features_var_export($export, '  ');
      $config_identifier = features_var_export($name);
      $code[] = "  // Exported format: {$name}.";
      $code[] = "  \$config_pages[{$config_identifier}] = {$config_export};";
      $code[] = "";
    }
  }
  $code[] = '  return $config_pages;';
  $code = implode("\n", $code);
  $result = array(
    'config_pages_default_data' => $code,
  );
  return $result;
}