You are here

function ad_entity_info in Advertisement 7.2

Implements hook_entity_info().

File

./ad.module, line 13
Defines the core ad entity, including the entity itself, the bundle definitions (ad types), and various API functions to manage ads and interact with them through forms and autocompletes.

Code

function ad_entity_info() {
  $return = array(
    'advertisement' => array(
      'label' => t('Advertisement'),
      'controller class' => 'AdvertisementEntityController',
      'base table' => 'ad',
      'fieldable' => TRUE,
      'object keys' => array(
        'id' => 'aid',
        'bundle' => 'type',
      ),
      'bundle keys' => array(
        'bundle' => 'type',
      ),
      'bundles' => array(),
      'load hook' => 'ad_load',
      'view modes' => array(
        'full' => array(
          'label' => t('Full'),
        ),
        'display' => array(
          'label' => t('Display'),
        ),
      ),
      'creation callback' => '_ad_create',
      'save callback' => 'ad_save',
      'deletion callback' => 'ad_delete',
      'access callback' => 'ad_access',
    ),
  );
  foreach (ad_type_get_name() as $type => $name) {
    $return['ad']['bundles'][$type] = array(
      'label' => $name,
    );
  }
  return $return;
}