annotate vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_info.twig @ 0:c75dbcec494b

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