From 17da7bb3a685f1305b827ef250b365bbf64cad28 Mon Sep 17 00:00:00 2001
From: Florian Weber <florian@webflo.org>
Date: Mon, 11 Jun 2012 19:04:17 +0200
Subject: [PATCH] Issue #1616972 by pfrenssen, webflo | fago: Replace
 $term->name with $term->label().

---
 core/modules/field/modules/options/options.api.php |    4 +-
 core/modules/forum/forum-list.tpl.php              |    2 +-
 core/modules/forum/forum.admin.inc                 |   10 ++--
 core/modules/forum/forum.module                    |   12 ++---
 core/modules/rdf/rdf.module                        |    2 +-
 core/modules/rdf/rdf.test                          |    2 +-
 core/modules/system/tests/menu.test                |    4 +-
 .../lib/Drupal/taxonomy/TermStorageController.php  |    2 +-
 core/modules/taxonomy/taxonomy.admin.inc           |   24 ++++-----
 core/modules/taxonomy/taxonomy.module              |   22 ++++----
 core/modules/taxonomy/taxonomy.pages.inc           |    8 +--
 core/modules/taxonomy/taxonomy.test                |   54 ++++++++++----------
 12 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/core/modules/field/modules/options/options.api.php b/core/modules/field/modules/options/options.api.php
