You are here

function hook_taxonomy_display_term_page_term_object_alter in Taxonomy display 7

Alter a term object before display on its term page.

Return value

void

See also

taxonomy_display_taxonomy_term_page()

1 invocation of hook_taxonomy_display_term_page_term_object_alter()
taxonomy_display_taxonomy_term_page in ./taxonomy_display.module
Page callback; displays all nodes associated with a term.

File

./taxonomy_display.api.php, line 129
Hooks provided by the taxonomy_display module.

Code

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');
  }
}