function node_entity_info

Implements hook_entity_info().

File

drupal/core/modules/node/node.module, line 179
The core module that allows content to be submitted to the site.

Code

function node_entity_info(&$info) {

  // Add a translation handler for fields if the language module is enabled.
  if (module_exists('language')) {
    $info['node']['translation']['node'] = TRUE;
  }

  // Search integration is provided by node.module, so search-related
  // view modes for nodes are defined here and not in search.module.
  if (module_exists('search')) {
    $info['node']['view_modes']['search_index'] = array(
      'label' => t('Search index'),
      'custom_settings' => FALSE,
    );
    $info['node']['view_modes']['search_result'] = array(
      'label' => t('Search result'),
      '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) {
    $info['node']['bundles'][$type] = array(
      'label' => $name,
      'admin' => array(
        'path' => 'admin/structure/types/manage/%node_type',
        'real path' => 'admin/structure/types/manage/' . $type,
        'bundle argument' => 4,
        'access arguments' => array(
          'administer content types',
        ),
      ),
    );
  }
}