index ce2ec62..d622137 100644
--- a/core/modules/field/modules/options/options.api.php
+++ b/core/modules/field/modules/options/options.api.php
@@ -61,10 +61,10 @@ function hook_options_list($field, $instance, $entity_type, $entity) {
   // on properties of the field. Example from taxonomy.module:
   $options = array();
   foreach ($field['settings']['allowed_values'] as $tree) {
-    $terms = taxonomy_get_tree($tree['vid'], $tree['parent']);
+    $terms = taxonomy_get_tree($tree['vid'], $tree['parent'], NULL, TRUE);
     if ($terms) {
       foreach ($terms as $term) {
-        $options[$term->tid] = str_repeat('-', $term->depth) . $term->name;
+        $options[$term->tid] = str_repeat('-', $term->depth) . $term->label();
       }
     }
   }
diff --git a/core/modules/forum/forum-list.tpl.php b/core/modules/forum/forum-list.tpl.php
index 257cea9..519e103 100644
--- a/core/modules/forum/forum-list.tpl.php
+++ b/core/modules/forum/forum-list.tpl.php
@@ -53,7 +53,7 @@
           <div class="icon forum-status-<?php print $forum->icon_class; ?>" title="<?php print $forum->icon_title; ?>">
             <span class="element-invisible"><?php print $forum->icon_title; ?></span>
           </div>
-          <div class="name"><a href="<?php print $forum->link; ?>"><?php print $forum->name; ?></a></div>
+          <div class="name"><a href="<?php print $forum->link; ?>"><?php print $forum->label(); ?></a></div>
           <?php if ($forum->description): ?>
             <div class="description"><?php print $forum->description; ?></div>
           <?php endif; ?>
diff --git a/core/modules/forum/forum.admin.inc b/core/modules/forum/forum.admin.inc
index 5fd396f..8f8fd84 100644
--- a/core/modules/forum/forum.admin.inc
+++ b/core/modules/forum/forum.admin.inc
@@ -186,9 +186,9 @@ function forum_confirm_delete($form, &$form_state, $tid) {
   $term = taxonomy_term_load($tid);
 
   $form['tid'] = array('#type' => 'value', '#value' => $tid);
-  $form['name'] = array('#type' => 'value', '#value' => $term->name);
+  $form['name'] = array('#type' => 'value', '#value' => $term->label());
 
-  return confirm_form($form, t('Are you sure you want to delete the forum %name?', array('%name' => $term->name)), 'admin/structure/forum', t('Deleting a forum or container will also delete its sub-forums, if any. To delete posts in this forum, visit <a href="@content">content administration</a> first. This action cannot be undone.', array('@content' => url('admin/content'))), t('Delete'), t('Cancel'));
+  return confirm_form($form, t('Are you sure you want to delete the forum %name?', array('%name' => $term->label())), 'admin/structure/forum', t('Deleting a forum or container will also delete its sub-forums, if any. To delete posts in this forum, visit <a href="@content">content administration</a> first. This action cannot be undone.', array('@content' => url('admin/content'))), t('Delete'), t('Cancel'));
 }
 
 /**
@@ -288,7 +288,7 @@ function _forum_parent_select($tid, $title, $child_type) {
   }
 
   $vid = variable_get('forum_nav_vocabulary', '');
-  $children = taxonomy_get_tree($vid, $tid);
+  $children = taxonomy_get_tree($vid, $tid, NULL, TRUE);
 
   // A term can't be the child of itself, nor of its children.
   foreach ($children as $child) {
@@ -296,12 +296,12 @@ function _forum_parent_select($tid, $title, $child_type) {
   }
   $exclude[] = $tid;
 
-  $tree = taxonomy_get_tree($vid);
+  $tree = taxonomy_get_tree($vid, 0, NULL, TRUE);
   $options[0] = '<' . t('root') . '>';
   if ($tree) {
     foreach ($tree as $term) {
       if (!in_array($term->tid, $exclude)) {
-        $options[$term->tid] = str_repeat(' -- ', $term->depth) . $term->name;
+        $options[$term->tid] = str_repeat(' -- ', $term->depth) . $term->label();
       }
     }
   }
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 2f17042..07d9b0d 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -274,7 +274,7 @@ function forum_node_view(Node $node, $view_mode) {
       if ($parents = taxonomy_term_load_parents_all($node->forum_tid)) {
         $parents = array_reverse($parents);
         foreach ($parents as $parent) {
-          $breadcrumb[] = l($parent->name, 'forum/' . $parent->tid);
+          $breadcrumb[] = l($parent->label(), 'forum/' . $parent->tid);
         }
       }
       drupal_set_breadcrumb($breadcrumb);
@@ -312,7 +312,7 @@ function forum_node_validate(Node $node, $form) {
           ':vid' => $term->vid,
         ))->fetchField();
         if ($used && in_array($term->tid, $containers)) {
-          form_set_error('taxonomy_forums', t('The item %forum is a forum container, not a forum. Select one of the forums below instead.', array('%forum' => $term->name)));
+          form_set_error('taxonomy_forums', t('The item %forum is a forum container, not a forum. Select one of the forums below instead.', array('%forum' => $term->label())));
         }
       }
     }
@@ -791,7 +791,7 @@ function forum_forum_load($tid = NULL) {
 
   // Load the tree below.
   $forums = array();
-  $_forums = taxonomy_get_tree($vid, $tid);
+  $_forums = taxonomy_get_tree($vid, $tid, 0, TRUE);
 
   if (count($_forums)) {
     $query = db_select('node', 'n');
@@ -1033,10 +1033,10 @@ function template_preprocess_forums(&$variables) {
     $variables['parents'] = array_reverse($variables['parents']);
     foreach ($variables['parents'] as $p) {
       if ($p->tid == $variables['tid']) {
-        $title = $p->name;
+        $title = $p->label();
       }
       else {
-        $breadcrumb[] = l($p->name, 'forum/' . $p->tid);
+        $breadcrumb[] = l($p->label(), 'forum/' . $p->tid);
       }
     }
   }
@@ -1101,7 +1101,7 @@ function template_preprocess_forum_list(&$variables) {
   foreach ($variables['forums'] as $id => $forum) {
     $variables['forums'][$id]->description = !empty($forum->description) ? filter_xss_admin($forum->description) : '';
     $variables['forums'][$id]->link = url("forum/$forum->tid");
-    $variables['forums'][$id]->name = check_plain($forum->name);
+    $variables['forums'][$id]->name = check_plain($forum->label());
     $variables['forums'][$id]->is_container = !empty($forum->container);
     $variables['forums'][$id]->zebra = $row % 2 == 0 ? 'odd' : 'even';
     $row++;
diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index 43ee4ed..7bbe04c 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -745,7 +745,7 @@ function rdf_preprocess_taxonomy_term(&$variables) {
         'about' => url('taxonomy/term/' . $term->tid),
         'typeof' => $term->rdf_mapping['rdftype'],
         'property' => $term->rdf_mapping['name']['predicates'],
-        'content' => $term->name,
+        'content' => $term->label(),
       ),
     );
   drupal_add_html_head($term_label_meta, 'rdf_term_label');
diff --git a/core/modules/rdf/rdf.test b/core/modules/rdf/rdf.test
index 564408e..2d052de 100644
--- a/core/modules/rdf/rdf.test
+++ b/core/modules/rdf/rdf.test
@@ -408,7 +408,7 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
     // Views the term and checks that the RDFa markup is correct.
     $this->drupalGet('taxonomy/term/' . $term->tid);
     $term_url = url('taxonomy/term/' . $term->tid);
-    $term_name = $term->name;
+    $term_name = $term->label();
     $term_rdfa_meta = $this->xpath('//meta[@typeof="skos:Concept" and @about=:term-url and contains(@property, "rdfs:label") and contains(@property, "skos:prefLabel") and @content=:term-name]', array(
       ':term-url' => $term_url,
       ':term-name' => $term_name,
diff --git a/core/modules/system/tests/menu.test b/core/modules/system/tests/menu.test
index dbd94a1..4297f1e 100644
--- a/core/modules/system/tests/menu.test
+++ b/core/modules/system/tests/menu.test
@@ -1362,7 +1362,7 @@ class MenuBreadcrumbTestCase extends MenuWebTestCase {
       $tree += array(
         $link['link_path'] => $link['link_title'],
       );
-      $this->assertBreadcrumb($link['link_path'], $trail, $term->name, $tree);
+      $this->assertBreadcrumb($link['link_path'], $trail, $term->label(), $tree);
       $this->assertRaw(check_plain($parent->title), 'Tagged node found.');
 
       // Additionally make sure that this link appears only once; i.e., the
@@ -1378,7 +1378,7 @@ class MenuBreadcrumbTestCase extends MenuWebTestCase {
       // Next iteration should expect this tag as parent link.
       // Note: Term name, not link name, due to taxonomy_term_page().
       $trail += array(
-        $link['link_path'] => $term->name,
+        $link['link_path'] => $term->label(),
       );
     }
 
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
index 7dedd10..b47ac6c 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
@@ -70,7 +70,7 @@ class TermStorageController extends DatabaseStorageController {
     // Name matching is case insensitive, note that with some collations
     // LOWER() and drupal_strtolower() may return different results.
     foreach ($terms as $term) {
-      if (isset($conditions['name']) && drupal_strtolower($conditions['name'] != drupal_strtolower($term->name))) {
+      if (isset($conditions['name']) && drupal_strtolower($conditions['name'] != drupal_strtolower($term->label()))) {
         unset($terms[$term->tid]);
       }
     }
diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc
index db83d84..db69c46 100644
--- a/core/modules/taxonomy/taxonomy.admin.inc
+++ b/core/modules/taxonomy/taxonomy.admin.inc
@@ -281,7 +281,7 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $vocabulary) {
 
   $delta = 0;
   $term_deltas = array();
-  $tree = taxonomy_get_tree($vocabulary->vid);
+  $tree = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE);
   $term = current($tree);
   do {
     // In case this tree is completely empty.
@@ -372,7 +372,7 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $vocabulary) {
       unset($form[$key]['#term']['parents'], $term->parents);
     }
 
-    $form[$key]['view'] = array('#type' => 'link', '#title' => $term->name, '#href' => "taxonomy/term/$term->tid");
+    $form[$key]['view'] = array('#type' => 'link', '#title' => $term->label(), '#href' => "taxonomy/term/$term->tid");
     if ($vocabulary->hierarchy != TAXONOMY_HIERARCHY_MULTIPLE && count($tree) > 1) {
       $form['#parent_fields'] = TRUE;
       $form[$key]['tid'] = array(
@@ -692,7 +692,7 @@ function taxonomy_form_term($form, &$form_state, Term $term = NULL, Vocabulary $
   $form['name'] = array(
     '#type' => 'textfield',
     '#title' => t('Name'),
-    '#default_value' => $term->name,
+    '#default_value' => $term->label(),
     '#maxlength' => 255,
     '#required' => TRUE,
     '#weight' => -5,
@@ -734,14 +734,14 @@ function taxonomy_form_term($form, &$form_state, Term $term = NULL, Vocabulary $
     }
     $exclude[] = $term->tid;
 
-    $tree = taxonomy_get_tree($vocabulary->vid);
+    $tree = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE);
     $options = array('<' . t('root') . '>');
     if (empty($parent)) {
       $parent = array(0);
     }
     foreach ($tree as $item) {
       if (!in_array($item->tid, $exclude)) {
-        $options[$item->tid] = str_repeat('-', $item->depth) . $item->name;
+        $options[$item->tid] = str_repeat('-', $item->depth) . $item->label();
       }
     }
     $form['relations']['parent'] = array(
@@ -818,12 +818,12 @@ function taxonomy_form_term_submit($form, &$form_state) {
   $status = taxonomy_term_save($term);
   switch ($status) {
     case SAVED_NEW:
-      drupal_set_message(t('Created new term %term.', array('%term' => $term->name)));
-      watchdog('taxonomy', 'Created new term %term.', array('%term' => $term->name), WATCHDOG_NOTICE, l(t('edit'), 'taxonomy/term/' . $term->tid . '/edit'));
+      drupal_set_message(t('Created new term %term.', array('%term' => $term->label())));
+      watchdog('taxonomy', 'Created new term %term.', array('%term' => $term->label()), WATCHDOG_NOTICE, l(t('edit'), 'taxonomy/term/' . $term->tid . '/edit'));
       break;
     case SAVED_UPDATED:
-      drupal_set_message(t('Updated term %term.', array('%term' => $term->name)));
-      watchdog('taxonomy', 'Updated term %term.', array('%term' => $term->name), WATCHDOG_NOTICE, l(t('edit'), 'taxonomy/term/' . $term->tid . '/edit'));
+      drupal_set_message(t('Updated term %term.', array('%term' => $term->label())));
+      watchdog('taxonomy', 'Updated term %term.', array('%term' => $term->label()), WATCHDOG_NOTICE, l(t('edit'), 'taxonomy/term/' . $term->tid . '/edit'));
       // Clear the page and block caches to avoid stale data.
       cache_clear_all();
       break;
@@ -861,7 +861,7 @@ function taxonomy_form_term_submit_build_taxonomy_term($form, &$form_state) {
   entity_form_submit_build_entity('taxonomy_term', $term, $form, $form_state);
 
   // Prevent leading and trailing spaces in term names.
-  $term->name = trim($term->name);
+  $term->name = trim($term->label());
 
   // Convert text_format field into values expected by taxonomy_term_save().
   $description = $form_state['values']['description'];
@@ -899,12 +899,12 @@ function taxonomy_term_confirm_delete($form, &$form_state, $term) {
   $form['#term'] = $term;
   $form['#vocabulary'] = taxonomy_vocabulary_load($term->vid);;
   $form['type'] = array('#type' => 'value', '#value' => 'term');
-  $form['name'] = array('#type' => 'value', '#value' => $term->name);
+  $form['name'] = array('#type' => 'value', '#value' => $term->label());
   $form['vocabulary_machine_name'] = array('#type' => 'value', '#value' => $term->vocabulary_machine_name);
   $form['delete'] = array('#type' => 'value', '#value' => TRUE);
   return confirm_form($form,
     t('Are you sure you want to delete the term %title?',
-    array('%title' => $term->name)),
+    array('%title' => $term->label())),
     'admin/structure/taxonomy',
     t('Deleting a term will delete all its children if there are any. This action cannot be undone.'),
     t('Delete'),
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 30eba40..837ccc6 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -628,7 +628,7 @@ function template_preprocess_taxonomy_term(&$variables) {
 
   $uri = entity_uri('taxonomy_term', $term);
   $variables['term_url']  = url($uri['path'], $uri['options']);
-  $variables['term_name'] = check_plain($term->name);
+  $variables['term_name'] = check_plain($term->label());
   $variables['page']      = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term);
 
   // Flatten the term object's member fields.
@@ -1052,13 +1052,13 @@ function taxonomy_implode_tags($tags, $vid = NULL) {
     // Extract terms belonging to the vocabulary in question.
     if (!isset($vid) || $tag->vid == $vid) {
       // Make sure we have a completed loaded taxonomy term.
-      if (isset($tag->name)) {
+      if (isset($tag->tid) && $label = $tag->label()) {
         // Commas and quotes in tag names are special cases, so encode 'em.
-        if (strpos($tag->name, ',') !== FALSE || strpos($tag->name, '"') !== FALSE) {
-          $typed_tags[] = '"' . str_replace('"', '""', $tag->name) . '"';
+        if (strpos($label, ',') !== FALSE || strpos($label, '"') !== FALSE) {
+          $typed_tags[] = '"' . str_replace('"', '""', $label) . '"';
         }
         else {
-          $typed_tags[] = $tag->name;
+          $typed_tags[] = $label;
         }
       }
     }
@@ -1243,7 +1243,7 @@ function taxonomy_field_formatter_view($entity_type, $entity, $field, $instance,
           $uri = entity_uri('taxonomy_term', $term);
           $element[$delta] = array(
             '#type' => 'link',
-            '#title' => $term->name,
+            '#title' => $term->label(),
             '#href' => $uri['path'],
             '#options' => $uri['options'],
           );
@@ -1253,7 +1253,7 @@ function taxonomy_field_formatter_view($entity_type, $entity, $field, $instance,
 
     case 'taxonomy_term_reference_plain':
       foreach ($items as $delta => $item) {
-        $name = ($item['tid'] != 'autocreate' ? $item['taxonomy_term']->name : $item['name']);
+        $name = ($item['tid'] != 'autocreate' ? $item['taxonomy_term']->label() : $item['name']);
         $element[$delta] = array(
           '#markup' => check_plain($name),
         );
@@ -1264,7 +1264,7 @@ function taxonomy_field_formatter_view($entity_type, $entity, $field, $instance,
       foreach ($items as $delta => $item) {
         $entity->rss_elements[] = array(
           'key' => 'category',
-          'value' => $item['tid'] != 'autocreate' ? $item['taxonomy_term']->name : $item['name'],
+          'value' => $item['tid'] != 'autocreate' ? $item['taxonomy_term']->label() : $item['name'],
           'attributes' => array(
             'domain' => $item['tid'] != 'autocreate' ? url('taxonomy/term/' . $item['tid'], array('absolute' => TRUE)) : '',
           ),
@@ -1288,9 +1288,9 @@ function taxonomy_allowed_values($field) {
   $options = array();
   foreach ($field['settings']['allowed_values'] as $tree) {
     if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
-      if ($terms = taxonomy_get_tree($vocabulary->vid, $tree['parent'])) {
+      if ($terms = taxonomy_get_tree($vocabulary->vid, $tree['parent'], NULL, TRUE)) {
         foreach ($terms as $term) {
-          $options[$term->tid] = str_repeat('-', $term->depth) . $term->name;
+          $options[$term->tid] = str_repeat('-', $term->depth) . $term->label();
         }
       }
     }
@@ -1358,7 +1358,7 @@ function taxonomy_field_formatter_prepare_view($entity_type, $entities, $field,
  *   The term name to be used as the page title.
  */
 function taxonomy_term_title(Term $term) {
-  return $term->name;
+  return $term->label();
 }
 
 /**
diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc
index c84a6bd..74152c0 100644
--- a/core/modules/taxonomy/taxonomy.pages.inc
+++ b/core/modules/taxonomy/taxonomy.pages.inc
@@ -16,7 +16,7 @@ use Drupal\taxonomy\Vocabulary;
  */
 function taxonomy_term_page(Term $term) {
   // Assign the term name as the page title.
-  drupal_set_title($term->name);
+  drupal_set_title($term->label());
 
   // Build breadcrumb based on the hierarchy of the term.
   $current = (object) array(
@@ -27,12 +27,12 @@ function taxonomy_term_page(Term $term) {
   $breadcrumb = array();
   while ($parents = taxonomy_term_load_parents($current->tid)) {
     $current = array_shift($parents);
-    $breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid);
+    $breadcrumb[] = l($current->label(), 'taxonomy/term/' . $current->tid);
   }
   $breadcrumb[] = l(t('Home'), NULL);
   $breadcrumb = array_reverse($breadcrumb);
   drupal_set_breadcrumb($breadcrumb);
-  drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name);
+  drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->label());
 
   $build = array();
 
@@ -68,7 +68,7 @@ function taxonomy_term_page(Term $term) {
  */
 function taxonomy_term_feed(Term $term) {
   $channel['link'] = url('taxonomy/term/' . $term->tid, array('absolute' => TRUE));
-  $channel['title'] = variable_get('site_name', 'Drupal') . ' - ' . $term->name;
+  $channel['title'] = variable_get('site_name', 'Drupal') . ' - ' . $term->label();
   // Only display the description if we have a single term, to avoid clutter and confusion.
   // HTML will be removed from feed description.
   $channel['description'] = check_markup($term->description, $term->format, '', TRUE);
diff --git a/core/modules/taxonomy/taxonomy.test b/core/modules/taxonomy/taxonomy.test
index c7e87e8..adebf4f 100644
--- a/core/modules/taxonomy/taxonomy.test
+++ b/core/modules/taxonomy/taxonomy.test
@@ -643,20 +643,20 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
     // Check that the term is displayed when the node is viewed.
     $node = $this->drupalGetNodeByTitle($edit["title"]);
     $this->drupalGet('node/' . $node->nid);
-    $this->assertText($term1->name, 'Term is displayed when viewing the node.');
+    $this->assertText($term1->label(), 'Term is displayed when viewing the node.');
 
     // Edit the node with a different term.
     $edit[$this->instance['field_name'] . '[' . $langcode . '][]'] = $term2->tid;
     $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
 
     $this->drupalGet('node/' . $node->nid);
-    $this->assertText($term2->name, 'Term is displayed when viewing the node.');
+    $this->assertText($term2->label(), 'Term is displayed when viewing the node.');
 
     // Preview the node.
     $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Preview'));
-    $this->assertNoUniqueText($term2->name, 'Term is displayed when previewing the node.');
+    $this->assertNoUniqueText($term2->label(), 'Term is displayed when previewing the node.');
     $this->drupalPost(NULL, NULL, t('Preview'));
-    $this->assertNoUniqueText($term2->name, 'Term is displayed when previewing the node again.');
+    $this->assertNoUniqueText($term2->label(), 'Term is displayed when previewing the node again.');
   }
 
   /**
@@ -713,29 +713,29 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
 
     // Delete term 2 from the term delete page.
     $this->drupalPost('taxonomy/term/' . $term_objects['term2']->tid . '/delete', array(), t('Delete'));
-    $term_names = array($term_objects['term3']->name, $term_objects['term4']->name);
+    $term_names = array($term_objects['term3']->label(), $term_objects['term4']->label());
 
     // Get the node.
     $node = $this->drupalGetNodeByTitle($edit["title"]);
     $this->drupalGet('node/' . $node->nid);
 
     foreach ($term_names as $term_name) {
-      $this->assertText($term_name, format_string('The term %name appears on the node page after two terms, %deleted1 and %deleted2, were deleted', array('%name' => $term_name, '%deleted1' => $term_objects['term1']->name, '%deleted2' => $term_objects['term2']->name)));
+      $this->assertText($term_name, format_string('The term %name appears on the node page after two terms, %deleted1 and %deleted2, were deleted', array('%name' => $term_name, '%deleted1' => $term_objects['term1']->label(), '%deleted2' => $term_objects['term2']->label())));
     }
-    $this->assertNoText($term_objects['term1']->name, format_string('The deleted term %name does not appear on the node page.', array('%name' => $term_objects['term1']->name)));
-    $this->assertNoText($term_objects['term2']->name, format_string('The deleted term %name does not appear on the node page.', array('%name' => $term_objects['term2']->name)));
+    $this->assertNoText($term_objects['term1']->label(), format_string('The deleted term %name does not appear on the node page.', array('%name' => $term_objects['term1']->label())));
+    $this->assertNoText($term_objects['term2']->label(), format_string('The deleted term %name does not appear on the node page.', array('%name' => $term_objects['term2']->label())));
 
     // Test autocomplete on term 3, which contains a comma.
     // The term will be quoted, and the " will be encoded in unicode (\u0022).
-    $input = substr($term_objects['term3']->name, 0, 3);
+    $input = substr($term_objects['term3']->label(), 0, 3);
     $this->drupalGet('taxonomy/autocomplete/taxonomy_' . $this->vocabulary->machine_name . '/' . $input);
-    $this->assertRaw('{"\u0022' . $term_objects['term3']->name . '\u0022":"' . $term_objects['term3']->name . '"}', format_string('Autocomplete returns term %term_name after typing the first 3 letters.', array('%term_name' => $term_objects['term3']->name)));
+    $this->assertRaw('{"\u0022' . $term_objects['term3']->label() . '\u0022":"' . $term_objects['term3']->label() . '"}', format_string('Autocomplete returns term %term_name after typing the first 3 letters.', array('%term_name' => $term_objects['term3']->label())));
 
     // Test autocomplete on term 4 - it is alphanumeric only, so no extra
     // quoting.
-    $input = substr($term_objects['term4']->name, 0, 3);
+    $input = substr($term_objects['term4']->label(), 0, 3);
     $this->drupalGet('taxonomy/autocomplete/taxonomy_' . $this->vocabulary->machine_name . '/' . $input);
-    $this->assertRaw('{"' . $term_objects['term4']->name . '":"' . $term_objects['term4']->name . '"}', format_string('Autocomplete returns term %term_name after typing the first 3 letters.', array('%term_name' => $term_objects['term4']->name)));
+    $this->assertRaw('{"' . $term_objects['term4']->label() . '":"' . $term_objects['term4']->label() . '"}', format_string('Autocomplete returns term %term_name after typing the first 3 letters.', array('%term_name' => $term_objects['term4']->label())));
 
     // Test taxonomy autocomplete with a nonexistent field.
     $field_name = $this->randomName();
@@ -771,8 +771,8 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
     // The result order is not guaranteed, so check each term separately.
     $result = $this->drupalGet($path);
     $data = drupal_json_decode($result);
-    $this->assertEqual($data[$first_term->name], check_plain($first_term->name), 'Autocomplete returned the first matching term');
-    $this->assertEqual($data[$second_term->name], check_plain($second_term->name), 'Autocomplete returned the second matching term');
+    $this->assertEqual($data[$first_term->label()], check_plain($first_term->label()), 'Autocomplete returned the first matching term');
+    $this->assertEqual($data[$second_term->label()], check_plain($second_term->label()), 'Autocomplete returned the second matching term');
 
     // Try to autocomplete a term name that matches first term.
     // We should only get the first term in a json encoded string.
@@ -780,7 +780,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
     $url = 'taxonomy/autocomplete/taxonomy_';
     $url .= $this->vocabulary->machine_name . '/' . $input;
     $this->drupalGet($url);
-    $target = array($first_term->name => check_plain($first_term->name));
+    $target = array($first_term->label() => check_plain($first_term->label()));
     $this->assertRaw(drupal_json_encode($target), 'Autocomplete returns only the expected matching term.');
 
     // Try to autocomplete a term name with both a comma and a slash.
@@ -788,12 +788,12 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
     $url = 'taxonomy/autocomplete/taxonomy_';
     $url .= $this->vocabulary->machine_name . '/' . $input;
     $this->drupalGet($url);
-    $n = $third_term->name;
+    $n = $third_term->label();
     // Term names containing commas or quotes must be wrapped in quotes.
-    if (strpos($third_term->name, ',') !== FALSE || strpos($third_term->name, '"') !== FALSE) {
-      $n = '"' . str_replace('"', '""', $third_term->name) . '"';
+    if (strpos($third_term->label(), ',') !== FALSE || strpos($third_term->label(), '"') !== FALSE) {
+      $n = '"' . str_replace('"', '""', $third_term->label()) . '"';
     }
-    $target = array($n => check_plain($third_term->name));
+    $target = array($n => check_plain($third_term->label()));
     $this->assertRaw(drupal_json_encode($target), 'Autocomplete returns a term containing a comma and a slash.');
   }
 
@@ -948,7 +948,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
     $terms = taxonomy_term_load_multiple_by_name($edit['name']);
     $term = reset($terms);
     $this->assertNotNull($term, 'Term found in database.');
-    $this->assertEqual($edit['name'], $term->name, 'Term name was successfully saved.');
+    $this->assertEqual($edit['name'], $term->label(), 'Term name was successfully saved.');
     $this->assertEqual($edit['description[value]'], $term->description, 'Term description was successfully saved.');
     // Check that the parent tid is still there. The other parent (<root>) is
     // not added by taxonomy_term_load_parents().
@@ -1103,7 +1103,7 @@ class TaxonomyRSSTestCase extends TaxonomyWebTestCase {
     $this->drupalGet('rss.xml');
     $test_element = array(
       'key' => 'category',
-      'value' => $term1->name,
+      'value' => $term1->label(),
       'attributes' => array(
         'domain' => url('taxonomy/term/' . $term1->tid, array('absolute' => TRUE)),
       ),
@@ -1319,7 +1319,7 @@ class TaxonomyTermIndexTestCase extends TaxonomyWebTestCase {
 
     // Verify that the page breadcrumbs include a link to the parent term.
     $this->drupalGet('taxonomy/term/' . $term1->tid);
-    $this->assertRaw(l($term2->name, 'taxonomy/term/' . $term2->tid), 'Parent term link is displayed when viewing the node.');
+    $this->assertRaw(l($term2->label(), 'taxonomy/term/' . $term2->tid), 'Parent term link is displayed when viewing the node.');
   }
 
 }
@@ -1555,7 +1555,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
     field_attach_prepare_view('test_entity', $entities, 'full');
     $entity->content = field_attach_view('test_entity', $entity, 'full');
     $this->content = drupal_render($entity->content);
-    $this->assertText($term->name, 'Term name is displayed.');
+    $this->assertText($term->label(), 'Term name is displayed.');
 
     // Delete the vocabulary and verify that the widget is gone.
     taxonomy_vocabulary_delete($this->vocabulary->vid);
@@ -1686,8 +1686,8 @@ class TaxonomyTermFieldMultipleVocabularyTestCase extends TaxonomyWebTestCase {
     field_attach_prepare_view('test_entity', $entities, 'full');
     $entity->content = field_attach_view('test_entity', $entity, 'full');
     $this->content = drupal_render($entity->content);
-    $this->assertText($term1->name, 'Term 1 name is displayed.');
-    $this->assertText($term2->name, 'Term 2 name is displayed.');
+    $this->assertText($term1->label(), 'Term 1 name is displayed.');
+    $this->assertText($term2->label(), 'Term 2 name is displayed.');
 
     // Delete vocabulary 2.
     taxonomy_vocabulary_delete($this->vocabulary2->vid);
@@ -1701,8 +1701,8 @@ class TaxonomyTermFieldMultipleVocabularyTestCase extends TaxonomyWebTestCase {
     $this->content = drupal_render($entity->content);
 
     // Term 1 should still be displayed; term 2 should not be.
-    $this->assertText($term1->name, 'Term 1 name is displayed.');
-    $this->assertNoText($term2->name, 'Term 2 name is not displayed.');
+    $this->assertText($term1->label(), 'Term 1 name is displayed.');
+    $this->assertNoText($term2->label(), 'Term 2 name is not displayed.');
 
     // Verify that field and instance settings are correct.
     $field_info = field_info_field($this->field_name);
-- 
1.7.10.3

