Revision dd1c109a
Added by Andreas Kohlbecker over 9 years ago
7.x/modules/palmweb/palmweb.module | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
|
20 | 20 |
|
21 |
/** |
|
22 |
* Implements hook_cdm_feature_node_toc_items_alter() |
|
23 |
*/ |
|
24 |
function palmweb_cdm_feature_node_toc_items_alter($items){ |
|
25 |
|
|
26 |
$http_request_params = drupal_get_query_parameters(); |
|
27 |
$countFeatures = count($items); |
|
28 |
|
|
29 |
// number of taxa |
|
30 |
$numberOfChildren = count(cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_CHILDNODES_OF_TAXON, array ( |
|
31 |
get_taxonomictree_uuid_selected(), |
|
32 |
substr(strrchr($_GET["q"],'/'), 1), |
|
33 |
))); |
|
34 |
if ($numberOfChildren != 0) { |
|
35 |
array_unshift($items, |
|
36 |
l( |
|
37 |
t(theme('cdm_feature_name', array('feature_name' => 'Number of Taxa'))), |
|
38 |
$_GET['q'], |
|
39 |
array( |
|
40 |
'query' => $http_request_params, |
|
41 |
'attributes' => array('class' => array('toc')), |
|
42 |
'fragment' => generalizeString('Number Of Taxa'), |
|
43 |
) |
|
44 |
) |
|
45 |
); |
|
46 |
} |
|
21 |
/** |
|
22 |
* Implements hook_cdm_feature_node_toc_items_alter() |
|
23 |
* |
|
24 |
* FIXME hook_cdm_feature_node_toc_items_alter() no longer exists, use cdm_toc_list_add_item() instead |
|
25 |
*/ |
|
26 |
function palmweb_cdm_feature_node_toc_items_alter($items){ |
|
47 | 27 |
|
48 |
// Setting the Anchor to the Bibliography section if the option is enabled.
|
|
49 |
$show_bibliography = variable_get('cdm_show_bibliography', 1);
|
|
28 |
$http_request_params = drupal_get_query_parameters();
|
|
29 |
$countFeatures = count($items);
|
|
50 | 30 |
|
51 |
$markerTypes['markerTypes'] = UUID_MARKERTYPE_USE; |
|
52 |
$useDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, substr(strrchr($_GET["q"], '/'), 1), queryString($markerTypes)); |
|
53 |
if (!empty($useDescriptions)) { |
|
54 |
$items[] = l( |
|
55 |
t(theme('cdm_feature_name', array('feature_name' => 'Uses'))), |
|
31 |
// number of taxa |
|
32 |
$numberOfChildren = count(cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_CHILDNODES_OF_TAXON, array ( |
|
33 |
get_taxonomictree_uuid_selected(), |
|
34 |
substr(strrchr($_GET["q"],'/'), 1), |
|
35 |
))); |
|
36 |
if ($numberOfChildren != 0) { |
|
37 |
array_unshift($items, |
|
38 |
l( |
|
39 |
t(theme('cdm_feature_name', array('feature_name' => 'Number of Taxa'))), |
|
56 | 40 |
$_GET['q'], |
57 | 41 |
array( |
58 |
'query' => $http_request_params,
|
|
59 |
'attributes' => array('class' => array('toc')),
|
|
60 |
'fragment' => 'userecords'
|
|
42 |
'query' => $http_request_params, |
|
43 |
'attributes' => array('class' => array('toc')), |
|
44 |
'fragment' => generalizeString('Number Of Taxa'),
|
|
61 | 45 |
) |
62 |
); |
|
63 |
} |
|
46 |
) |
|
47 |
); |
|
48 |
} |
|
64 | 49 |
|
65 |
if ($show_bibliography && $countFeatures != 0) { |
|
66 |
$items[] = l( |
|
67 |
t(theme('cdm_feature_name', array('feature_name' => 'Bibliography'))), |
|
68 |
$_GET['q'], |
|
69 |
array( |
|
70 |
'query' => $http_request_params, |
|
71 |
'attributes' => array('class' => array('toc')), |
|
72 |
'fragment' => 'bibliography' |
|
50 |
// Setting the Anchor to the Bibliography section if the option is enabled. |
|
51 |
$show_bibliography = variable_get('cdm_show_bibliography', 1); |
|
52 |
|
|
53 |
$markerTypes['markerTypes'] = UUID_MARKERTYPE_USE; |
|
54 |
$useDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, substr(strrchr($_GET["q"], '/'), 1), queryString($markerTypes)); |
|
55 |
if (!empty($useDescriptions)) { |
|
56 |
$items[] = l( |
|
57 |
t(theme('cdm_feature_name', array('feature_name' => 'Uses'))), |
|
58 |
$_GET['q'], |
|
59 |
array( |
|
60 |
'query' => $http_request_params, |
|
61 |
'attributes' => array('class' => array('toc')), |
|
62 |
'fragment' => 'userecords' |
|
73 | 63 |
) |
74 | 64 |
); |
75 |
} |
|
76 |
return $items; |
|
77 |
} |
|
65 |
} |
|
66 |
|
|
67 |
if ($show_bibliography && $countFeatures != 0) { |
|
68 |
$items[] = l( |
|
69 |
t(theme('cdm_feature_name', array('feature_name' => 'Bibliography'))), |
|
70 |
$_GET['q'], |
|
71 |
array( |
|
72 |
'query' => $http_request_params, |
|
73 |
'attributes' => array('class' => array('toc')), |
|
74 |
'fragment' => 'bibliography' |
|
75 |
) |
|
76 |
); |
|
77 |
} |
|
78 |
return $items; |
|
79 |
} |
Also available in: Unified diff
more flexible table of content creation, hook_cdm_feature_node_toc_items_alter() no longer needed