You are here

function node_configuration_export_render in Configuration Management 7

Implements hook_configuration_export_render().

2 calls to node_configuration_export_render()
configuration_check_node in includes/configuration.node.inc
configuration_hash_node in includes/configuration.node.inc

File

includes/configuration.node.inc, line 64

Code

function node_configuration_export_render($module, $data, $export = NULL) {
  $elements = array(
    'name' => TRUE,
    'base' => FALSE,
    'description' => TRUE,
    'has_title' => FALSE,
    'title_label' => TRUE,
    'help' => TRUE,
  );
  $output = array();
  $output[] = '  $items = array(';
  foreach ($data as $type) {
    if ($info = node_type_get_type($type)) {

      // Force module name to be 'configuration' if set to 'node. If we leave as
      // 'node' the content type will be assumed to be database-stored by
      // the node module.
      $info->base = $info->base === 'node' ? 'configuration' : $info->base;
      $output[] = "    '{$type}' => array(";
      foreach ($elements as $key => $t) {
        if ($t) {
          $text = str_replace("'", "\\'", $info->{$key});
          $text = !empty($text) ? "t('{$text}')" : "''";
          $output[] = "      '{$key}' => {$text},";
        }
        else {
          $output[] = "      '{$key}' => '{$info->{$key}}',";
        }
      }
      $output[] = "    ),";
    }
  }
  $output[] = '  );';
  $output[] = '  return $items;';
  $output = implode("\n", $output);
  return array(
    'configuration_node_info' => $output,
  );
}