Commit 5a0d2b80 authored by Cody Craven's avatar Cody Craven
Browse files

Issue #1237136 by codycraven: Expose term object on term page to altering.

parent 57c92953
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Taxonomy Display 7.x-1.x, YYYY-MM-DD Taxonomy Display 7.x-1.x, YYYY-MM-DD
------------------------------------ ------------------------------------
Issue #1237136 by codycraven: Expose term object on term page to altering.
Issue #1230200 by R.Muilwijk: Fixed exported views not recognized. Issue #1230200 by R.Muilwijk: Fixed exported views not recognized.
Issue #1231346 by codycraven: Remove the ability to select whether taxonomy Issue #1231346 by codycraven: Remove the ability to select whether taxonomy
term's fields should be displayed even if the description field is empty, now term's fields should be displayed even if the description field is empty, now
......
...@@ -98,6 +98,27 @@ function hook_taxonomy_display_save_fields_alter(&$save_data) { ...@@ -98,6 +98,27 @@ function hook_taxonomy_display_save_fields_alter(&$save_data) {
} }
} }
/**
* Alter a term object before display on its term page.
*
* @return void
*
* @see taxonomy_display_taxonomy_term_page()
*/
function hook_taxonomy_display_term_page_term_object_alter(&$term) {
// Manipulate or act upon term object.
if ($term->vocabulary_machine_name == 'example') {
if (empty($term->field_longtext['und'][0]['safe_value'])) {
$term->field_longtext['und'][0]['value'] = t('Not provided');
$term->field_longtext['und'][0]['safe_value'] = t('Not provided');
}
$term->name = t('Example: @name', array('@name' => $term->name));
drupal_add_js(array('taxonomy_display' => array('mykey' => 'myvalue')), 'setting');
}
}
/** /**
* @} End of "addtogroup hooks". * @} End of "addtogroup hooks".
*/ */
...@@ -322,6 +322,9 @@ function taxonomy_display_save_taxonomy_display($machine_name, $save_data = arra ...@@ -322,6 +322,9 @@ function taxonomy_display_save_taxonomy_display($machine_name, $save_data = arra
* The page content. * The page content.
*/ */
function taxonomy_display_taxonomy_term_page($term) { function taxonomy_display_taxonomy_term_page($term) {
// Expose our $term object to altering.
drupal_alter('taxonomy_display_term_page_term_object', $term);
// Load settings for this vocabulary term. // Load settings for this vocabulary term.
$display_settings = taxonomy_display_fetch_taxonomy_display($term->vocabulary_machine_name); $display_settings = taxonomy_display_fetch_taxonomy_display($term->vocabulary_machine_name);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment