function _biblio_get_auth_types in Bibliography Module 6.2
Same name and namespace in other branches
- 6 biblio.module \_biblio_get_auth_types()
- 7 biblio.module \_biblio_get_auth_types()
- 7.2 biblio.module \_biblio_get_auth_types()
Retrieves author types based upon author category and biblio type.
Parameters
?? $auth_category: The category of author.
string $biblio_type: A string representing the type of biblio item.
Return value
array|null An associative array keyed by author category and biblio type. NULL is returned if no matches could be found.
4 calls to _biblio_get_auth_types()
- biblio_admin_types_edit_form in includes/
biblio.admin.inc - biblio_contributors_js in ./
biblio.module - Prepares a JSON response for the contributor widget.
- _biblio_contributor_widget in ./
biblio.module - Defines a contributor widget to be used as part of biblio node form.
- _biblio_get_auth_type in ./
biblio.module - Retrieves primary author type based on author category and biblio type.
File
- ./
biblio.module, line 39 - Main file for Drupal module biblio.
Code
function _biblio_get_auth_types($auth_category, $biblio_type) {
static $auth_types = array();
if (empty($auth_types)) {
$db_res = db_query("SELECT * FROM {biblio_contributor_type}");
while ($row = db_fetch_object($db_res)) {
$auth_types[$row->auth_category][$row->biblio_type][] = $row->auth_type;
}
}
$result = isset($auth_types[$auth_category][$biblio_type]) ? $auth_types[$auth_category][$biblio_type] : NULL;
// Fall back to defaults if no author types are defined for this biblio_type.
if (empty($result)) {
$result = $auth_types[$auth_category][0];
}
return $result;
}