function taxonomy_manager_term_data_form in Taxonomy Manager 7
1 call to taxonomy_manager_term_data_form()
- taxonomy_manager_form in ./
taxonomy_manager.admin.inc - defines forms for taxonomy manager interface
File
- ./
taxonomy_manager.admin.inc, line 869
Code
function taxonomy_manager_term_data_form(&$form, &$form_state, $tid = 0, $vid1, $vid2 = 0) {
$module_path = drupal_get_path('module', 'taxonomy_manager') . '/';
if ($tid) {
$term = taxonomy_term_load($tid);
//prevent that title of the fieldset is too long
$title = check_plain($term->name);
if (drupal_strlen($title) >= 33) {
$title = drupal_substr($title, 0, 33) . "...";
}
$form['term_data'] = array(
'#type' => 'fieldset',
'#title' => $title . " (" . $term->tid . ")",
);
unset($form_state['term']);
$form['term_data'] = taxonomy_form_term($form['term_data'], $form_state, $term);
$form['term_data']['description']['#rows'] = 2;
// Disable wysiwyg editor as long as #356480 (lazy-loading) is not resolved.
$form['term_data']['description']['#wysiwyg'] = FALSE;
$form['term_data']['weight'] = $form['term_data']['relations']['weight'];
unset($form['term_data']['relations']);
unset($form['term_data']['actions']);
$form['term_data']['parents'] = _taxonomy_manager_form_term_data_parents($term);
$form['term_data']['parents']['#weight'] = '52';
$form['term_data']['close'] = array(
'#markup' => '<div id="term-data-close"><span title="' . t('Close') . '"> </span></div>',
'#weight' => -100,
);
$link_img = theme("image", array(
'path' => $module_path . "images/link-small.png",
'alt' => t("link to term page"),
));
$form['term_data']['link'] = array(
'#markup' => '<br />' . l($link_img . ' ' . t('Go to the term page'), 'taxonomy/term/' . $term->tid, array(
'attributes' => array(
'rel' => 'tag',
'title' => strip_tags($term->description),
'target' => '_blank',
),
'html' => TRUE,
)),
'#weight' => 56,
);
$form['term_data']['vid'] = array(
'#type' => 'hidden',
'#value' => $term->vid,
);
$form['term_data']['tid'] = array(
'#type' => 'hidden',
'#value' => $tid,
);
$form['term_data']['save'] = array(
'#type' => 'submit',
'#value' => t('Save changes'),
'#submit' => array(
'taxonomy_manager_term_data_form_submit',
),
'#validate' => array(
'taxonomy_form_term_validate',
),
'#attributes' => array(
'class' => array(
'taxonomy-manager-buttons',
'save',
),
),
'#ajax' => array(
'callback' => 'taxonomy_manager_term_data_form_ajax_callback',
'method' => 'replaceWith',
'event' => 'click',
'wrapper' => 'taxonomy-term-data-replace',
'progress' => array(
'type' => '',
),
),
'#weight' => 20,
);
// i18n integration
if (module_exists('i18n_taxonomy')) {
if (i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_TRANSLATE)) {
$form['term_data']['translations'] = _taxonomy_manager_form_term_data_translations($term);
$form['term_data']['translations']['#weight'] = '50';
$form['term_data']['language'] = array(
'#type' => 'select',
'#title' => t('Language'),
'#description' => t('This term belongs to a multilingual vocabulary. You can set a language for it.'),
'#default_value' => $term->language,
'#options' => locale_language_list('name'),
);
}
}
// UUID integration.
if (module_exists('uuid')) {
$uuids = entity_get_uuid_by_id('taxonomy_term', array(
$tid,
));
if (count($uuids)) {
$form['term_data']['uuid'] = array(
'#markup' => t('UUID: @uuid', array(
'@uuid' => reset($uuids),
)),
'#weight' => -10,
);
}
}
// Entity translation and title field integration.
taxonomy_manager_term_data_form_entity_translation($form, $term);
_taxonomy_manager_term_data_form_filter_file_fields($form);
}
$form['term_data']['#prefix'] = '<div id="taxonomy-term-data-replace">';
$form['term_data']['#suffix'] = '</div>';
}