diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 7f06c04..a6c6f8d 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -586,7 +586,7 @@ function forum_field_storage_pre_update($entity_type, $entity, &$skip_fields) { function forum_form_taxonomy_vocabulary_form_alter(&$form, &$form_state, $form_id) { $vid = config('forum.settings')->get('vocabulary'); $vocabulary = $form_state['controller']->getEntity($form_state); - if (!$vocabulary->isNew() && $vid == $vocabulary->vid) { + if (!$vocabulary->isNew() && $vid == $vocabulary->id()) { $form['help_forum_vocab'] = array( '#markup' => t('This is the designated forum vocabulary. Some of the normal vocabulary options have been removed.'), '#weight' => -1, diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index a91a187..1f12b93 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -343,7 +343,7 @@ class ForumTest extends WebTestBase { // Generate a random name/description. $title = $this->randomName(10); $description = $this->randomName(100); - // @todo check that no vid field availiable. + // @todo check that no vid form-field available. $new_vid = drupal_strtolower(drupal_substr($this->randomName(), 3, 9)); $edit = array( diff --git a/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php b/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php index 2149dcc..2122b9a 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php @@ -54,7 +54,7 @@ class PathTaxonomyTermTest extends PathTestBase { 'description[value]' => $description, 'path[alias]' => $this->randomName(), ); - $this->drupalPost('admin/structure/taxonomy/' . $vocabulary->vid . '/add', $edit, t('Save')); + $this->drupalPost('admin/structure/taxonomy/' . $vocabulary->id() . '/add', $edit, t('Save')); // Confirm that the alias works. $this->drupalGet($edit['path[alias]']); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php index c7fa82a..0f7d328 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php @@ -96,6 +96,7 @@ class VocabularyTest extends TaxonomyTestBase { $this->drupalPost('admin/structure/taxonomy', $edit, t('Save')); // Load the vocabularies from the database. + entity_get_controller('taxonomy_vocabulary')->resetCache(); $new_vocabularies = taxonomy_vocabulary_load_multiple(); taxonomy_vocabulary_sort($new_vocabularies); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php index 417a0e4..6c4ca23 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php @@ -36,27 +36,6 @@ class VocabularyUnitTest extends TaxonomyTestBase { } /** - * Ensure that when an invalid vocabulary vid is loaded, it is possible - * to load the same vid successfully if it subsequently becomes valid. - */ - /*function testTaxonomyVocabularyLoadReturnFalse() { - // Load a vocabulary that doesn't exist. - $vocabularies = taxonomy_vocabulary_load_multiple(); - $vid = count($vocabularies) + 1; - $vocabulary = taxonomy_vocabulary_load($vid); - // This should not return an object because no such vocabulary exists. - $this->assertTrue(empty($vocabulary), 'No object loaded.'); - - // Create a new vocabulary. - $this->createVocabulary(); - // Load the vocabulary with the same $vid from earlier. - // This should return a vocabulary object since it now matches a real vid. - $vocabulary = taxonomy_vocabulary_load($vid); - $this->assertTrue(!empty($vocabulary) && is_object($vocabulary), 'Vocabulary is an object.'); - $this->assertEqual($vocabulary->vid, $vid, 'Valid vocabulary vid is the same as our previously invalid one.'); - }*/ - - /** * Test deleting a taxonomy that contains terms. */ function testTaxonomyVocabularyDeleteWithTerms() { @@ -191,8 +170,6 @@ class VocabularyUnitTest extends TaxonomyTestBase { // Check that entity bundles are properly updated. $info = entity_get_info('taxonomy_term'); - debug($info); - debug($this->vocabulary); $this->assertFalse(isset($info['bundles'][$old_name]), 'The old bundle name does not appear in entity_get_info().'); $this->assertTrue(isset($info['bundles'][$new_name]), 'The new bundle name appears in entity_get_info().'); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php index 5e657c5..5a7febf 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php @@ -33,7 +33,7 @@ class VocabularyFormController extends EntityFormController { ); $form['vid'] = array( '#type' => 'machine_name', - '#default_value' => $vocabulary->id(), + '#default_value' => $vocabulary->vid, '#maxlength' => 255, '#machine_name' => array( 'exists' => 'taxonomy_vocabulary_load', @@ -125,18 +125,18 @@ class VocabularyFormController extends EntityFormController { switch (taxonomy_vocabulary_save($vocabulary)) { case SAVED_NEW: drupal_set_message(t('Created new vocabulary %name.', array('%name' => $vocabulary->name))); - watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->id() . '/edit')); + watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->vid . '/edit')); $form_state['redirect'] = 'admin/structure/taxonomy/' . $vocabulary->id(); break; case SAVED_UPDATED: drupal_set_message(t('Updated vocabulary %name.', array('%name' => $vocabulary->name))); - watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->id() . '/edit')); + watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->vid . '/edit')); $form_state['redirect'] = 'admin/structure/taxonomy'; break; } - $form_state['values']['vid'] = $vocabulary->id(); - $form_state['vid'] = $vocabulary->id(); + $form_state['values']['vid'] = $vocabulary->vid; + $form_state['vid'] = $vocabulary->vid; } } diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index 6eb4a23..37883a5 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -266,14 +266,14 @@ function standard_install() { taxonomy_vocabulary_save($vocabulary); $field = array( - 'field_name' => 'field_' . $vocabulary->vid, + 'field_name' => 'field_' . $vocabulary->id(), 'type' => 'taxonomy_term_reference', // Set cardinality to unlimited for tagging. 'cardinality' => FIELD_CARDINALITY_UNLIMITED, 'settings' => array( 'allowed_values' => array( array( - 'vocabulary' => $vocabulary->vid, + 'vocabulary' => $vocabulary->id(), 'parent' => 0, ), ), @@ -282,7 +282,7 @@ function standard_install() { field_create_field($field); $instance = array( - 'field_name' => 'field_' . $vocabulary->vid, + 'field_name' => 'field_' . $vocabulary->id(), 'entity_type' => 'node', 'label' => 'Tags', 'bundle' => 'article',