You are here

function location_entity_info in Location 7.4

Implement hook_entity_info().

File

./location.module, line 1842
Location module main routines. An implementation of a universal API for location manipulation. Provides functions for postal_code proximity searching, deep-linking into online mapping services. Currently, some options are configured through an…

Code

function location_entity_info() {
  $return = array(
    'location' => array(
      'label' => t('Location'),
      //      'controller class' => 'NodeController',
      'base table' => 'location_locations',
      'revision table' => 'location_location_revisions',
      // @@@ Needed?
      'path callback' => 'location_path',
      'fieldable' => TRUE,
      'object keys' => array(
        'id' => 'lid',
        'revision' => 'lvid',
        'bundle' => 'bundle',
      ),
      'bundle keys' => array(
        'bundle' => 'bundle',
      ),
      // Node.module handles its own caching.
      // 'cacheable' => FALSE,
      'bundles' => array(),
      'view modes' => array(
        'standalone' => array(
          'label' => t('Standalone page'),
        ),
        /*        'teaser' => array(
                  'label' => t('Teaser'),
                ),*/
        'rss' => array(
          'label' => t('RSS'),
        ),
      ),
    ),
  );

  /*
    // 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')) {
   $return['node']['view modes'] += array(
     'search_index' => array(
       'label' => t('Search index'),
     ),
     'search_result' => array(
       'label' => t('Search result'),
     ),
   );
    }

    // Bundles must provide a human readable name so we can create help and error
    // messages, and the path to attach Field admin pages to.
    foreach (node_type_get_names() as $type => $name) {
   $return['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'),
     ),
   );
    }
  */
  $result = db_query('SELECT * FROM {location_bundles}');
  foreach ($result as $bundle) {
    $return['location']['bundles'][$bundle->bundle] = array(
      'label' => $bundle->name,
      'admin' => array(
        'path' => 'admin/config/location/bundle/%location_bundle',
        'real path' => 'admin/config/location/bundle/' . str_replace('_', '-', $bundle->bundle),
        'bundle argument' => 4,
        'access arguments' => array(
          'administer content types',
        ),
      ),
    );
  }
  return $return;
}