function biblio_types in Bibliography Module 7.2
Same name and namespace in other branches
- 7.3 biblio.module \biblio_types()
Gets all publication types that are set up by default.
Return value
type
10 calls to biblio_types()
- biblio_admin_type_mapper_form in includes/
biblio.admin.inc - biblio_combined_bundle_load in ./
biblio.module - Get an individual publication type definition object. Necessary for the %biblio_bundle menu placeholder to work in hook_menu().
- biblio_delete_confirm_submit in ./
biblio.module - Delete form confirmation page
- biblio_entity_info in ./
biblio.module - Implements hook_entity_info().
- biblio_form in ./
biblio.module - Displays the Add/Edit form for a biblio entity
File
- ./
biblio.module, line 2676
Code
function biblio_types($entity_type = FALSE) {
$query = db_select('biblio_types', 'bt')
->fields('bt', array(
'name',
'description',
'entity',
));
if ($entity_type) {
$query
->condition('entity', $entity_type);
}
$result = $query
->execute();
$entity_type_passed_in = $entity_type;
while ($row = $result
->fetchAssoc()) {
if ($entity_type_passed_in === FALSE) {
$entity_type = $row['entity'];
}
$bundle_name = biblio_bundle_name($entity_type);
// computer-friendly version of the human-readable content type stored in the database
$machine_name = str_replace(' ', '_', strtolower($row['name']));
$types[$machine_name] = (object) array(
// type is the machine name of the bundle
$bundle_name => $machine_name,
'entity' => $row['entity'],
// name is the human name of the bundle
'name' => t($row['name']),
'description' => t($row['description']),
);
}
return $types;
}