- Patch #305740 by catch, Benjamin Melançon: added an edit tab to taxonomy term pages.
parent
1ec9a7b7a6
commit
fa8abcbf3b
|
@ -24,6 +24,7 @@ Drupal 7.0, xxxx-xx-xx (development version)
|
|||
a "slimmed down" install profile designed for developers.
|
||||
* Image toolkits are now provided by modules (rather than requiring a manual
|
||||
file copy to the includes directory).
|
||||
* Added an edit tab to taxonomy term pages.
|
||||
- News aggregator:
|
||||
* Added OPML import functionality for RSS feeds.
|
||||
* Optionally, RSS feeds may be configured to not automatically generate feed blocks.
|
||||
|
|
|
@ -117,7 +117,7 @@ class BlogAPITestCase extends DrupalWebTestCase {
|
|||
$edit = array();
|
||||
$edit['name'] = $vocab;
|
||||
$edit['nodes[blog]'] = TRUE;
|
||||
$this->drupalPost('admin/content/taxonomy/add/vocabulary', $edit, t('Save'));
|
||||
$this->drupalPost('admin/content/taxonomy/add', $edit, t('Save'));
|
||||
$this->assertRaw(t('Created new vocabulary %vocab.', array('%vocab' => $edit['name'])), t('Taxonomy vocabulary added.'));
|
||||
|
||||
$vocab_arr = taxonomy_get_vocabularies();
|
||||
|
@ -146,7 +146,7 @@ class BlogAPITestCase extends DrupalWebTestCase {
|
|||
function addTerm($vid, $term) {
|
||||
$edit = array();
|
||||
$edit['name'] = $term;
|
||||
$this->drupalPost('admin/content/taxonomy/' . $vid . '/add/term', $edit, t('Save'));
|
||||
$this->drupalPost('admin/content/taxonomy/' . $vid . '/add', $edit, t('Save'));
|
||||
$this->assertRaw(t('Created new term %term.', array('%term' => $edit['name'])), t('Taxonomy term added.'));
|
||||
|
||||
$tree = taxonomy_get_tree($vid);
|
||||
|
|
|
@ -160,7 +160,7 @@ function forum_form_container(&$form_state, $edit = array()) {
|
|||
* @param $tid ID of the term to be deleted
|
||||
*/
|
||||
function forum_confirm_delete(&$form_state, $tid) {
|
||||
$term = taxonomy_get_term($tid);
|
||||
$term = taxonomy_term_load($tid);
|
||||
|
||||
$form['tid'] = array('#type' => 'value', '#value' => $tid);
|
||||
$form['name'] = array('#type' => 'value', '#value' => $term->name);
|
||||
|
|
|
@ -224,7 +224,7 @@ function forum_nodeapi(&$node, $op, $teaser, $page) {
|
|||
foreach ($node->taxonomy as $term) {
|
||||
if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
|
||||
if (in_array($term, $containers)) {
|
||||
$term = taxonomy_get_term($term);
|
||||
$term = taxonomy_term_load($term);
|
||||
form_set_error('taxonomy', t('The item %forum is only a container for forums. Please select one of the forums below it.', array('%forum' => $term->name)));
|
||||
}
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
|
|||
}
|
||||
}
|
||||
|
||||
$term = taxonomy_get_term($tid);
|
||||
$term = taxonomy_term_load($tid);
|
||||
|
||||
$sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d");
|
||||
$sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,');
|
||||
|
|
|
@ -134,7 +134,7 @@ class ForumTestCase extends DrupalWebTestCase {
|
|||
);
|
||||
|
||||
// Edit the vocabulary.
|
||||
$this->drupalPost('admin/content/taxonomy/edit/vocabulary/' . $vid, $edit, t('Save'));
|
||||
$this->drupalPost('admin/content/taxonomy/' . $vid . '/edit', $edit, t('Save'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited'));
|
||||
|
||||
|
@ -158,7 +158,7 @@ class ForumTestCase extends DrupalWebTestCase {
|
|||
);
|
||||
|
||||
// Edit the vocabulary.
|
||||
$this->drupalPost('admin/content/taxonomy/edit/vocabulary/' . $vid, $edit, t('Save'));
|
||||
$this->drupalPost('admin/content/taxonomy/' . $vid . 'edit', $edit, t('Save'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited'));
|
||||
/*
|
||||
|
|
|
@ -26,9 +26,9 @@ function taxonomy_overview_vocabularies() {
|
|||
$form[$vocabulary->vid]['name'] = array('#markup' => check_plain($vocabulary->name));
|
||||
$form[$vocabulary->vid]['types'] = array('#markup' => implode(', ', $types));
|
||||
$form[$vocabulary->vid]['weight'] = array('#type' => 'weight', '#delta' => 10, '#default_value' => $vocabulary->weight);
|
||||
$form[$vocabulary->vid]['edit'] = array('#markup' => l(t('edit vocabulary'), "admin/content/taxonomy/edit/vocabulary/$vocabulary->vid"));
|
||||
$form[$vocabulary->vid]['list'] = array('#markup' => l(t('list terms'), "admin/content/taxonomy/$vocabulary->vid"));
|
||||
$form[$vocabulary->vid]['add'] = array('#markup' => l(t('add terms'), "admin/content/taxonomy/$vocabulary->vid/add/term"));
|
||||
$form[$vocabulary->vid]['edit'] = array('#markup' => l(t('edit vocabulary'), "admin/content/taxonomy/$vocabulary->vid"));
|
||||
$form[$vocabulary->vid]['list'] = array('#markup' => l(t('list terms'), "admin/content/taxonomy/$vocabulary->vid/list"));
|
||||
$form[$vocabulary->vid]['add'] = array('#markup' => l(t('add terms'), "admin/content/taxonomy/$vocabulary->vid/add"));
|
||||
}
|
||||
|
||||
// Only make this form include a submit button and weight if more than one
|
||||
|
@ -101,6 +101,9 @@ function theme_taxonomy_overview_vocabularies($form) {
|
|||
* @see taxonomy_form_vocabulary_submit()
|
||||
*/
|
||||
function taxonomy_form_vocabulary(&$form_state, $edit = array()) {
|
||||
if (!is_array($edit)) {
|
||||
$edit = (array)$edit;
|
||||
}
|
||||
$edit += array(
|
||||
'name' => '',
|
||||
'description' => '',
|
||||
|
@ -210,11 +213,11 @@ function taxonomy_form_vocabulary_submit($form, &$form_state) {
|
|||
switch (taxonomy_save_vocabulary($form_state['values'])) {
|
||||
case SAVED_NEW:
|
||||
drupal_set_message(t('Created new vocabulary %name.', array('%name' => $form_state['values']['name'])));
|
||||
watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/vocabulary/' . $form_state['values']['vid']));
|
||||
watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/' . $form_state['values']['vid']));
|
||||
break;
|
||||
case SAVED_UPDATED:
|
||||
drupal_set_message(t('Updated vocabulary %name.', array('%name' => $form_state['values']['name'])));
|
||||
watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/vocabulary/' . $form_state['values']['vid']));
|
||||
watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/' . $form_state['values']['vid']));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -223,23 +226,6 @@ function taxonomy_form_vocabulary_submit($form, &$form_state) {
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page to edit a vocabulary.
|
||||
*/
|
||||
function taxonomy_admin_vocabulary_edit($vocabulary) {
|
||||
return drupal_get_form('taxonomy_form_vocabulary', (array)$vocabulary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Page to edit a vocabulary term.
|
||||
*/
|
||||
function taxonomy_admin_term_edit($tid) {
|
||||
if ($term = (array)taxonomy_get_term($tid)) {
|
||||
return drupal_get_form('taxonomy_form_term', taxonomy_vocabulary_load($term['vid']), $term);
|
||||
}
|
||||
return drupal_not_found();
|
||||
}
|
||||
|
||||
/**
|
||||
* Form builder for the taxonomy terms overview.
|
||||
*
|
||||
|
@ -258,7 +244,6 @@ function taxonomy_overview_terms(&$form_state, $vocabulary) {
|
|||
return taxonomy_vocabulary_confirm_reset_alphabetical($form_state, $vocabulary->vid);
|
||||
}
|
||||
|
||||
drupal_set_title(t('Terms in %vocabulary', array('%vocabulary' => $vocabulary->name)));
|
||||
$form = array(
|
||||
'#vocabulary' => (array)$vocabulary,
|
||||
'#tree' => TRUE,
|
||||
|
@ -405,7 +390,7 @@ function taxonomy_overview_terms(&$form_state, $vocabulary) {
|
|||
'#default_value' => $term->depth,
|
||||
);
|
||||
}
|
||||
$form[$key]['edit'] = array('#markup' => l(t('edit'), "admin/content/taxonomy/edit/term/$term->tid", array('query' => drupal_get_destination())));
|
||||
$form[$key]['edit'] = array('#markup' => l(t('edit'), 'taxonomy/term/' . $term->tid . '/edit', array('query' => drupal_get_destination())));
|
||||
}
|
||||
|
||||
$form['#total_entries'] = $total_entries;
|
||||
|
@ -624,14 +609,6 @@ function theme_taxonomy_overview_terms($form) {
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu callback; return the edit form for a new term after setting the title.
|
||||
*/
|
||||
function taxonomy_add_term_page($vocabulary) {
|
||||
drupal_set_title(t('Add term to %vocabulary', array('%vocabulary' => $vocabulary->name)));
|
||||
return drupal_get_form('taxonomy_form_term' , $vocabulary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Form function for the term edit form.
|
||||
*
|
||||
|
@ -773,11 +750,11 @@ function taxonomy_form_term_submit($form, &$form_state) {
|
|||
switch (taxonomy_save_term($form_state['values'])) {
|
||||
case SAVED_NEW:
|
||||
drupal_set_message(t('Created new term %term.', array('%term' => $form_state['values']['name'])));
|
||||
watchdog('taxonomy', 'Created new term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/term/' . $form_state['values']['tid']));
|
||||
watchdog('taxonomy', 'Created new term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'taxonomy/term/' . $form_state['values']['tid'] . '/edit'));
|
||||
break;
|
||||
case SAVED_UPDATED:
|
||||
drupal_set_message(t('Updated term %term.', array('%term' => $form_state['values']['name'])));
|
||||
watchdog('taxonomy', 'Updated term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/term/' . $form_state['values']['tid']));
|
||||
watchdog('taxonomy', 'Updated term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'taxonomy/term/' . $form_state['values']['tid'] . '/edit'));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -835,7 +812,7 @@ function taxonomy_term_confirm_parents(&$form_state, $vocabulary) {
|
|||
* @see taxonomy_term_confirm_delete_submit()
|
||||
*/
|
||||
function taxonomy_term_confirm_delete(&$form_state, $tid) {
|
||||
$term = taxonomy_get_term($tid);
|
||||
$term = taxonomy_term_load($tid);
|
||||
|
||||
$form['type'] = array('#type' => 'value', '#value' => 'term');
|
||||
$form['name'] = array('#type' => 'value', '#value' => $term->name);
|
||||
|
|
|
@ -125,31 +125,15 @@ function taxonomy_menu() {
|
|||
'weight' => -10,
|
||||
);
|
||||
|
||||
$items['admin/content/taxonomy/add/vocabulary'] = array(
|
||||
$items['admin/content/taxonomy/add'] = array(
|
||||
'title' => 'Add vocabulary',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('taxonomy_form_vocabulary'),
|
||||
'access arguments' => array('administer taxonomy'),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
'parent' => 'admin/content/taxonomy',
|
||||
);
|
||||
|
||||
$items['admin/content/taxonomy/edit/vocabulary/%taxonomy_vocabulary'] = array(
|
||||
'title' => 'Edit vocabulary',
|
||||
'page callback' => 'taxonomy_admin_vocabulary_edit',
|
||||
'page arguments' => array(5),
|
||||
'access arguments' => array('administer taxonomy'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
||||
$items['admin/content/taxonomy/edit/term'] = array(
|
||||
'title' => 'Edit term',
|
||||
'page callback' => 'taxonomy_admin_term_edit',
|
||||
'access arguments' => array('administer taxonomy'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
||||
$items['taxonomy/term/%'] = array(
|
||||
$items['taxonomy/term/%taxonomy_terms'] = array(
|
||||
'title' => 'Taxonomy term',
|
||||
'page callback' => 'taxonomy_term_page',
|
||||
'page arguments' => array(2),
|
||||
|
@ -157,38 +141,73 @@ function taxonomy_menu() {
|
|||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
||||
$items['taxonomy/term/%taxonomy_terms/view'] = array(
|
||||
'title' => 'View',
|
||||
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||||
);
|
||||
|
||||
$items['taxonomy/term/%taxonomy_term/edit'] = array(
|
||||
'title' => 'Edit term',
|
||||
'page callback' => 'taxonomy_term_edit',
|
||||
'page arguments' => array(2),
|
||||
'access arguments' => array('administer taxonomy'),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
'weight' => 10,
|
||||
);
|
||||
|
||||
$items['taxonomy/autocomplete'] = array(
|
||||
'title' => 'Autocomplete taxonomy',
|
||||
'page callback' => 'taxonomy_autocomplete',
|
||||
'access arguments' => array('access content'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
||||
$items['admin/content/taxonomy/%taxonomy_vocabulary'] = array(
|
||||
'title' => 'List terms',
|
||||
'title' => 'Vocabulary', // this is replaced by callback
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('taxonomy_overview_terms', 3),
|
||||
'page arguments' => array('taxonomy_form_vocabulary', 3),
|
||||
'title callback' => 'taxonomy_admin_vocabulary_title_callback',
|
||||
'title arguments' => array(3),
|
||||
'access arguments' => array('administer taxonomy'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
||||
$items['admin/content/taxonomy/%taxonomy_vocabulary/list'] = array(
|
||||
'title' => 'List',
|
||||
$items['admin/content/taxonomy/%taxonomy_vocabulary/edit'] = array(
|
||||
'title' => 'Edit vocabulary',
|
||||
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||||
'weight' => -20,
|
||||
);
|
||||
|
||||
$items['admin/content/taxonomy/%taxonomy_vocabulary/list'] = array(
|
||||
'title' => 'List terms',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('taxonomy_overview_terms', 3),
|
||||
'access arguments' => array('administer taxonomy'),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
'weight' => -10,
|
||||
);
|
||||
|
||||
$items['admin/content/taxonomy/%taxonomy_vocabulary/add/term'] = array(
|
||||
$items['admin/content/taxonomy/%taxonomy_vocabulary/add'] = array(
|
||||
'title' => 'Add term',
|
||||
'page callback' => 'taxonomy_add_term_page',
|
||||
'page arguments' => array(3),
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('taxonomy_form_term', 3),
|
||||
'access arguments' => array('administer taxonomy'),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
'parent' => 'admin/content/taxonomy/%taxonomy_vocabulary',
|
||||
);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the vocabulary name given the vocabulary object.
|
||||
*/
|
||||
function taxonomy_admin_vocabulary_title_callback($vocabulary) {
|
||||
return check_plain($vocabulary->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a vocabulary given form values or an equivalent array.
|
||||
*/
|
||||
function taxonomy_save_vocabulary(&$edit) {
|
||||
$edit['nodes'] = empty($edit['nodes']) ? array() : $edit['nodes'];
|
||||
|
||||
|
@ -386,7 +405,7 @@ function taxonomy_del_term($tid) {
|
|||
}
|
||||
}
|
||||
|
||||
$term = (array) taxonomy_get_term($tid);
|
||||
$term = (array) taxonomy_term_load($tid);
|
||||
|
||||
db_query('DELETE FROM {term_data} WHERE tid = %d', $tid);
|
||||
db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid);
|
||||
|
@ -579,13 +598,13 @@ function taxonomy_preview_terms($node) {
|
|||
$taxonomy['tags'] = $term;
|
||||
}
|
||||
else {
|
||||
$taxonomy[$tid] = taxonomy_get_term($tid);
|
||||
$taxonomy[$tid] = taxonomy_term_load($tid);
|
||||
}
|
||||
}
|
||||
}
|
||||
// A 'Single select' field returns the term id.
|
||||
elseif ($term) {
|
||||
$taxonomy[$term] = taxonomy_get_term($term);
|
||||
$taxonomy[$term] = taxonomy_term_load($term);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -767,7 +786,7 @@ function taxonomy_get_parents($tid, $key = 'tid') {
|
|||
function taxonomy_get_parents_all($tid) {
|
||||
$parents = array();
|
||||
if ($tid) {
|
||||
$parents[] = taxonomy_get_term($tid);
|
||||
$parents[] = taxonomy_term_load($tid);
|
||||
$n = 0;
|
||||
while ($parent = taxonomy_get_parents($parents[$n]->tid)) {
|
||||
$parents = array_merge($parents, $parent);
|
||||
|
@ -996,6 +1015,17 @@ function taxonomy_vocabulary_load($vid) {
|
|||
return !empty($vocabularies[$vid]) ? $vocabularies[$vid] : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of tids and join operator.
|
||||
*
|
||||
* This is a wrapper function for taxonomy_terms_parse_string which is called
|
||||
* by the menu system when loading a path with taxonomy terms.
|
||||
*/
|
||||
function taxonomy_terms_load($str_tids) {
|
||||
$terms = taxonomy_terms_parse_string($str_tids);
|
||||
return $terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the term object matching a term ID.
|
||||
*
|
||||
|
@ -1005,13 +1035,14 @@ function taxonomy_vocabulary_load($vid) {
|
|||
* @return Object
|
||||
* A term object. Results are statically cached.
|
||||
*/
|
||||
function taxonomy_get_term($tid) {
|
||||
function taxonomy_term_load($tid, $reset = FALSE) {
|
||||
if (!is_numeric($tid)) {
|
||||
return FALSE;
|
||||
}
|
||||
static $terms = array();
|
||||
|
||||
if (!isset($terms[$tid])) {
|
||||
if (!isset($terms[$tid]) || $reset) {
|
||||
$terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid));
|
||||
}
|
||||
|
||||
return $terms[$tid];
|
||||
}
|
||||
|
||||
|
@ -1080,7 +1111,7 @@ function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $p
|
|||
$depth = NULL;
|
||||
}
|
||||
foreach ($tids as $index => $tid) {
|
||||
$term = taxonomy_get_term($tid);
|
||||
$term = taxonomy_term_load($tid);
|
||||
$tree = taxonomy_get_tree($term->vid, $tid, -1, $depth);
|
||||
$descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
|
||||
}
|
||||
|
@ -1212,6 +1243,7 @@ function taxonomy_terms_parse_string($str_tids) {
|
|||
$terms['operator'] = 'and';
|
||||
$terms['tids'] = explode(',', $str_tids);
|
||||
}
|
||||
$terms['str_tids'] = $str_tids;
|
||||
return $terms;
|
||||
}
|
||||
|
||||
|
@ -1247,7 +1279,7 @@ function taxonomy_help($path, $arg) {
|
|||
$output = '<p>' . t("The taxonomy module allows you to categorize your content using both tags and administrator defined terms. It is a flexible tool for classifying content with many advanced features. To begin, create a 'Vocabulary' to hold one set of terms or tags. You can create one free-tagging vocabulary for everything, or separate controlled vocabularies to define the various properties of your content, for example 'Countries' or 'Colors'.") . '</p>';
|
||||
$output .= '<p>' . t('Use the list below to configure and review the vocabularies defined on your site, or to list and manage the terms (tags) they contain. A vocabulary may (optionally) be tied to specific content types as shown in the <em>Type</em> column and, if so, will be displayed when creating or editing posts of that type. Multiple vocabularies tied to the same content type will be displayed in the order shown below. To change the order of a vocabulary, grab a drag-and-drop handle under the <em>Name</em> column and drag it to a new location in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save</em> button at the bottom of the page.') . '</p>';
|
||||
return $output;
|
||||
case 'admin/content/taxonomy/%':
|
||||
case 'admin/content/taxonomy/%/list':
|
||||
$vocabulary = taxonomy_vocabulary_load($arg[3]);
|
||||
if ($vocabulary->tags) {
|
||||
return '<p>' . t('%capital_name is a free-tagging vocabulary. To change the name or description of a term, click the <em>edit</em> link next to the term.', array('%capital_name' => drupal_ucfirst($vocabulary->name))) . '</p>';
|
||||
|
@ -1260,7 +1292,7 @@ function taxonomy_help($path, $arg) {
|
|||
case 2:
|
||||
return '<p>' . t('%capital_name is a multiple hierarchy vocabulary. To change the name or description of a term, click the <em>edit</em> link next to the term. Drag and drop of multiple hierarchies is not supported, but you can re-enable drag and drop support by editing each term to include only a single parent.', array('%capital_name' => drupal_ucfirst($vocabulary->name))) . '</p>';
|
||||
}
|
||||
case 'admin/content/taxonomy/add/vocabulary':
|
||||
case 'admin/content/taxonomy/add':
|
||||
return '<p>' . t('Define how your vocabulary will be presented to administrators and users, and which content types to categorize with it. Tags allows users to create terms when submitting posts by typing a comma separated list. Otherwise terms are chosen from a select list and can only be created by users with the "administer taxonomy" permission.') . '</p>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
/**
|
||||
* Menu callback; displays all nodes associated with a term.
|
||||
*/
|
||||
function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
|
||||
$terms = taxonomy_terms_parse_string($str_tids);
|
||||
function taxonomy_term_page($terms, $depth = 0, $op = 'page') {
|
||||
if ($terms['operator'] != 'and' && $terms['operator'] != 'or') {
|
||||
drupal_not_found();
|
||||
}
|
||||
$str_tids = $terms['str_tids'];
|
||||
|
||||
if ($terms['tids']) {
|
||||
$result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN (' . db_placeholders($terms['tids']) . ')', 't', 'tid'), $terms['tids']);
|
||||
|
@ -51,7 +51,7 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
|
|||
$channel['title'] = variable_get('site_name', 'Drupal') . ' - ' . $title;
|
||||
// Only display the description if we have a single term, to avoid clutter and confusion.
|
||||
if (count($tids) == 1) {
|
||||
$term = taxonomy_get_term($tids[0]);
|
||||
$term = taxonomy_term_load($tids[0]);
|
||||
// HTML will be removed from feed description, so no need to filter here.
|
||||
$channel['description'] = $term->description;
|
||||
}
|
||||
|
@ -87,12 +87,11 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
|
|||
*/
|
||||
function theme_taxonomy_term_page($tids, $result) {
|
||||
drupal_add_css(drupal_get_path('module', 'taxonomy') . '/taxonomy.css');
|
||||
|
||||
$output = '';
|
||||
|
||||
// Only display the description if we have a single term, to avoid clutter and confusion.
|
||||
if (count($tids) == 1) {
|
||||
$term = taxonomy_get_term($tids[0]);
|
||||
$term = taxonomy_term_load($tids[0]);
|
||||
$description = $term->description;
|
||||
|
||||
// Check that a description is set.
|
||||
|
@ -108,6 +107,17 @@ function theme_taxonomy_term_page($tids, $result) {
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page to edit a vocabulary term.
|
||||
*/
|
||||
function taxonomy_term_edit($term) {
|
||||
if (isset($term)) {
|
||||
drupal_set_title(check_plain($term->name));
|
||||
return drupal_get_form('taxonomy_form_term', taxonomy_vocabulary_load($term->vid), (array)$term);
|
||||
}
|
||||
return drupal_not_found();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for autocompletion
|
||||
*/
|
||||
|
|
|
@ -495,13 +495,13 @@ class TermEditTestCase extends DrupalWebTestCase {
|
|||
);
|
||||
|
||||
// Create the term to edit (adding to the default 'Tags' vocabulary).
|
||||
$this->drupalPost('admin/content/taxonomy/1/add/term', $edit, t('Save'));
|
||||
$this->drupalPost('admin/content/taxonomy/1/add/', $edit, t('Save'));
|
||||
|
||||
$term = taxonomy_get_term_by_name($edit['name']);
|
||||
$this->assertNotNull($term, t('Term found in database'));
|
||||
|
||||
// Submitting a term takes us to the add page; we need the List page.
|
||||
$this->clickLink(t('List'));
|
||||
$this->drupalGet('admin/content/taxonomy/1/list');
|
||||
|
||||
// Test edit link as accessed from Taxonomy administration pages.
|
||||
// Because Simpletest creates its own database when running tests, we know
|
||||
|
@ -509,7 +509,7 @@ class TermEditTestCase extends DrupalWebTestCase {
|
|||
$this->clickLink(t('edit'));
|
||||
|
||||
// This failed inexplicably with assertText, so used assertRaw. @TODO: Why?
|
||||
$this->assertRaw($edit['name'], t('The randomly generated term name is present.'));
|
||||
$this->assertText($edit['name'], t('The randomly generated term name is present.'));
|
||||
$this->assertText($edit['description'], t('The randomly generated term description is present.'));
|
||||
|
||||
$edit = array(
|
||||
|
@ -518,10 +518,10 @@ class TermEditTestCase extends DrupalWebTestCase {
|
|||
);
|
||||
|
||||
// Edit the term.
|
||||
$this->drupalPost('admin/content/taxonomy/edit/term/'. $term[0]->tid, $edit, t('Save'));
|
||||
$this->drupalPost('taxonomy/term/' . $term[0]->tid . '/edit', $edit, t('Save'));
|
||||
|
||||
// View the term and check that it is correct.
|
||||
$this->drupalGet('taxonomy/term/1');
|
||||
$this->drupalGet('taxonomy/term/' . $term[0]->tid);
|
||||
$this->assertText($edit['name'], t('The randomly generated term name is present.'));
|
||||
$this->assertText($edit['description'], t('The randomly generated term description is present.'));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue