You are here

function content_taxonomy_form_alter in Content Taxonomy 5

Same name and namespace in other branches
  1. 6.2 content_taxonomy.module \content_taxonomy_form_alter()
  2. 6 content_taxonomy.module \content_taxonomy_form_alter()

Implementation of hook_form_alter

hides the taxonomy form if there exists content taxonomy fields

File

./content_taxonomy.module, line 239
Defines a field type for referencing a taxonomy term.

Code

function content_taxonomy_form_alter($form_id, &$form) {
  if (isset($form['type']) && $form['type']['#value'] . '_node_form' == $form_id) {
    $info = _content_type_info();
    $content_type = $info['content types'][$form['type']['#value']];
    foreach ($content_type['fields'] as $field_name => $field) {
      if ($field['type'] == 'content_taxonomy') {
        unset($form['taxonomy']);
        break;
      }
    }
  }
}