ffa0ca1335f0172d64cfbbbcc55c8f2fca983c11
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / entity_info.twig
1 /**
2  * Implements hook_entity_info().
3  */
4 function {{ machine_name }}_entity_info() {
5   $return = array(
6     'node' => array(
7       'label' => t('Node'),
8       'controller class' => 'NodeController',
9       'base table' => 'node',
10       'revision table' => 'node_revision',
11       'uri callback' => 'node_uri',
12       'fieldable' => TRUE,
13       'translation' => array(
14         'locale' => TRUE,
15       ),
16       'entity keys' => array(
17         'id' => 'nid',
18         'revision' => 'vid',
19         'bundle' => 'type',
20         'language' => 'language',
21       ),
22       'bundle keys' => array(
23         'bundle' => 'type',
24       ),
25       'bundles' => array(),
26       'view modes' => array(
27         'full' => array(
28           'label' => t('Full content'),
29           'custom settings' => FALSE,
30         ),
31         'teaser' => array(
32           'label' => t('Teaser'),
33           'custom settings' => TRUE,
34         ),
35         'rss' => array(
36           'label' => t('RSS'),
37           'custom settings' => FALSE,
38         ),
39       ),
40     ),
41   );
42
43   // Search integration is provided by node.module, so search-related
44   // view modes for nodes are defined here and not in search.module.
45   if (module_exists('search')) {
46     $return['node']['view modes'] += array(
47       'search_index' => array(
48         'label' => t('Search index'),
49         'custom settings' => FALSE,
50       ),
51       'search_result' => array(
52         'label' => t('Search result highlighting input'),
53         'custom settings' => FALSE,
54       ),
55     );
56   }
57
58   // Bundles must provide a human readable name so we can create help and error
59   // messages, and the path to attach Field admin pages to.
60   foreach (node_type_get_names() as $type => $name) {
61     $return['node']['bundles'][$type] = array(
62       'label' => $name,
63       'admin' => array(
64         'path' => 'admin/structure/types/manage/%node_type',
65         'real path' => 'admin/structure/types/manage/' . str_replace('_', '-', $type),
66         'bundle argument' => 4,
67         'access arguments' => array('administer content types'),
68       ),
69     );
70   }
71
72   return $return;
73 }