content_def()
importexportapi/definitions/contrib/cck/importexportapi_content.inc, line 11
Implementation of hook_def().
<?php
function content_def() {
$defs = array();
$def = array(
'#type' => 'entity',
'#title' => t('Content field'),
'#db_default_table' => 'node_field',
'#xml_plural' => 'content-fields',
'#csv_plural' => 'content-fields'
);
$def['field_name'] = array(
'#title' => t('Field name'),
'#key_component' => TRUE
);
$def['field_type'] = array(
'#title' => t('Field type'),
'#db_field_unaliased' => 'type'
);
$def['global_settings'] = array(
'#type' => 'serialized',
'#title' => t('Global settings')
);
$def['required'] = array(
'#type' => 'int',
'#title' => t('Required')
);
$def['multiple'] = array(
'#type' => 'int',
'#title' => t('Multiple values')
);
$def['db_storage'] = array(
'#type' => 'int',
'#title' => t('Uses database storage')
);
$defs['content_field'] = $def;
$def = array(
'#type' => 'entity',
'#title' => t('Content type'),
'#db_default_table' => 'node_type_content',
'#xml_plural' => 'content-types',
'#csv_plural' => 'content-types'
);
$def['type_name'] = array(
'#title' => t('Type name'),
'#key_component' => TRUE
);
$def['type_label'] = array(
'#title' => t('Label'),
'#db_field_unaliased' => 'label',
'#alt_key_for' => 'type_name'
);
$def['description'] = array(
'#title' => t('Description')
);
$def['help_text'] = array(
'#title' => t('Help text'),
'#db_field_unaliased' => 'help'
);
$def['title_label'] = array(
'#title' => t('Title label')
);
$def['fields'] = array(
'#type' => 'array',
'#title' => t('Fields'),
'#db_default_table' => 'node_field_instance',
'#xml_plural' => 'fields',
'#csv_plural' => 'content-field-instances',
'#xml_mapping' => 'field'
);
$def['fields']['field_name'] = array(
'#title' => t('Field name'),
'#key_component' => TRUE,
'#reference_entity' => 'content_field'
);
$def['fields']['type_name'] = array(
'#title' => t('Type name'),
'#key_component' => TRUE,
'#reference_entity' => 'content_type'
);
$def['fields']['weight'] = array(
'#type' => 'int',
'#title' => t('Weight')
);
$def['fields']['label'] = array(
'#title' => t('Label')
);
$def['fields']['widget_type'] = array(
'#title' => t('Widget type')
);
$def['fields']['widget_settings'] = array(
'#type' => 'serialized',
'#title' => t('Widget settings')
);
$def['fields']['description'] = array(
'#title' => t('Description')
);
$defs['content_type'] = $def;
$content_types = content_types();
foreach ($content_types as $content_type_name => $content_type_info) {
// In 5.x everythings cck type, so exclude the basics
if (isset($content_type_info['orig_type'])) {
continue;
}
$content_type_name_system = str_replace('-', '_', $content_type_name);
$content_type_name_mapping = str_replace('_', '-', $content_type_name);
$def = importexportapi_node_get_def($content_type_name_system);
$table_info = array();
$def['#title'] = $content_type_info['name'];
$def['#xml_plural'] = $def['#csv_plural'] = $content_type_name_mapping .'-collection';
$def['revisions']['#csv_plural'] = $content_type_name_mapping .'-revisions';
$def['type']['#db_filter'] = array(
'values' => array($content_type_name)
);
foreach ($content_type_info['fields'] as $field_name => $field_info) {
$table_info += _importexportapi_content_generate_fields($def, $field_info);
}
foreach ($table_info as $table => $table_info) {
_importexportapi_content_add_parent_references($def, $table, $table_info, $content_type_name_system);
}
$defs[$content_type_name_system] = $def;
}
return $defs;
}
?>