function fb_autopost_entity_entity_info in Facebook Autopost 7
Implements hook_entity_info().
File
- fb_autopost_entity/
fb_autopost_entity.module, line 50 - Module implementation file
Code
function fb_autopost_entity_entity_info() {
$return = array(
'facebook_publication' => array(
'label' => t('Facebook publication'),
'plural label' => t('Facebook publications'),
'description' => t('Facebook publications to be displayed in the configured Facebook page(s).'),
'entity class' => 'FacebookPublicationEntity',
'controller class' => 'EntityAPIController',
'base table' => 'facebook_publication',
'fieldable' => TRUE,
'view modes' => array(
'full' => array(
'label' => t('Full view'),
'custom settings' => FALSE,
),
),
'entity keys' => array(
'id' => 'fbpid',
'bundle' => 'type',
'label' => 'label',
),
'bundles' => array(),
'bundle keys' => array(
'bundle' => 'type',
),
'uri callback' => 'entity_class_uri',
'access callback' => 'facebook_publication_access',
'module' => 'fb_autopost_entity',
'metadata controller class' => 'FacebookPublicationMetadataController',
),
);
// Add bundle info but bypass entity_load() as we cannot use it here.
$types = db_select('facebook_publication_type', 'p')
->fields('p')
->execute()
->fetchAllAssoc('type');
foreach ($types as $type => $info) {
$return['facebook_publication']['bundles'][$type] = array(
'label' => $info->label,
'admin' => array(
'path' => 'admin/structure/facebook-publications/manage/%facebook_publication_type',
'real path' => 'admin/structure/facebook-publications/manage/' . $type,
'bundle argument' => 4,
'access arguments' => array(
'administer facebook publications',
),
),
);
}
// Support entity cache module.
if (module_exists('entitycache')) {
$return['facebook_publication']['field cache'] = FALSE;
$return['facebook_publication']['entity cache'] = TRUE;
}
$return['facebook_publication_type'] = array(
'label' => t('Facebook publication type'),
'plural label' => t('Facebook publication types'),
'description' => t('Facebook publication types of Graph API.'),
'entity class' => 'FacebookPublicationTypeEntity',
'controller class' => 'EntityAPIControllerExportable',
'base table' => 'facebook_publication_type',
'fieldable' => FALSE,
'bundle of' => 'facebook_publication',
'exportable' => TRUE,
'entity keys' => array(
'id' => 'id',
'name' => 'type',
'label' => 'label',
),
'access callback' => 'facebook_publication_type_access',
'module' => 'fb_autopost_entity',
// Enable the entity API's admin UI.
'admin ui' => array(
'path' => 'admin/structure/facebook-publications',
'file' => 'fb_autopost_entity.admin.inc',
'controller class' => 'FacebookPublicationTypeUIController',
),
);
return $return;
}