You are here

function taxonomy_breadcrumb_form_alter in Taxonomy Breadcrumb 5

Implementation of hook_form_alter(). This must be used over hook_taxonomy to add the Breadcrumb Path fields to the vocabulary and term forms. The hook_taxonomy function does not provide a way to obtain the vid or tid of the vocabulary or term.

File

./taxonomy_breadcrumb.module, line 294
The taxonomy_breadcrumb module generates taxonomy based breadcrumbs on node pages and taxonomy/term pages. The breadcrumb trail takes on the form: [HOME] >> [VOCABULARY] >> TERM >> [TERM] ...

Code

function taxonomy_breadcrumb_form_alter($form_id, &$form) {
  if ($form_id == 'taxonomy_form_vocabulary') {
    $form['taxonomy_breadcrumb_path'] = array(
      '#type' => 'textfield',
      '#title' => t('Breadcrumb path (taxonomy_breadcrumb)'),
      '#default_value' => taxonomy_breadcrumb_get_vocabulary_path($form['vid']['#value']),
      '#maxlength' => 128,
      '#description' => t('Specify the path this vocabulary links to as a breadcrumb.  If blank, the breadcrumb will not appear.  Use a relative path and don\'t add a trailing slash.  For example: node/42 or my/path/alias.'),
      '#weight' => 0,
    );
  }
  elseif ($form_id == 'taxonomy_form_term') {
    $form['taxonomy_breadcrumb_path'] = array(
      '#type' => 'textfield',
      '#title' => t('Breadcrumb path (taxonomy_breadcrumb)'),
      '#default_value' => taxonomy_breadcrumb_get_term_path($form['tid']['#value']),
      '#maxlength' => 128,
      '#description' => t('Specify the path this term links to as a breadcrumb.  If blank, the breadcrumb links to the default taxonomy page.  Use a relative path and don\'t add a trailing slash.  For example: node/42 or my/path/alias.'),
      '#weight' => 0,
    );
  }
}