diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/field/widget/TaxonomyAutocompleteWidget.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/field/widget/TaxonomyAutocompleteWidget.php index 4aeb711..87a73d2 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/field/widget/TaxonomyAutocompleteWidget.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/field/widget/TaxonomyAutocompleteWidget.php @@ -63,7 +63,7 @@ public function massageFormValues(array $values, array $form, array &$form_state // Collect candidate vocabularies. foreach ($field['settings']['allowed_values'] as $tree) { - if ($vocabulary = taxonomy_vocabulary_load($tree['vocabulary'])) { + if ($vocabulary = entity_load('taxonomy_vocabulary', $tree['vocabulary'])) { $vocabularies[$vocabulary->id()] = $vocabulary; } } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php index f479f66..9ee2920 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php @@ -26,15 +26,12 @@ class VocabularyVid extends Numeric { * Override the behavior of title(). Get the name of the vocabulary. */ function title() { - $query = db_select('taxonomy_vocabulary', 'v'); - $query->addField('v', 'name'); - $query->condition('v.vid', $this->argument); - $title = $query->execute()->fetchField(); - if (empty($title)) { - return t('No vocabulary'); + $vocabulary = entity_load('taxonomy_vocabulary', $this->argument); + if ($vocabulary) { + return check_plain($vocabulary->label()); } - return check_plain($title); + return t('No vocabulary'); } } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php index e657ea6..755e6bc 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php @@ -30,8 +30,8 @@ public function init(ViewExecutable $view, &$argument, $options) { if (!empty($this->options['vids'])) { $vocabularies = taxonomy_vocabulary_get_names(); foreach ($this->options['vids'] as $vid) { - if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) { - $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name; + if (isset($vocabularies[$vid])) { + $this->options['vocabularies'][$vid] = $vid; } } } @@ -73,9 +73,9 @@ public function buildOptionsForm(&$form, &$form_state) { ); $options = array(); - $vocabularies = taxonomy_vocabulary_get_names(); + $vocabularies = entity_load_multiple('taxonomy_vocabulary'); foreach ($vocabularies as $voc) { - $options[$voc->machine_name] = check_plain($voc->name); + $options[$voc->id()] = check_plain($voc->label()); } $form['vocabularies'] = array( diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php index 955be61..9a8402f 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php @@ -28,10 +28,10 @@ public function init(ViewExecutable $view, &$argument, $options) { // Convert legacy vids option to machine name vocabularies. if (!empty($this->options['vids'])) { - $vocabularies = taxonomy_vocabulary_get_names(); + $vocabularies = entity_load_multiple('taxonomy_vocabulary'); foreach ($this->options['vids'] as $vid) { - if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) { - $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name; + if (isset($vocabularies[$vid])) { + $this->options['vocabularies'][$vid] = $vocabularies[$vid]->label(); } } } @@ -47,10 +47,10 @@ protected function defineOptions() { } public function buildOptionsForm(&$form, &$form_state) { - $vocabularies = taxonomy_vocabulary_get_names(); + $vocabularies = entity_load_multiple('taxonomy_vocabulary'); $options = array(); foreach ($vocabularies as $voc) { - $options[$voc->machine_name] = check_plain($voc->name); + $options[$voc->id()] = check_plain($voc->label()); } $form['vocabularies'] = array( @@ -105,7 +105,7 @@ function validate_argument($argument) { return FALSE; } $this->argument->validated_title = check_plain($term->name); - return empty($vocabularies) || !empty($vocabularies[$term->vocabulary_machine_name]); + return empty($vocabularies) || !empty($vocabularies[$term->vid]); case 'tids': // An empty argument is not a term so doesn't pass. @@ -141,7 +141,7 @@ function validate_argument($argument) { if (count($test)) { $result = entity_load_multiple('taxonomy_term', $test); foreach ($result as $term) { - if ($vocabularies && empty($vocabularies[$term->vocabulary_machine_name])) { + if ($vocabularies && empty($vocabularies[$term->vid])) { $validated_cache[$term->id()] = FALSE; return FALSE; } @@ -166,7 +166,7 @@ function validate_argument($argument) { $term->name = str_replace(' ', '-', $term->name); } - if ($term && (empty($vocabularies) || !empty($vocabularies[$term->vocabulary_machine_name]))) { + if ($term && (empty($vocabularies) || !empty($vocabularies[$term->vid]))) { if ($type == 'convert') { $this->argument->argument = $term->id(); } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php index ec56116..a098bfd 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php @@ -37,10 +37,6 @@ public function init(ViewExecutable $view, &$options) { $this->additional_fields['vid'] = 'vid'; $this->additional_fields['tid'] = 'tid'; - $this->additional_fields['vocabulary_machine_name'] = array( - 'table' => 'taxonomy_vocabulary', - 'field' => 'machine_name', - ); } protected function defineOptions() { @@ -80,7 +76,6 @@ function render_link($data, $values) { $term = entity_create('taxonomy_term', array( 'tid' => $tid, 'vid' => $this->get_value($values, 'vid'), - 'vocabulary_machine_name' => $values->{$this->aliases['vocabulary_machine_name']}, )); $this->options['alter']['make_link'] = TRUE; $uri = $term->uri(); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php index 0b49698..9b8aa44 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php @@ -71,9 +71,9 @@ public function buildOptionsForm(&$form, &$form_state) { ); $options = array(); - $vocabularies = taxonomy_vocabulary_get_names(); + $vocabularies = entity_load_multiple('taxonomy_vocabulary'); foreach ($vocabularies as $voc) { - $options[$voc->machine_name] = check_plain($voc->name); + $options[$voc->id()] = $voc->label(); } $form['vocabularies'] = array( @@ -100,6 +100,7 @@ public function query() { } function pre_render(&$values) { + $vocabularies = entity_load_multiple('taxonomy_vocabulary'); $this->field_alias = $this->aliases['nid']; $nids = array(); foreach ($values as $result) { @@ -111,26 +112,26 @@ function pre_render(&$values) { if ($nids) { $query = db_select('taxonomy_term_data', 'td'); $query->innerJoin('taxonomy_index', 'tn', 'td.tid = tn.tid'); - $query->innerJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); + //$query->innerJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); $query->fields('td'); $query->addField('tn', 'nid', 'node_nid'); - $query->addField('tv', 'name', 'vocabulary'); - $query->addField('tv', 'machine_name', 'vocabulary_machine_name'); + //$query->addField('tv', 'name', 'vocabulary'); + //$query->addField('tv', 'machine_name', 'vocabulary_machine_name'); $query->orderby('td.weight'); $query->orderby('td.name'); $query->condition('tn.nid', $nids); $query->addTag('term_access'); $vocabs = array_filter($this->options['vocabularies']); if (!empty($this->options['limit']) && !empty($vocabs)) { - $query->condition('tv.machine_name', $vocabs); + $query->condition('td.vid', $vocabs); } $result = $query->execute(); foreach ($result as $term) { $this->items[$term->node_nid][$term->tid]['name'] = check_plain($term->name); $this->items[$term->node_nid][$term->tid]['tid'] = $term->tid; - $this->items[$term->node_nid][$term->tid]['vocabulary_machine_name'] = check_plain($term->vocabulary_machine_name); - $this->items[$term->node_nid][$term->tid]['vocabulary'] = check_plain($term->vocabulary); + $this->items[$term->node_nid][$term->tid]['vocabulary_machine_name'] = $term->id(); + $this->items[$term->node_nid][$term->tid]['vocabulary'] = check_plain($vocabularies[$term->vid]); if (!empty($this->options['link_to_taxonomy'])) { $this->items[$term->node_nid][$term->tid]['make_link'] = TRUE; diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php index fa8f3de..8e38c1d 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php @@ -36,8 +36,8 @@ public function init(ViewExecutable $view, &$options) { if (isset($this->options['vid']) && !empty($this->options['vid']) & empty($this->options['vocabulary'])) { $vocabularies = taxonomy_vocabulary_get_names(); $vid = $this->options['vid']; - if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) { - $this->options['vocabulary'] = $vocabularies[$vid]->machine_name; + if (isset($vocabularies[$vid])) { + $this->options['vocabulary'] = $vid; } } } @@ -59,17 +59,17 @@ protected function defineOptions() { } public function buildExtraOptionsForm(&$form, &$form_state) { - $vocabularies = taxonomy_vocabulary_get_names(); + $vocabularies = entity_load_multiple('taxonomy_vocabulary'); $options = array(); foreach ($vocabularies as $voc) { - $options[$voc->machine_name] = check_plain($voc->name); + $options[$voc->id()] = $voc->label(); } if ($this->options['limit']) { // We only do this when the form is displayed. if (empty($this->options['vocabulary'])) { $first_vocabulary = reset($vocabularies); - $this->options['vocabulary'] = $first_vocabulary->machine_name; + $this->options['vocabulary'] = $first_vocabulary->id(); } if (empty($this->definition['vocabulary'])) { @@ -103,7 +103,7 @@ public function buildExtraOptionsForm(&$form, &$form_state) { } function value_form(&$form, &$form_state) { - $vocabulary = taxonomy_vocabulary_machine_name_load($this->options['vocabulary']); + $vocabulary = entity_load('taxonomy_vocabulary', $this->options['vocabulary']); if (empty($vocabulary) && $this->options['limit']) { $form['markup'] = array( '#markup' => '
' . t('An invalid vocabulary is selected. Please change it in the options.') . '
', @@ -127,18 +127,18 @@ function value_form(&$form, &$form_state) { } $form['value'] = array( - '#title' => $this->options['limit'] ? t('Select terms from vocabulary @voc', array('@voc' => $vocabulary->name)) : t('Select terms'), + '#title' => $this->options['limit'] ? t('Select terms from vocabulary @voc', array('@voc' => $vocabulary->label())) : t('Select terms'), '#type' => 'textfield', '#default_value' => $default, ); if ($this->options['limit']) { - $form['value']['#autocomplete_path'] = 'admin/views/ajax/autocomplete/taxonomy/' . $vocabulary->vid; + $form['value']['#autocomplete_path'] = 'admin/views/ajax/autocomplete/taxonomy/' . $vocabulary->id(); } } else { if (!empty($this->options['hierarchy']) && $this->options['limit']) { - $tree = taxonomy_get_tree($vocabulary->vid); + $tree = taxonomy_get_tree($vocabulary->id()); $options = array(); if ($tree) { @@ -152,15 +152,15 @@ function value_form(&$form, &$form_state) { else { $options = array(); $query = db_select('taxonomy_term_data', 'td'); - $query->innerJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); + //$query->innerJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); $query->fields('td'); - $query->orderby('tv.weight'); - $query->orderby('tv.name'); + //$query->orderby('tv.weight'); + //$query->orderby('tv.name'); $query->orderby('td.weight'); $query->orderby('td.name'); $query->addTag('term_access'); if ($this->options['limit']) { - $query->condition('tv.machine_name', $vocabulary->machine_name); + $query->condition('td.vid', $vocabulary->id()); } $result = $query->execute(); foreach ($result as $term) { @@ -319,10 +319,9 @@ function validate_term_strings(&$form, $values) { } $query = db_select('taxonomy_term_data', 'td'); - $query->innerJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); $query->fields('td'); $query->condition('td.name', $names); - $query->condition('tv.machine_name', $this->options['vocabulary']); + $query->condition('td.vid', $this->options['vocabulary']); $query->addTag('term_access'); $result = $query->execute(); foreach ($result as $term) { diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/VocabularyVid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/VocabularyVid.php index 1264319..bfa55a2 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/VocabularyVid.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/VocabularyVid.php @@ -28,9 +28,9 @@ function get_value_options() { } $this->value_options = array(); - $vocabularies = taxonomy_vocabulary_get_names(); + $vocabularies = entity_load_multiple('taxonomy_vocabulary'); foreach ($vocabularies as $voc) { - $this->value_options[$voc->vid] = $voc->name; + $this->value_options[$voc->id()] = $voc->label(); } } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php index ab2021a..18e0b28 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php @@ -28,10 +28,10 @@ public function init(ViewExecutable $view, &$options) { // Convert legacy vids option to machine name vocabularies. if (!empty($this->options['vids'])) { - $vocabularies = taxonomy_vocabulary_get_names(); + $vocabularies = entity_load_multiple('taxonomy_vocabulary'); foreach ($this->options['vids'] as $vid) { - if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) { - $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name; + if (isset($vocabularies[$vid])) { + $this->options['vocabularies'][$vid] = $vocabularies[$vid]->label(); } } } @@ -44,10 +44,10 @@ protected function defineOptions() { } public function buildOptionsForm(&$form, &$form_state) { - $vocabularies = taxonomy_vocabulary_get_names(); + $vocabularies = entity_load_multiple('taxonomy_vocabulary'); $options = array(); foreach ($vocabularies as $voc) { - $options[$voc->machine_name] = check_plain($voc->name); + $options[$voc->id()] = $voc->label(); } $form['vocabularies'] = array( @@ -85,9 +85,9 @@ public function query() { $def['adjusted'] = TRUE; $query = db_select('taxonomy_term_data', 'td'); - $query->addJoin($def['type'], 'taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); + //$query->addJoin($def['type'], 'taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); $query->addJoin($def['type'], 'taxonomy_index', 'tn', 'tn.tid = td.tid'); - $query->condition('tv.machine_name', array_filter($this->options['vocabularies'])); + $query->condition('td.vid', array_filter($this->options['vocabularies'])); $query->addTag('term_access'); $query->fields('td'); $query->fields('tn', array('nid')); diff --git a/core/modules/taxonomy/taxonomy.views.inc b/core/modules/taxonomy/taxonomy.views.inc index e3f6e18..16f1c99 100644 --- a/core/modules/taxonomy/taxonomy.views.inc +++ b/core/modules/taxonomy/taxonomy.views.inc @@ -15,7 +15,7 @@ function taxonomy_views_data() { // taxonomy_vocabulary table - $data['taxonomy_vocabulary']['table']['group'] = t('Taxonomy vocabulary'); + /*$data['taxonomy_vocabulary']['table']['group'] = t('Taxonomy vocabulary'); $data['taxonomy_vocabulary']['table']['join'] = array( // vocabulary links to taxonomy_term_data directly via vid. @@ -93,7 +93,7 @@ function taxonomy_views_data() { 'filter' => array( 'id' => 'numeric', ), - ); + );*/ // taxonomy_term_data table @@ -108,10 +108,6 @@ function taxonomy_views_data() { // The term data table $data['taxonomy_term_data']['table']['join'] = array( - 'taxonomy_vocabulary' => array( - 'field' => 'vid', - 'left_field' => 'vid', - ), // This is provided for many_to_one argument 'taxonomy_index' => array( 'field' => 'tid', diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php index 126f4a3..1aee4c5 100644 --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -47,13 +47,13 @@ protected function setUp() { $this->vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => $this->randomName(), 'description' => $this->randomName(), - 'machine_name' => drupal_strtolower($this->randomName()), + 'vid' => drupal_strtolower($this->randomName()), 'langcode' => LANGUAGE_NOT_SPECIFIED, 'help' => '', 'nodes' => array('page' => 'page'), 'weight' => mt_rand(0, 10), )); - taxonomy_vocabulary_save($this->vocabulary); + $this->vocabulary->save(); // Setup a field and instance. $this->field_name = drupal_strtolower($this->randomName()); @@ -63,7 +63,7 @@ protected function setUp() { 'settings' => array( 'allowed_values' => array( array( - 'vocabulary' => $this->vocabulary->machine_name, + 'vocabulary' => $this->vocabulary->id(), 'parent' => '0', ), ), @@ -154,7 +154,7 @@ function createTerm($vocabulary) { 'description' => $this->randomName(), // Use the first available text format. 'format' => db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(), - 'vid' => $vocabulary->vid, + 'vid' => $vocabulary->id(), 'langcode' => LANGUAGE_NOT_SPECIFIED, )); taxonomy_term_save($term); diff --git a/core/modules/views/lib/Drupal/views/Tests/Taxonomy/TaxonomyTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Taxonomy/TaxonomyTestBase.php index 9c2835a..8485f3e 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Taxonomy/TaxonomyTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/Taxonomy/TaxonomyTestBase.php @@ -74,18 +74,18 @@ protected function mockStandardInstall() { // Create the vocabulary for the tag field. $this->vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => 'Views testing tags', - 'machine_name' => 'views_testing_tags', + 'vid' => 'views_testing_tags', )); $this->vocabulary->save(); $field = array( - 'field_name' => 'field_' . $this->vocabulary->machine_name, + 'field_name' => 'field_' . $this->vocabulary->id(), 'type' => 'taxonomy_term_reference', // Set cardinality to unlimited for tagging. 'cardinality' => FIELD_CARDINALITY_UNLIMITED, 'settings' => array( 'allowed_values' => array( array( - 'vocabulary' => $this->vocabulary->machine_name, + 'vocabulary' => $this->vocabulary->id(), 'parent' => 0, ), ), @@ -93,7 +93,7 @@ protected function mockStandardInstall() { ); field_create_field($field); $instance = array( - 'field_name' => 'field_' . $this->vocabulary->machine_name, + 'field_name' => 'field_' . $this->vocabulary->id(), 'entity_type' => 'node', 'label' => 'Tags', 'bundle' => 'article', @@ -127,7 +127,7 @@ protected function createTerm() { 'description' => $this->randomName(), // Use the first available text format. 'format' => db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(), - 'vid' => $this->vocabulary->vid, + 'vid' => $this->vocabulary->id(), 'langcode' => LANGUAGE_NOT_SPECIFIED, )); $term->save(); diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php index cf3d19e..291cd64 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php @@ -48,7 +48,7 @@ function setUp() { // Create the vocabulary for the tag field. $this->tag_vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => 'Views testing tags', - 'machine_name' => 'views_testing_tags', + 'vid' => 'views_testing_tags', )); $this->tag_vocabulary->save(); @@ -60,7 +60,7 @@ function setUp() { 'settings' => array( 'allowed_values' => array( array( - 'vocabulary' => $this->tag_vocabulary->machine_name, + 'vocabulary' => $this->tag_vocabulary->id(), 'parent' => 0, ), ), diff --git a/core/modules/views/views_ui/admin.inc b/core/modules/views/views_ui/admin.inc index eeadc0e..635e500 100644 --- a/core/modules/views/views_ui/admin.inc +++ b/core/modules/views/views_ui/admin.inc @@ -402,8 +402,8 @@ function views_ui_taxonomy_autocomplete_validate($element, &$form_state) { $vocabularies = array(); if (!empty($field['settings']['allowed_values'])) { foreach ($field['settings']['allowed_values'] as $tree) { - if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) { - $vocabularies[$vocabulary->vid] = $tree['vocabulary']; + if ($vocabulary = entity_load('taxonomy_vocabulary', $tree['vocabulary'])) { + $vocabularies[$vocabulary->id()] = $tree['vocabulary']; } } }