function taxonomy_manager_form_term_data in Taxonomy Manager 6
Same name and namespace in other branches
- 5 taxonomy_manager.module \taxonomy_manager_form_term_data()
- 6.2 taxonomy_manager.admin.inc \taxonomy_manager_form_term_data()
term data editing form
Parameters
$tid:
2 calls to taxonomy_manager_form_term_data()
- taxonomy_manager_form in ./
taxonomy_manager.admin.inc - defines forms for taxonomy manager interface
- taxonomy_manager_update_term_data_form in ./
taxonomy_manager.admin.inc - menu callback for displaying term data form
File
- ./
taxonomy_manager.admin.inc, line 624
Code
function taxonomy_manager_form_term_data($tid) {
$term = taxonomy_get_term($tid);
$module_path = drupal_get_path('module', 'taxonomy_manager') . '/';
$vocabulary = taxonomy_vocabulary_load($term->vid);
//prevent that title of the fieldset is too long
$title = check_plain($term->name);
if (strlen($title) >= 33) {
$title = substr($title, 0, 33) . "...";
}
$title .= " (" . $term->tid . ")";
$form['term_data'] = array(
'#type' => 'fieldset',
'#title' => $title,
'#attributes' => array(
'id' => 'taxonomy-term-data-fieldset',
),
'#tree' => TRUE,
);
$form['term_data']['tid'] = array(
'#type' => 'hidden',
'#value' => $tid,
);
$form['term_data']['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#default_value' => $term->name,
'#size' => 35,
'#maxlength' => 255,
'#required' => TRUE,
'#weight' => -20,
);
$form['term_data']['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#default_value' => $term->description,
'#cols' => 35,
'#rows' => 4,
);
$form['term_data']['synonyms'] = _taxonomy_manager_form_term_data_lists($term, taxonomy_get_synonyms($term->tid), t('Synonyms'), 'synonym', FALSE);
$form['term_data']['synonyms']['#tree'] = TRUE;
$form['term_data']['synonyms']['#weight'] = '50';
$form['term_data']['relations'] = _taxonomy_manager_form_term_data_lists($term, taxonomy_get_related($term->tid), t('Relations'), 'related');
$form['term_data']['relations']['#tree'] = TRUE;
$form['term_data']['relations']['#weight'] = '51';
$parents = taxonomy_get_parents($term->tid);
$p_add = TRUE;
$form['term_data']['parents'] = _taxonomy_manager_form_term_data_lists($term, $parents, t('Parents'), 'parent', TRUE);
$form['term_data']['parents']['#tree'] = TRUE;
$form['term_data']['parents']['#weight'] = '52';
$form['term_data']['weight'] = array(
'#type' => 'weight',
'#default_value' => $term->weight,
'#delta' => 40,
'#prefix' => '<div id="term-data-weight">',
'#suffix' => '</div>',
'#title' => t('Weight'),
);
$link_img = theme("image", $module_path . "images/link-small.png", "link to term page");
$form['term_data']['link'] = array(
'#value' => '<br />' . l($link_img . ' ' . t('Go to the term page site'), taxonomy_term_path($term), array(
'attributes' => array(
'rel' => 'tag',
'title' => strip_tags($term->description),
'target' => '_blank',
),
'html' => TRUE,
)),
'#weight' => '53',
);
$form['term_data']['vid'] = array(
'#type' => 'value',
'#value' => $term->vid,
);
return $form;
}