You are here

function tvi_form_alter in Taxonomy Views Integrator 7

Same name and namespace in other branches
  1. 6 tvi.module \tvi_form_alter()

Implements hook_form_alter().

Used to add some items to the taxonomy term and vocab edit pages

File

./tvi.module, line 121
Allow to define views to be used instead of default drupal behavior on taxonomy terms pages.

Code

function tvi_form_alter(&$form, $form_state, $form_id) {
  $forms = array(
    'taxonomy_form_term',
    'taxonomy_form_vocabulary',
  );
  if (in_array($form_id, $forms) && !isset($form_state['confirm_delete']) && !isset($form_state['confirm_parents'])) {
    tvi_include('admin');
    if ($form_id == 'taxonomy_form_term' && user_access('define view for terms in ' . $form['#vocabulary']->machine_name)) {
      tvi_term_form($form);
    }
    elseif (user_access('define view for vocabulary ' . $form['#vocabulary']->machine_name)) {
      tvi_vocab_form($form);
    }
  }
}