Chris@0: /** Chris@0: * Implements hook_entity_info(). Chris@0: */ Chris@0: function {{ machine_name }}_entity_info() { Chris@0: $return = array( Chris@0: 'node' => array( Chris@0: 'label' => t('Node'), Chris@0: 'controller class' => 'NodeController', Chris@0: 'base table' => 'node', Chris@0: 'revision table' => 'node_revision', Chris@0: 'uri callback' => 'node_uri', Chris@0: 'fieldable' => TRUE, Chris@0: 'translation' => array( Chris@0: 'locale' => TRUE, Chris@0: ), Chris@0: 'entity keys' => array( Chris@0: 'id' => 'nid', Chris@0: 'revision' => 'vid', Chris@0: 'bundle' => 'type', Chris@0: 'language' => 'language', Chris@0: ), Chris@0: 'bundle keys' => array( Chris@0: 'bundle' => 'type', Chris@0: ), Chris@0: 'bundles' => array(), Chris@0: 'view modes' => array( Chris@0: 'full' => array( Chris@0: 'label' => t('Full content'), Chris@0: 'custom settings' => FALSE, Chris@0: ), Chris@0: 'teaser' => array( Chris@0: 'label' => t('Teaser'), Chris@0: 'custom settings' => TRUE, Chris@0: ), Chris@0: 'rss' => array( Chris@0: 'label' => t('RSS'), Chris@0: 'custom settings' => FALSE, Chris@0: ), Chris@0: ), Chris@0: ), Chris@0: ); Chris@0: Chris@0: // Search integration is provided by node.module, so search-related Chris@0: // view modes for nodes are defined here and not in search.module. Chris@0: if (module_exists('search')) { Chris@0: $return['node']['view modes'] += array( Chris@0: 'search_index' => array( Chris@0: 'label' => t('Search index'), Chris@0: 'custom settings' => FALSE, Chris@0: ), Chris@0: 'search_result' => array( Chris@0: 'label' => t('Search result highlighting input'), Chris@0: 'custom settings' => FALSE, Chris@0: ), Chris@0: ); Chris@0: } Chris@0: Chris@0: // Bundles must provide a human readable name so we can create help and error Chris@0: // messages, and the path to attach Field admin pages to. Chris@0: foreach (node_type_get_names() as $type => $name) { Chris@0: $return['node']['bundles'][$type] = array( Chris@0: 'label' => $name, Chris@0: 'admin' => array( Chris@0: 'path' => 'admin/structure/types/manage/%node_type', Chris@0: 'real path' => 'admin/structure/types/manage/' . str_replace('_', '-', $type), Chris@0: 'bundle argument' => 4, Chris@0: 'access arguments' => array('administer content types'), Chris@0: ), Chris@0: ); Chris@0: } Chris@0: Chris@0: return $return; Chris@0: }