diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php index 63fd88b..ae748e4 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php @@ -140,7 +140,7 @@ public function testConfigEntityReferenceItem() { $entity->field_test_taxonomy_vocabulary->entity->save(); // Verify it is the correct name. $vocabulary = entity_load('taxonomy_vocabulary', $referenced_entity_id); - $this->assertEqual($vocabulary->name, $new_name); + $this->assertEqual($vocabulary->getName(), $new_name); // Make sure the computed term reflects updates to the term id. $vocabulary2 = entity_create('taxonomy_vocabulary', array( @@ -152,7 +152,7 @@ public function testConfigEntityReferenceItem() { $entity->field_test_taxonomy_vocabulary->target_id = $vocabulary2->id(); $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->id(), $vocabulary2->id()); - $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->name, $vocabulary2->name); + $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->getName(), $vocabulary2->getName()); // Delete terms so we have nothing to reference and try again $this->vocabulary->delete(); diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyVocabularyTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyVocabularyTest.php index 607d4d7..a98d628 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyVocabularyTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyVocabularyTest.php @@ -46,16 +46,16 @@ public function testTaxonomyVocabulary() { $j = $i + 1; $vocabulary = entity_load('taxonomy_vocabulary', "vocabulary_{$j}_i_{$i}_"); $this->assertEqual(array($vocabulary->id()), entity_load('migration', 'd6_taxonomy_vocabulary')->getIdMap()->lookupDestinationID(array($j))); - $this->assertEqual($vocabulary->name, "vocabulary $j (i=$i)"); - $this->assertEqual($vocabulary->description, "description of vocabulary $j (i=$i)"); - $this->assertEqual($vocabulary->hierarchy, $i); - $this->assertEqual($vocabulary->weight, 4 + $i); + $this->assertEqual($vocabulary->getName(), "vocabulary $j (i=$i)"); + $this->assertEqual($vocabulary->getDescription(), "description of vocabulary $j (i=$i)"); + $this->assertEqual($vocabulary->getHierarchy(), $i); + $this->assertEqual($vocabulary->getWeight(), 4 + $i); } $vocabulary = entity_load('taxonomy_vocabulary', 'vocabulary_name_much_longer_than'); - $this->assertEqual($vocabulary->name, 'vocabulary name much longer than thirty two characters'); - $this->assertEqual($vocabulary->description, 'description of vocabulary name much longer than thirty two characters'); - $this->assertEqual($vocabulary->hierarchy, 3); - $this->assertEqual($vocabulary->weight, 7); + $this->assertEqual($vocabulary->getName(), 'vocabulary name much longer than thirty two characters'); + $this->assertEqual($vocabulary->getDescription(), 'description of vocabulary name much longer than thirty two characters'); + $this->assertEqual($vocabulary->getHierarchy(), 3); + $this->assertEqual($vocabulary->getWeight(), 7); } } diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index b50698f..1f866d8 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1278,8 +1278,8 @@ function hook_mail($key, &$message, $params) { '%term_name' => $entity->name, '%term_description' => $entity->description, '%term_id' => $entity->id(), - '%vocabulary_name' => $vocabulary->name, - '%vocabulary_description' => $vocabulary->description, + '%vocabulary_name' => $vocabulary->getName(), + '%vocabulary_description' => $vocabulary->getDescription(), '%vocabulary_id' => $vocabulary->id(), ); } diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php index 39c732b..ecbb78f 100644 --- a/core/modules/taxonomy/src/Form/OverviewTerms.php +++ b/core/modules/taxonomy/src/Form/OverviewTerms.php @@ -440,8 +440,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } // Update the vocabulary hierarchy to flat or single hierarchy. - if ($vocabulary->hierarchy != $hierarchy) { - $vocabulary->hierarchy = $hierarchy; + if ($vocabulary->getHierarchy() != $hierarchy) { + $vocabulary->setHierarchy($hierarchy); $vocabulary->save(); } drupal_set_message($this->t('The configuration options have been saved.')); diff --git a/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php b/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php index c58a631..810ce35 100644 --- a/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php +++ b/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php @@ -124,7 +124,7 @@ public function settingsForm(array &$form, FormStateInterface $form_state, $has_ $vocabularies = entity_load_multiple('taxonomy_vocabulary'); $options = array(); foreach ($vocabularies as $vocabulary) { - $options[$vocabulary->id()] = $vocabulary->name; + $options[$vocabulary->id()] = $vocabulary->getName(); } $element = array(); diff --git a/core/modules/taxonomy/src/TermForm.php b/core/modules/taxonomy/src/TermForm.php index fa2443e..4b7cfcf 100644 --- a/core/modules/taxonomy/src/TermForm.php +++ b/core/modules/taxonomy/src/TermForm.php @@ -40,7 +40,7 @@ public function form(array $form, FormStateInterface $form_state) { $form['relations'] = array( '#type' => 'details', '#title' => $this->t('Relations'), - '#open' => $vocabulary->hierarchy == TAXONOMY_HIERARCHY_MULTIPLE, + '#open' => $vocabulary->getHierarchy() == TAXONOMY_HIERARCHY_MULTIPLE, '#weight' => 10, ); diff --git a/core/modules/taxonomy/src/Tests/TermTest.php b/core/modules/taxonomy/src/Tests/TermTest.php index 8886654..c4a3118 100644 --- a/core/modules/taxonomy/src/Tests/TermTest.php +++ b/core/modules/taxonomy/src/Tests/TermTest.php @@ -70,7 +70,7 @@ function testTaxonomyTermHierarchy() { // Check that hierarchy is flat. $vocabulary = entity_load('taxonomy_vocabulary', $this->vocabulary->id()); - $this->assertEqual(0, $vocabulary->hierarchy, 'Vocabulary is flat.'); + $this->assertEqual(0, $vocabulary->getHierarchy(), 'Vocabulary is flat.'); // Edit $term2, setting $term1 as parent. $edit = array(); diff --git a/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php b/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php index f63325f..0db6fcc 100644 --- a/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php +++ b/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php @@ -75,13 +75,13 @@ function testTaxonomyVocabularyLoadStaticReset() { // Change the name and description. $vocabulary = $original_vocabulary; - $vocabulary->name = $this->randomMachineName(); - $vocabulary->description = $this->randomMachineName(); + $vocabulary->setName($this->randomMachineName()); + $vocabulary->setDescription($this->randomMachineName()); $vocabulary->save(); // Load the vocabulary. $new_vocabulary = entity_load('taxonomy_vocabulary', $original_vocabulary->id()); - $this->assertEqual($new_vocabulary->name, $vocabulary->name, 'The vocabulary was loaded.'); + $this->assertEqual($new_vocabulary->getName(), $vocabulary->getName(), 'The vocabulary was loaded.'); // Delete the vocabulary. $this->vocabulary->delete(); @@ -101,13 +101,13 @@ function testTaxonomyVocabularyLoadMultiple() { // Create some vocabularies and assign weights. $vocabulary1 = $this->createVocabulary(); - $vocabulary1->weight = 0; + $vocabulary1->setWeight(0); $vocabulary1->save(); $vocabulary2 = $this->createVocabulary(); - $vocabulary2->weight = 1; + $vocabulary2->setWeight(1); $vocabulary2->save(); $vocabulary3 = $this->createVocabulary(); - $vocabulary3->weight = 2; + $vocabulary3->setWeight(2); $vocabulary3->save(); // Fetch the names for all vocabularies, confirm that they are keyed by @@ -130,7 +130,7 @@ function testTaxonomyVocabularyLoadMultiple() { // Fetch vocabulary 2 by name and ID. $vocabulary = current($controller->loadByProperties(array( - 'name' => $vocabulary2->name, + 'name' => $vocabulary2->getName(), 'vid' => $vocabulary2->id(), ))); $this->assertEqual($vocabulary->id(), $vocabulary2->id(), 'Vocabulary loaded successfully by name and ID.'); diff --git a/core/modules/taxonomy/src/Tests/VocabularyUiTest.php b/core/modules/taxonomy/src/Tests/VocabularyUiTest.php index b920d8e..8e08fdc 100644 --- a/core/modules/taxonomy/src/Tests/VocabularyUiTest.php +++ b/core/modules/taxonomy/src/Tests/VocabularyUiTest.php @@ -82,8 +82,8 @@ function testTaxonomyAdminChangingWeights() { $vocabularies = entity_load_multiple('taxonomy_vocabulary'); $edit = array(); foreach ($vocabularies as $key => $vocabulary) { - $weight = -$vocabulary->weight; - $vocabularies[$key]->weight = $weight; + $weight = -$vocabulary->getWeight(); + $vocabularies[$key]->setWeight($weight); $edit['vocabularies[' . $key . '][weight]'] = $weight; } // Saving the new weights via the interface. @@ -136,12 +136,12 @@ function testTaxonomyAdminDeletingVocabulary() { // Delete the vocabulary. $this->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary->id()); $this->clickLink(t('Delete')); - $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', array('%name' => $vocabulary->name)), '[confirm deletion] Asks for confirmation.'); + $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', array('%name' => $vocabulary->getName())), '[confirm deletion] Asks for confirmation.'); $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), '[confirm deletion] Inform that all terms will be deleted.'); // Confirm deletion. $this->drupalPostForm(NULL, NULL, t('Delete')); - $this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), 'Vocabulary deleted.'); + $this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->getName())), 'Vocabulary deleted.'); $this->container->get('entity.manager')->getStorage('taxonomy_vocabulary')->resetCache(); $this->assertFalse(entity_load('taxonomy_vocabulary', $vid), 'Vocabulary not found.'); } diff --git a/core/modules/taxonomy/src/VocabularyForm.php b/core/modules/taxonomy/src/VocabularyForm.php index 3a8a8b3..61b017f 100644 --- a/core/modules/taxonomy/src/VocabularyForm.php +++ b/core/modules/taxonomy/src/VocabularyForm.php @@ -32,7 +32,7 @@ public function form(array $form, FormStateInterface $form_state) { $form['name'] = array( '#type' => 'textfield', '#title' => $this->t('Name'), - '#default_value' => $vocabulary->name, + '#default_value' => $vocabulary->getName(), '#maxlength' => 255, '#required' => TRUE, ); @@ -48,7 +48,7 @@ public function form(array $form, FormStateInterface $form_state) { $form['description'] = array( '#type' => 'textfield', '#title' => $this->t('Description'), - '#default_value' => $vocabulary->description, + '#default_value' => $vocabulary->getDescription(), ); // $form['langcode'] is not wrapped in an @@ -135,20 +135,20 @@ public function save(array $form, FormStateInterface $form_state) { $vocabulary = $this->entity; // Prevent leading and trailing spaces in vocabulary names. - $vocabulary->name = trim($vocabulary->name); + $vocabulary->setName(trim($vocabulary->getName())); $status = $vocabulary->save(); $edit_link = \Drupal::linkGenerator()->generateFromUrl($this->t('Edit'), $this->entity->urlInfo()); switch ($status) { case SAVED_NEW: - drupal_set_message($this->t('Created new vocabulary %name.', array('%name' => $vocabulary->name))); - $this->logger('taxonomy')->notice('Created new vocabulary %name.', array('%name' => $vocabulary->name, 'link' => $edit_link)); + drupal_set_message($this->t('Created new vocabulary %name.', array('%name' => $vocabulary->getName()))); + $this->logger('taxonomy')->notice('Created new vocabulary %name.', array('%name' => $vocabulary->getName(), 'link' => $edit_link)); $form_state->setRedirectUrl($vocabulary->urlInfo('overview-form')); break; case SAVED_UPDATED: - drupal_set_message($this->t('Updated vocabulary %name.', array('%name' => $vocabulary->name))); - $this->logger('taxonomy')->notice('Updated vocabulary %name.', array('%name' => $vocabulary->name, 'link' => $edit_link)); + drupal_set_message($this->t('Updated vocabulary %name.', array('%name' => $vocabulary->getName()))); + $this->logger('taxonomy')->notice('Updated vocabulary %name.', array('%name' => $vocabulary->getName(), 'link' => $edit_link)); $form_state->setRedirect('taxonomy.vocabulary_list'); break; } diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index a35d292..d0a49a1 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -81,13 +81,13 @@ function taxonomy_help($route_name, RouteMatchInterface $route_match) { case 'taxonomy.overview_terms': $vocabulary = $route_match->getParameter('taxonomy_vocabulary'); - switch ($vocabulary->hierarchy) { + switch ($vocabulary->getHierarchy()) { case TAXONOMY_HIERARCHY_DISABLED: - return '
' . t('You can reorganize the terms in %capital_name using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name)) . '
'; + return '' . t('You can reorganize the terms in %capital_name using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent.', array('%capital_name' => drupal_ucfirst($vocabulary->getName()), '%name' => $vocabulary->getName())) . '
'; case TAXONOMY_HIERARCHY_SINGLE: - return '' . t('%capital_name contains terms grouped under parent terms. You can reorganize the terms in %capital_name using their drag-and-drop handles.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name)) . '
'; + return '' . t('%capital_name contains terms grouped under parent terms. You can reorganize the terms in %capital_name using their drag-and-drop handles.', array('%capital_name' => drupal_ucfirst($vocabulary->getName()), '%name' => $vocabulary->getName())) . '
'; case TAXONOMY_HIERARCHY_MULTIPLE: - return '' . t('%capital_name contains terms with multiple parents. Drag and drop of terms with multiple parents 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))) . '
'; + return '' . t('%capital_name contains terms with multiple parents. Drag and drop of terms with multiple parents 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->getName()))) . '
'; } } } @@ -104,12 +104,12 @@ function taxonomy_permission() { foreach (entity_load_multiple('taxonomy_vocabulary') as $vocabulary) { $permissions += array( 'edit terms in ' . $vocabulary->id() => array( - 'title' => t('Edit terms in %vocabulary', array('%vocabulary' => $vocabulary->name)), + 'title' => t('Edit terms in %vocabulary', array('%vocabulary' => $vocabulary->getName())), ), ); $permissions += array( 'delete terms in ' . $vocabulary->id() => array( - 'title' => t('Delete terms from %vocabulary', array('%vocabulary' => $vocabulary->name)), + 'title' => t('Delete terms from %vocabulary', array('%vocabulary' => $vocabulary->getName())), ), ); } diff --git a/core/modules/taxonomy/taxonomy.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc index aa1505c..8d00fcc 100644 --- a/core/modules/taxonomy/taxonomy.tokens.inc +++ b/core/modules/taxonomy/taxonomy.tokens.inc @@ -128,7 +128,7 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options = case 'vocabulary': $vocabulary = entity_load('taxonomy_vocabulary', $term->bundle()); - $replacements[$original] = String::checkPlain($vocabulary->name); + $replacements[$original] = String::checkPlain($vocabulary->getName()); break; case 'parent': @@ -161,11 +161,11 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options = break; case 'name': - $replacements[$original] = $sanitize ? String::checkPlain($vocabulary->name) : $vocabulary->name; + $replacements[$original] = $sanitize ? String::checkPlain($vocabulary->getName()) : $vocabulary->getName(); break; case 'description': - $replacements[$original] = $sanitize ? Xss::filter($vocabulary->description) : $vocabulary->description; + $replacements[$original] = $sanitize ? Xss::filter($vocabulary->getDescription()) : $vocabulary->getDescription(); break; case 'term-count':