function node_gallery_api_entity_info in Node Gallery 7
Implements hook_entity_info().
File
- ./
node_gallery_api.module, line 971 - Node Gallery module.
Code
function node_gallery_api_entity_info() {
$items['node_gallery_relationship_type'] = array(
'label' => t('Node Gallery Relationship Type'),
'controller class' => 'EntityAPIControllerExportable',
'entity class' => 'NodeGalleryRelationshipType',
'base table' => 'node_gallery_relationship_type',
'fieldable' => TRUE,
'entity keys' => array(
'id' => 'id',
'label' => 'label',
),
// 'exportable' => TRUE,
// 'export' => array(
// 'default hook' => 'default_node_gallery_relationship_type',
// ),
'bundle of' => 'node_gallery_relationship',
'module' => 'node_gallery_api',
'metadata controller class' => 'NodeGalleryRelationshipTypeMetadataController',
'views controller class' => 'NodeGalleryRelationshipTypeViewsController',
);
$items['node_gallery_relationship'] = array(
'label' => t('Node Gallery Relationship'),
'entity class' => 'NodeGalleryRelationship',
'controller class' => 'EntityAPIController',
'base table' => 'node_gallery_relationship',
'fieldable' => TRUE,
'entity keys' => array(
'id' => 'id',
// The message has no label.
'label' => FALSE,
'bundle' => 'relationship_type',
),
// 'label callback' => 'node_gallery_relationship_label',
'bundles' => array(),
'bundle keys' => array(
'bundle' => 'id',
),
'module' => 'node_gallery_api',
'views controller class' => 'NodeGalleryRelationshipViewsController',
'metadata controller class' => 'NodeGalleryRelationshipMetadataController',
);
// Add bundle info but bypass entity_load() as we cannot use it here.
if (db_table_exists('node_gallery_relationship_type')) {
$relationships = db_select('node_gallery_relationship_type', 'ng')
->fields('ng')
->execute()
->fetchAllAssoc('id');
foreach ($relationships as $type_name => $type) {
$items['node_gallery_relationship']['bundles'][$type_name] = array(
'label' => $type->label,
'admin' => array(
'path' => 'admin/config/content/node-gallery/relationship-type/settings/%node_gallery_api_relationship_type',
'real path' => 'admin/config/content/node-gallery/relationship-type/settings/' . $type->id,
'bundle argument' => 5,
'access arguments' => array(
'administer node gallery',
),
),
);
}
}
return $items;
}