function taxonomy_manager_form_term_data in Taxonomy Manager 5
Same name and namespace in other branches
- 6.2 taxonomy_manager.admin.inc \taxonomy_manager_form_term_data()
- 6 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.module - defines forms for taxonomy manager interface
- taxonomy_manager_update_term_data_form in ./
taxonomy_manager.module - menu callback for displaying term data form
File
- ./
taxonomy_manager.module, line 683 - Taxonomy Manager
Code
function taxonomy_manager_form_term_data($tid) {
$term = taxonomy_get_term($tid);
$module_path = drupal_get_path('module', 'taxonomy_manager') . '/';
$vocabulary = taxonomy_get_vocabulary($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']['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#default_value' => $term->name,
'#size' => 35,
'#maxlength' => 255,
'#required' => TRUE,
'#weight' => -20,
'#prefix' => '<div id="term-data-name-field">',
'#suffix' => '</div>',
);
$form['term_data']['save_name'] = array(
'#value' => theme("image", $module_path . "images/document-save.png", "save", NULL),
'#prefix' => '<div id="term-data-name-save">',
'#suffix' => '</div><div class="clear"></div>',
);
$form['term_data']['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#default_value' => $term->description,
'#cols' => 35,
'#rows' => 4,
'#prefix' => '<div id="term-data-description"><div id="term-data-description-field">',
'#suffix' => '</div>',
);
$form['term_data']['save_description'] = array(
'#value' => theme("image", $module_path . "images/document-save.png", "save", NULL),
'#prefix' => '<div id="term-data-description-save">',
'#suffix' => '</div></div><div class="clear"></div>',
);
$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;
if ($vocabulary->relations) {
$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;
}
if ($vocabulary->hierarchy) {
$parents = taxonomy_get_parents($term->tid);
$p_add = TRUE;
if (count($parents) >= 1 && $vocabulary->hierarchy == 1) {
$p_add = FALSE;
}
$form['term_data']['parents'] = _taxonomy_manager_form_term_data_lists($term, $parents, t('Parents'), 'parent', TRUE, $p_add);
$form['term_data']['parents']['#tree'] = TRUE;
}
$form['term_data']['weight'] = array(
'#type' => 'weight',
'#default_value' => $term->weight,
'#delta' => 40,
'#prefix' => '<div id="term-data-weight">',
'#suffix' => '</div>',
'#title' => t('Weight'),
);
$form['term_data']['link'] = array(
'#value' => '<br />' . l(t('Go to the term page site'), taxonomy_term_path($term), array(
'rel' => 'tag',
'title' => $term->description,
'target' => '_blank',
)),
);
return $form;
}