You are here

function taxonomy_patterns_params in Patterns 7.2

Same name and namespace in other branches
  1. 7 patterns_components/components/taxonomy.inc \taxonomy_patterns_params()

File

patterns_components/components/taxonomy.inc, line 306
Patterns component for taxonomy vocabularies and terms.

Code

function taxonomy_patterns_params($action, $form_id, &$data = NULL, &$a) {
  if ($form_id == 'taxonomy_form_vocabulary') {
    if ($data['vid']) {
      $result = taxonomy_vocabulary_load($data['vid']);
    }
  }
  elseif ($form_id == 'taxonomy_vocabulary_confirm_delete') {
    if ($data['vid']) {
      $result = $data['vid'];
    }
    elseif (!isset($data['machine_name'])) {
      $taxo = taxonomy_vocabulary_machine_name_load($data['machine_name']);
      $vid = $taxo->vid;
      if (!empty($vid)) {
        taxonomy_vocabulary_load($data['vid']);
      }
    }
  }
  elseif ($form_id == 'taxonomy_form_term') {
    $vocab = taxonomy_vocabulary_load($data['vid']);
    $result = array(
      $data,
      $vocab,
    );
  }
  elseif ($form_id == 'taxonomy_term_confirm_delete') {
    $result = $data['tid'];
  }
  return patterns_results(PATTERNS_SUCCESS, t('Execution successful'), $result);
}