|
@@ -553,7 +553,7 @@ function tripal_core_views_api() {
|
|
|
function tripal_core_node_view_alter(&$build) {
|
|
|
global $theme;
|
|
|
|
|
|
- //dpm($build);
|
|
|
+ dpm($build);
|
|
|
|
|
|
// if the $build['tripal_toc'] element is not present, then this is not
|
|
|
// a full node view so we do not want to alter
|
|
@@ -580,33 +580,7 @@ function tripal_core_node_view_alter(&$build) {
|
|
|
// contents to the page. Skip the table of contents and links as those
|
|
|
// will be placed elsewhere
|
|
|
if (!preg_match('/^#/', $key) and $key != 'tripal_toc' and $key != 'links') {
|
|
|
- $markup = '';
|
|
|
-
|
|
|
- // find the markup. Some fields will have a '#markup' and others, such
|
|
|
- // as CCK elements may have a set of '#markup' elements organized by
|
|
|
- // numerical keys.
|
|
|
- if (array_key_exists('#markup', $build[$key]) and trim($build[$key]['#markup'])) {
|
|
|
- $markup = $build[$key]['#markup'];
|
|
|
- }
|
|
|
- // For backwards copmatibility we should support the '#value' element as well.
|
|
|
- elseif (array_key_exists('#value', $build[$key]) and trim($build[$key]['#value'])) {
|
|
|
- $markup = $build[$key]['#markup'];
|
|
|
- }
|
|
|
-
|
|
|
- // if we have no '#markup' field then this element has not yet
|
|
|
- // been rendered. Let's render it and substitute that for markup
|
|
|
- if (!$markup) {
|
|
|
- $markup = trim(render($build[$key]));
|
|
|
- $build[$key] = array(
|
|
|
- '#markup' => $markup,
|
|
|
- );
|
|
|
- }
|
|
|
|
|
|
- // if we still don't have markup then skip this one
|
|
|
- if (!$markup) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
// intialize the item title, key and id
|
|
|
$toc_item_title = $key;
|
|
|
$toc_item_id = $key;
|
|
@@ -618,7 +592,7 @@ function tripal_core_node_view_alter(&$build) {
|
|
|
if (array_key_exists($key, $cache->data) and array_key_exists('path', $cache->data[$key])) {
|
|
|
|
|
|
$path = $cache->data[$key]['path'] . '/' . $key . '.tpl.php';
|
|
|
-
|
|
|
+
|
|
|
$path = theme('tripal_admin_message', array('message' => "Administrators, you can
|
|
|
customize the way the content above is presented. Tripal provides a template
|
|
|
file for each block of content. To customize, copy the template file to your
|
|
@@ -627,25 +601,59 @@ function tripal_core_node_view_alter(&$build) {
|
|
|
Currently, the content above is provided by this template: <br><br>$path")
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// BUILD THE TOC LINKS
|
|
|
// get the title for the table of contents. Tripal templates should
|
|
|
// have a '#tripal_toc_title' element in the build array
|
|
|
if (array_key_exists('#tripal_toc_title', $build[$key])) {
|
|
|
$toc_item_title = $build[$key]['#tripal_toc_title'];
|
|
|
}
|
|
|
+ // other elements in the $build array may just have a '#title' element,
|
|
|
+ if (array_key_exists('#title', $build[$key])) {
|
|
|
+ $toc_item_title = $build[$key]['#title'];
|
|
|
+ }
|
|
|
+ $toc_item_title = ucwords($toc_item_title);
|
|
|
+
|
|
|
if (array_key_exists('#tripal_toc_id', $build[$key])) {
|
|
|
$toc_item_id = $build[$key]['#tripal_toc_id'];
|
|
|
}
|
|
|
$toc_item_link = "<div class=\"tripal_toc_list_item\"><a id=\"$toc_item_id\" class=\"tripal_toc_list_item_link\" href=\"?block=$toc_item_id\">$toc_item_title</a></div>";
|
|
|
|
|
|
- // next check the database. If the title has been overridden then
|
|
|
+ // next check the database. If the title has been overridden then
|
|
|
// we want to use that value
|
|
|
$weight = 10;
|
|
|
if (array_key_exists('#weight', $build[$key])) {
|
|
|
$weight = $build[$key]['#weight'];
|
|
|
}
|
|
|
$toc[$weight][] = $toc_item_link;
|
|
|
+
|
|
|
+ $markup = '';
|
|
|
+
|
|
|
+ // find the markup. Some fields will have a '#markup' and others, such
|
|
|
+ // as CCK elements may have a set of '#markup' elements organized by
|
|
|
+ // numerical keys.
|
|
|
+ if (array_key_exists('#markup', $build[$key]) and trim($build[$key]['#markup'])) {
|
|
|
+ $markup = $build[$key]['#markup'];
|
|
|
+ }
|
|
|
+ // For backwards copmatibility we should support the '#value' element as well.
|
|
|
+ elseif (array_key_exists('#value', $build[$key]) and trim($build[$key]['#value'])) {
|
|
|
+ $markup = $build[$key]['#markup'];
|
|
|
+ }
|
|
|
+
|
|
|
+ // if we have no '#markup' field then this element has not yet
|
|
|
+ // been rendered. Let's render it and substitute that for markup
|
|
|
+ if (!$markup) {
|
|
|
+ $markup = trim(render($build[$key]));
|
|
|
+ $build[$key] = array(
|
|
|
+ '#markup' => $markup,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // if we still don't have markup then skip this one
|
|
|
+ if (!$markup) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// CREATE THE DATA BLOCK
|
|
|
// add a surrounding <div> box around the content
|