1.20.x node.module | node_entity_info() |
Implements hook_entity_info().
File
- modules/
node/ node.module, line 143 - The core module that allows content to be submitted to the site.
Code
function node_entity_info() {
$entity_info = array(
'node' => array(
'label' => t('Node'),
'bundle label' => t('Type'),
'controller class' => 'NodeStorageController',
'entity class' => 'Node',
'base table' => 'node',
'revision table' => 'node_revision',
'fieldable' => TRUE,
'redirect support' => TRUE,
'entity keys' => array(
'id' => 'nid',
'revision' => 'vid',
'bundle' => 'type',
),
'bundle keys' => array(
'bundle' => 'type',
),
'bundles' => array(),
'view modes' => array(
'full' => array(
'label' => t('Full content'),
'custom settings' => FALSE,
),
'teaser' => array(
'label' => t('Teaser'),
'custom settings' => TRUE,
),
'rss' => array(
'label' => t('RSS'),
'custom settings' => FALSE,
),
'token' => array(
'label' => t('Tokens'),
'custom settings' => FALSE,
),
),
),
);
// If the cache table has been created, then enable entity caching on nodes.
if (db_table_exists('cache_entity_node')) {
$entity_info['node']['entity cache'] = TRUE;
$entity_info['node']['field cache'] = FALSE;
}
// Search integration is provided by node.module, so search-related
// display modes for nodes are defined here and not in search.module.
if (module_exists('search')) {
$entity_info['node']['view modes'] += array(
'search_index' => array(
'label' => t('Search index'),
'custom settings' => FALSE,
),
'search_result' => array(
'label' => t('Search result highlighting input'),
'custom settings' => FALSE,
),
);
}
// Bundles must provide a human readable name so we can create help and error
// messages, and the path to attach Field admin pages to.
node_type_cache_reset();
foreach (node_type_get_names() as $type => $name) {
$entity_info['node']['bundles'][$type] = array(
'label' => $name,
'admin' => array(
'path' => 'admin/structure/types/manage/%node_type',
'real path' => 'admin/structure/types/manage/' . str_replace('_', '-', $type),
'bundle argument' => 4,
'access arguments' => array('administer content types'),
),
);
}
return $entity_info;
}