summaryrefslogtreecommitdiff
path: root/modules/taxonomy
diff options
context:
space:
mode:
Diffstat (limited to 'modules/taxonomy')
-rw-r--r--modules/taxonomy/taxonomy.module26
-rw-r--r--modules/taxonomy/taxonomy.test30
2 files changed, 30 insertions, 26 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 13578be04..dcfe129cb 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -371,7 +371,6 @@ function taxonomy_vocabulary_save($vocabulary) {
elseif (empty($vocabulary->vid)) {
$status = drupal_write_record('taxonomy_vocabulary', $vocabulary);
field_attach_create_bundle('taxonomy_term', $vocabulary->machine_name);
- taxonomy_vocabulary_create_field($vocabulary);
module_invoke_all('taxonomy_vocabulary_insert', $vocabulary);
entity_invoke('insert', 'taxonomy_vocabulary', $vocabulary);
}
@@ -452,31 +451,6 @@ function taxonomy_check_vocabulary_hierarchy($vocabulary, $changed_term) {
}
/**
- * Create a default field when a vocabulary is created.
- *
- * @param $vocabulary
- * A taxonomy vocabulary object.
- */
-function taxonomy_vocabulary_create_field($vocabulary) {
- $field = array(
- 'field_name' => 'taxonomy_' . $vocabulary->machine_name,
- 'type' => 'taxonomy_term_reference',
- // Set cardinality to unlimited so that select
- // and autocomplete widgets behave as normal.
- 'cardinality' => FIELD_CARDINALITY_UNLIMITED,
- 'settings' => array(
- 'allowed_values' => array(
- array(
- 'vid' => $vocabulary->vid,
- 'parent' => 0,
- ),
- ),
- ),
- );
- field_create_field($field);
-}
-
-/**
* Save a term object to the database.
*
* @param $term
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 7d5a0ef93..eca965fc4 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -324,6 +324,21 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$this->drupalLogin($this->admin_user);
$this->vocabulary = $this->createVocabulary();
+ $field = array(
+ 'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
+ 'type' => 'taxonomy_term_reference',
+ 'cardinality' => FIELD_CARDINALITY_UNLIMITED,
+ 'settings' => array(
+ 'allowed_values' => array(
+ array(
+ 'vid' => $this->vocabulary->vid,
+ 'parent' => 0,
+ ),
+ ),
+ ),
+ );
+ field_create_field($field);
+
$this->instance = array(
'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
'bundle' => 'article',
@@ -855,6 +870,21 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase {
$this->vocabulary = $this->createVocabulary();
$this->langcode = LANGUAGE_NONE;
+ $field = array(
+ 'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
+ 'type' => 'taxonomy_term_reference',
+ 'cardinality' => FIELD_CARDINALITY_UNLIMITED,
+ 'settings' => array(
+ 'allowed_values' => array(
+ array(
+ 'vid' => $this->vocabulary->vid,
+ 'parent' => 0,
+ ),
+ ),
+ ),
+ );
+ field_create_field($field);
+
$this->instance = array(
'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
'bundle' => 'article',