2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
$form['name']=array('#type'=>'textfield','#title'=>t('Term name'),'#default_value'=>$edit['name'],'#maxlength'=>64,'#description'=>t('The name for this term. Example: "Linux".'),'#required'=>TRUE);
$form['name']=array(
'#type'=>'textfield',
'#title'=>t('Term name'),
'#default_value'=>$edit['name'],
'#maxlength'=>64,
'#description'=>t('The name of this term.'),
'#required'=>TRUE);
$form['description']=array('#type'=>'textarea','#title'=>t('Description'),'#default_value'=>$edit['description'],'#description'=>t('A description of the term.'));
$form['synonyms']=array('#type'=>'textarea','#title'=>t('Synonyms'),'#default_value'=>implode("\n",taxonomy_get_synonyms($edit['tid'])),'#description'=>t('<a href="@help-url">Synonyms</a> of this term, one synonym per line.',array('@help-url'=>url('admin/help/taxonomy',NULL,NULL,'synonyms'))));
$form['weight']=array('#type'=>'weight','#title'=>t('Weight'),'#default_value'=>$edit['weight'],'#description'=>t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.'));
'#description'=>t('<a href="@help-url">Synonyms</a> of this term, one synonym per line.',array('@help-url'=>url('admin/help/taxonomy',NULL,NULL,'synonyms'))));
$form['weight']=array(
'#type'=>'weight',
'#title'=>t('Weight'),
'#default_value'=>$edit['weight'],
'#description'=>t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.'));
@@ -413,62 +460,69 @@ function taxonomy_form_term_submit($form_id, $form_values) {
return'admin/content/taxonomy';
}
functiontaxonomy_save_term(&$edit){
if($edit['tid']&&$edit['name']){
db_query("UPDATE {term_data} SET name = '%s', description = '%s', weight = %d WHERE tid = %d",$edit['name'],$edit['description'],$edit['weight'],$edit['tid']);
/**
* Helper function for taxonomy_form_term_submit().
*
* @param $form_values
* @return
* Status constant indicating if term was inserted or updated.
*/
functiontaxonomy_save_term(&$form_values){
if($form_values['tid']&&$form_values['name']){
db_query("UPDATE {term_data} SET name = '%s', description = '%s', weight = %d WHERE tid = %d",$form_values['name'],$form_values['description'],$form_values['weight'],$form_values['tid']);
$result=db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight','t','tid'),$vid,$nid);
@@ -767,7 +829,7 @@ function taxonomy_node_save($nid, $terms) {
$typed_term_tid=$edit['tid'];
}
// Defend against duplicate, different cased tags
// Defend against duplicate, differently cased tags
if(!isset($inserted[$typed_term_tid])){
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)',$nid,$typed_term_tid);
$inserted[$typed_term_tid]=TRUE;
...
...
@@ -982,7 +1044,7 @@ function taxonomy_term_count_nodes($tid, $type = 0) {
static$count;
if(!isset($count[$type])){
// $type == 0 always evaluates TRUE is $type is a string
// $type == 0 always evaluates TRUE if $type is a string
if(is_numeric($type)){
$result=db_query(db_rewrite_sql('SELECT t.tid, COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid WHERE n.status = 1 GROUP BY t.tid'));
}
...
...
@@ -1125,6 +1187,9 @@ function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $descripti
);
}
/**
* We use the default selection field for choosing terms.
*/
functiontheme_taxonomy_term_select($element){
returntheme('select',$element);
}
...
...
@@ -1246,15 +1311,15 @@ function taxonomy_node_update_index(&$node) {
}
/**
* Parses a comma or plus separated string of term ids.
* Parses a comma or plus separated string of term IDs.
*
* @param $str_tids
* An string of term ids, separated by plus or comma.
* A string of term IDs, separated by plus or comma.
* comma (,) means AND
* plus (+) means OR
*
* @return an associative array with an <code>operator</code> key (either 'and'
* or 'or') and an array, <code>tids</code>, containing the term ids.
* @return an associative array with an operator key (either 'and'
* or 'or') and a tid key containing an array of the term ids.
@@ -1343,7 +1408,7 @@ function taxonomy_admin_vocabulary_edit($vid = NULL) {
}
/**
* Page to edit a vocabulary term
* Page to edit a vocabulary term.
*/
functiontaxonomy_admin_term_edit($tid){
if($_POST['op']==t('Delete')||$_POST['confirm']){
...
...
@@ -1356,7 +1421,7 @@ function taxonomy_admin_term_edit($tid) {
}
/**
* Provides category information for rss feeds
* Provides category information for RSS feeds.
*/
functiontaxonomy_rss_item($node){
$output=array();
...
...
@@ -1374,15 +1439,15 @@ function taxonomy_rss_item($node) {
functiontaxonomy_help($section){
switch($section){
case'admin/help#taxonomy':
$output='<p>'.t('The taxonomy module is one of the most popular features because users often want to create categories to organize content by type. It can automatically classify new content, which is very useful for organizing content on-the-fly. A simple example would be organizing a list of music reviews by musical genre.').'</p>';
$output.='<p>'.t('Taxonomy is also the study of classification. The taxonomy module allows you to define vocabularies (sets of categories) which are used to classify content. The module supports hierarchical classification and association between terms, allowing for truly flexible information retrieval and classification. The taxonomy module allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). To view and manage the terms of each vocabulary, click on the associated <em>list terms</em> link. To delete a vocabulary and all its terms, choose <em>edit vocabulary.</em>').'</p>';
$output='<p>'.t('The taxonomy module is one of the most popular features because users often want to create categories to organize content by type. A simple example would be organizing a list of music reviews by musical genre.').'</p>';
$output.='<p>'.t('Taxonomy is the study of classification. The taxonomy module allows you to define vocabularies (sets of categories) which are used to classify content. The module supports hierarchical classification and association between terms, allowing for truly flexible information retrieval and classification. The taxonomy module allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). To view and manage the terms of each vocabulary, click on the associated <em>list terms</em> link. To delete a vocabulary and all its terms, choose <em>edit vocabulary.</em>').'</p>';
$output.='<p>'.t('A controlled vocabulary is a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each piece of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot\'s sections. For more complex implementations, you might create a hierarchical list of categories.').'</p>';
$output.='<p>'.t('For more information please read the configuration and customization handbook <a href="@taxonomy">Taxonomy page</a>.',array('@taxonomy'=>'http://drupal.org/handbook/modules/taxonomy/')).'</p>';
return$output;
case'admin/content/taxonomy':
return'<p>'.t('The taxonomy module allows you to classify content into categories and subcategories; it allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms), taxonomies (controlled vocabularies where relationships are indicated hierarchically), and free vocabularies where terms, or tags, are defined during content creation. To view and manage the terms of each vocabulary, click on the associated <em>list terms</em> link. To delete a vocabulary and all its terms, choose "edit vocabulary".').'</p>';
case'admin/content/taxonomy/add/vocabulary':
return'<p>'.t("When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each piece of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot.org's or Kuro5hin.org's sections. For more complex implementations, you might create a hierarchical list of categories.").'</p>';
return'<p>'.t("When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each piece of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories. For more complex implementations, you might create a hierarchical list of categories.").'</p>';