Issue #1981342 by aspilicious, andypost, swentel: Drop procedural usage of fields in [s-u-v] modules.

8.0.x
Alex Pott 2013-06-18 14:29:20 +02:00
parent fc35679d72
commit 72bd779d56
19 changed files with 86 additions and 103 deletions

View File

@ -49,8 +49,8 @@ class SearchMultilingualEntityTest extends SearchTestBase {
// Make the body field translatable. // Make the body field translatable.
// The parent class has already created the article and page content types. // The parent class has already created the article and page content types.
$field = field_info_field('body'); $field = field_info_field('body');
$field['translatable'] = TRUE; $field->translatable = TRUE;
field_update_field($field); $field->save();
// Create a few page nodes with multilingual body values. // Create a few page nodes with multilingual body values.
$default_format = filter_default_format(); $default_format = filter_default_format();

View File

@ -34,22 +34,20 @@ class EntityResolverTest extends NormalizerTestBase {
parent::setUp(); parent::setUp();
// Create the test field. // Create the test field.
$field = array( entity_create('field_entity', array(
'settings' => array( 'settings' => array(
'target_type' => 'entity_test_mulrev', 'target_type' => 'entity_test_mulrev',
), ),
'field_name' => 'field_test_entity_reference', 'field_name' => 'field_test_entity_reference',
'type' => 'entity_reference', 'type' => 'entity_reference',
); ))->save();
field_create_field($field);
// Create the test field instance. // Create the test field instance.
$instance = array( entity_create('field_instance', array(
'entity_type' => 'entity_test_mulrev', 'entity_type' => 'entity_test_mulrev',
'field_name' => 'field_test_entity_reference', 'field_name' => 'field_test_entity_reference',
'bundle' => 'entity_test_mulrev', 'bundle' => 'entity_test_mulrev',
); ))->save();
field_create_instance($instance);
} }
/** /**

View File

@ -26,13 +26,13 @@ abstract class NormalizerTestBase extends DrupalUnitTestBase {
$this->installConfig(array('field')); $this->installConfig(array('field'));
// Auto-create a field for testing. // Auto-create a field for testing.
field_create_field(array( entity_create('field_entity', array(
'field_name' => 'field_test_text', 'field_name' => 'field_test_text',
'type' => 'text', 'type' => 'text',
'cardinality' => 1, 'cardinality' => 1,
'translatable' => FALSE, 'translatable' => FALSE,
)); ))->save();
$instance = array( entity_create('field_instance', array(
'entity_type' => 'entity_test_mulrev', 'entity_type' => 'entity_test_mulrev',
'field_name' => 'field_test_text', 'field_name' => 'field_test_text',
'bundle' => 'entity_test_mulrev', 'bundle' => 'entity_test_mulrev',
@ -41,7 +41,7 @@ abstract class NormalizerTestBase extends DrupalUnitTestBase {
'type' => 'text_textfield', 'type' => 'text_textfield',
'weight' => 0, 'weight' => 0,
), ),
); ))->save();
field_create_instance($instance);
} }
} }

View File

@ -231,17 +231,16 @@ class DrupalUnitTestBaseTest extends DrupalUnitTestBase {
'bundle' => 'entity_test', 'bundle' => 'entity_test',
'mode' => 'default', 'mode' => 'default',
)); ));
$field = array( $field = entity_create('field_entity', array(
'field_name' => 'test_field', 'field_name' => 'test_field',
'type' => 'test_field' 'type' => 'test_field'
); ));
field_create_field($field); $field->save();
$instance = array( entity_create('field_instance', array(
'field_name' => $field['field_name'], 'field_name' => $field->id(),
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'bundle' => 'entity_test', 'bundle' => 'entity_test',
); ))->save();
field_create_instance($instance);
} }
/** /**

View File

@ -34,18 +34,16 @@ class MultiFormTest extends AjaxTestBase {
// Create a multi-valued field for 'page' nodes to use for Ajax testing. // Create a multi-valued field for 'page' nodes to use for Ajax testing.
$field_name = 'field_ajax_test'; $field_name = 'field_ajax_test';
$field = array( entity_create('field_entity', array(
'field_name' => $field_name, 'field_name' => $field_name,
'type' => 'text', 'type' => 'text',
'cardinality' => FIELD_CARDINALITY_UNLIMITED, 'cardinality' => FIELD_CARDINALITY_UNLIMITED,
); ))->save();
field_create_field($field); entity_create('field_instance', array(
$instance = array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
'bundle' => 'page', 'bundle' => 'page',
); ))->save();
field_create_instance($instance);
entity_get_form_display('node', 'page', 'default') entity_get_form_display('node', 'page', 'default')
->setComponent($field_name, array('type' => 'text_default')) ->setComponent($field_name, array('type' => 'text_default'))
->save(); ->save();

View File

@ -598,8 +598,8 @@ class EntityFieldTest extends EntityUnitTestBase {
protected function assertComputedProperties($entity_type) { protected function assertComputedProperties($entity_type) {
// Make the test text field processed. // Make the test text field processed.
$instance = field_info_instance($entity_type, 'field_test_text', $entity_type); $instance = field_info_instance($entity_type, 'field_test_text', $entity_type);
$instance['settings']['text_processing'] = 1; $instance->settings['text_processing'] = 1;
field_update_instance($instance); $instance->save();
$entity = $this->createTestEntity($entity_type); $entity = $this->createTestEntity($entity_type);
$entity->field_test_text->value = "The <strong>text</strong> text to filter."; $entity->field_test_text->value = "The <strong>text</strong> text to filter.";

View File

@ -60,18 +60,17 @@ class EntityQueryAggregateTest extends EntityUnitTestBase {
// Add some fieldapi fields to be used in the test. // Add some fieldapi fields to be used in the test.
for ($i = 1; $i <= 2; $i++) { for ($i = 1; $i <= 2; $i++) {
$field = array( $field_name = 'field_test_' . $i;
'field_name' => 'field_test_' . $i, entity_create('field_entity', array(
'field_name' => $field_name,
'type' => 'number_integer', 'type' => 'number_integer',
'cardinality' => 2, 'cardinality' => 2,
); ))->save();
field_create_field($field); entity_create('field_instance', array(
$instance = array( 'field_name' => $field_name,
'field_name' => $field['field_name'],
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'bundle' => 'entity_test', 'bundle' => 'entity_test',
); ))->save();
field_create_instance($instance);
} }
$entity = $this->entityStorageController->create(array( $entity = $this->entityStorageController->create(array(

View File

@ -85,14 +85,13 @@ class EntityQueryRelationshipTest extends EntityUnitTestBase {
'type' => 'taxonomy_term_reference', 'type' => 'taxonomy_term_reference',
); );
$field['settings']['allowed_values']['vocabulary'] = $vocabulary->id(); $field['settings']['allowed_values']['vocabulary'] = $vocabulary->id();
field_create_field($field); entity_create('field_entity', $field)->save();
// Third, create the instance. // Third, create the instance.
$instance = array( entity_create('field_instance', array(
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,
'bundle' => 'entity_test', 'bundle' => 'entity_test',
); ))->save();
field_create_instance($instance);
// Create two terms and also two accounts. // Create two terms and also two accounts.
for ($i = 0; $i <= 1; $i++) { for ($i = 0; $i <= 1; $i++) {
$term = entity_create('taxonomy_term', array( $term = entity_create('taxonomy_term', array(

View File

@ -61,13 +61,14 @@ class EntityQueryTest extends EntityUnitTestBase {
$figures = drupal_strtolower($this->randomName()); $figures = drupal_strtolower($this->randomName());
$greetings = drupal_strtolower($this->randomName()); $greetings = drupal_strtolower($this->randomName());
foreach (array($figures => 'shape', $greetings => 'text') as $field_name => $field_type) { foreach (array($figures => 'shape', $greetings => 'text') as $field_name => $field_type) {
$field = array( $field = entity_create('field_entity', array(
'field_name' => $field_name, 'field_name' => $field_name,
'type' => $field_type, 'type' => $field_type,
'cardinality' => 2, 'cardinality' => 2,
'translatable' => TRUE, 'translatable' => TRUE,
); ));
$fields[] = field_create_field($field); $field->save();
$fields[] = $field;
} }
$bundles = array(); $bundles = array();
for ($i = 0; $i < 2; $i++) { for ($i = 0; $i < 2; $i++) {
@ -78,12 +79,11 @@ class EntityQueryTest extends EntityUnitTestBase {
} while ($bundles && strtolower($bundles[0]) >= strtolower($bundle)); } while ($bundles && strtolower($bundles[0]) >= strtolower($bundle));
entity_test_create_bundle($bundle); entity_test_create_bundle($bundle);
foreach ($fields as $field) { foreach ($fields as $field) {
$instance = array( entity_create('field_instance', array(
'field_name' => $field['field_name'], 'field_name' => $field->id(),
'entity_type' => 'entity_test_mulrev', 'entity_type' => 'entity_test_mulrev',
'bundle' => $bundle, 'bundle' => $bundle,
); ))->save();
field_create_instance($instance);
} }
$bundles[] = $bundle; $bundles[] = $bundle;
} }
@ -410,12 +410,11 @@ class EntityQueryTest extends EntityUnitTestBase {
// can test whether cross entity type fields produce the correct query. // can test whether cross entity type fields produce the correct query.
$field_name = $this->figures; $field_name = $this->figures;
$bundle = $this->randomName(); $bundle = $this->randomName();
$instance = array( entity_create('field_instance', array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'bundle' => $bundle, 'bundle' => $bundle,
); ))->save();
field_create_instance($instance);
$entity = entity_create('entity_test', array( $entity = entity_create('entity_test', array(
'id' => 1, 'id' => 1,

View File

@ -105,8 +105,8 @@ class EntityTranslationFormTest extends WebTestBase {
// Make body translatable. // Make body translatable.
$field = field_info_field('body'); $field = field_info_field('body');
$field['translatable'] = TRUE; $field->translatable = TRUE;
field_update_field($field); $field->save();
$field = field_info_field('body'); $field = field_info_field('body');
$this->assertTrue($field['translatable'], 'Field body is translatable.'); $this->assertTrue($field['translatable'], 'Field body is translatable.');

View File

@ -50,23 +50,21 @@ class EntityTranslationTest extends EntityUnitTestBase {
// Create a translatable test field. // Create a translatable test field.
$this->field_name = drupal_strtolower($this->randomName() . '_field_name'); $this->field_name = drupal_strtolower($this->randomName() . '_field_name');
$field = array( entity_create('field_entity', array(
'field_name' => $this->field_name, 'field_name' => $this->field_name,
'type' => 'text', 'type' => 'text',
'cardinality' => 4, 'cardinality' => 4,
'translatable' => TRUE, 'translatable' => TRUE,
); ))->save();
field_create_field($field);
$this->field = field_read_field($this->field_name); $this->field = field_read_field($this->field_name);
// Create instance in all entity variations. // Create instance in all entity variations.
foreach (entity_test_entity_types() as $entity_type) { foreach (entity_test_entity_types() as $entity_type) {
$instance = array( entity_create('field_instance', array(
'field_name' => $this->field_name, 'field_name' => $this->field_name,
'entity_type' => $entity_type, 'entity_type' => $entity_type,
'bundle' => $entity_type, 'bundle' => $entity_type,
); ))->save();
field_create_instance($instance);
$this->instance[$entity_type] = field_read_instance($entity_type, $this->field_name, $entity_type); $this->instance[$entity_type] = field_read_instance($entity_type, $this->field_name, $entity_type);
} }

View File

@ -33,15 +33,13 @@ class ArbitraryRebuildTest extends WebTestBase {
parent::setUp(); parent::setUp();
// Auto-create a field for testing. // Auto-create a field for testing.
$field = array( entity_create('field_entity', array(
'field_name' => 'test_multiple', 'field_name' => 'test_multiple',
'type' => 'text', 'type' => 'text',
'cardinality' => -1, 'cardinality' => -1,
'translatable' => FALSE, 'translatable' => FALSE,
); ))->save();
field_create_field($field); entity_create('field_instance', array(
$instance = array(
'entity_type' => 'user', 'entity_type' => 'user',
'field_name' => 'test_multiple', 'field_name' => 'test_multiple',
'bundle' => 'user', 'bundle' => 'user',
@ -49,8 +47,7 @@ class ArbitraryRebuildTest extends WebTestBase {
'settings' => array( 'settings' => array(
'user_register_form' => TRUE, 'user_register_form' => TRUE,
), ),
); ))->save();
field_create_instance($instance);
entity_get_form_display('user', 'user', 'default') entity_get_form_display('user', 'user', 'default')
->setComponent('test_multiple', array( ->setComponent('test_multiple', array(
'type' => 'text_textfield', 'type' => 'text_textfield',

View File

@ -76,13 +76,13 @@ class RebuildTest extends WebTestBase {
'type' => 'text', 'type' => 'text',
'cardinality' => FIELD_CARDINALITY_UNLIMITED, 'cardinality' => FIELD_CARDINALITY_UNLIMITED,
); );
field_create_field($field); entity_create('field_entity', $field)->save();
$instance = array( $instance = array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
'bundle' => 'page', 'bundle' => 'page',
); );
field_create_instance($instance); entity_create('field_instance', $instance)->save();
entity_get_form_display('node', 'page', 'default') entity_get_form_display('node', 'page', 'default')
->setComponent($field_name, array('type' => 'text_test')) ->setComponent($field_name, array('type' => 'text_test'))
->save(); ->save();

View File

@ -10,13 +10,12 @@
*/ */
function entity_test_install() { function entity_test_install() {
// Auto-create a field for testing. // Auto-create a field for testing.
$field = array( entity_create('field_entity', array(
'field_name' => 'field_test_text', 'field_name' => 'field_test_text',
'type' => 'text', 'type' => 'text',
'cardinality' => 1, 'cardinality' => 1,
'translatable' => FALSE, 'translatable' => FALSE,
); ))->save();
field_create_field($field);
$entity_types = array( $entity_types = array(
'entity_test', 'entity_test',
@ -25,13 +24,12 @@ function entity_test_install() {
'entity_test_mulrev', 'entity_test_mulrev',
); );
foreach ($entity_types as $entity_type) { foreach ($entity_types as $entity_type) {
$instance = array( entity_create('field_instance', array(
'entity_type' => $entity_type, 'entity_type' => $entity_type,
'field_name' => 'field_test_text', 'field_name' => 'field_test_text',
'bundle' => $entity_type, 'bundle' => $entity_type,
'label' => 'Test text-field', 'label' => 'Test text-field',
); ))->save();
field_create_instance($instance);
entity_get_form_display($entity_type, $entity_type, 'default') entity_get_form_display($entity_type, $entity_type, 'default')
->setComponent('field_test_text', array('type' => 'text_text')) ->setComponent('field_test_text', array('type' => 'text_text'))

View File

@ -195,34 +195,34 @@ class UserRegistrationTest extends WebTestBase {
*/ */
function testRegistrationWithUserFields() { function testRegistrationWithUserFields() {
// Create a field, and an instance on 'user' entity type. // Create a field, and an instance on 'user' entity type.
$field = array( $field = entity_create('field_entity', array(
'type' => 'test_field', 'type' => 'test_field',
'field_name' => 'test_user_field', 'field_name' => 'test_user_field',
'cardinality' => 1, 'cardinality' => 1,
); ));
field_create_field($field); $field->save();
$instance = array( $instance = entity_create('field_instance', array(
'field_name' => 'test_user_field', 'field_name' => 'test_user_field',
'entity_type' => 'user', 'entity_type' => 'user',
'label' => 'Some user field', 'label' => 'Some user field',
'bundle' => 'user', 'bundle' => 'user',
'required' => TRUE, 'required' => TRUE,
'settings' => array('user_register_form' => FALSE), 'settings' => array('user_register_form' => FALSE),
); ));
field_create_instance($instance); $instance->save();
entity_get_form_display('user', 'user', 'default') entity_get_form_display('user', 'user', 'default')
->setComponent('test_user_field', array('type' => 'test_field_widget')) ->setComponent('test_user_field', array('type' => 'test_field_widget'))
->save(); ->save();
// Check that the field does not appear on the registration form. // Check that the field does not appear on the registration form.
$this->drupalGet('user/register'); $this->drupalGet('user/register');
$this->assertNoText($instance['label'], 'The field does not appear on user registration form'); $this->assertNoText($instance->label(), 'The field does not appear on user registration form');
// Have the field appear on the registration form. // Have the field appear on the registration form.
$instance['settings']['user_register_form'] = TRUE; $instance->settings['user_register_form'] = TRUE;
field_update_instance($instance); $instance->save();
$this->drupalGet('user/register'); $this->drupalGet('user/register');
$this->assertText($instance['label'], 'The field appears on user registration form'); $this->assertText($instance->label(), 'The field appears on user registration form');
// Check that validation errors are correctly reported. // Check that validation errors are correctly reported.
$edit = array(); $edit = array();
@ -231,11 +231,11 @@ class UserRegistrationTest extends WebTestBase {
// Missing input in required field. // Missing input in required field.
$edit['test_user_field[und][0][value]'] = ''; $edit['test_user_field[und][0][value]'] = '';
$this->drupalPost(NULL, $edit, t('Create new account')); $this->drupalPost(NULL, $edit, t('Create new account'));
$this->assertRaw(t('@name field is required.', array('@name' => $instance['label'])), 'Field validation error was correctly reported.'); $this->assertRaw(t('@name field is required.', array('@name' => $instance->label())), 'Field validation error was correctly reported.');
// Invalid input. // Invalid input.
$edit['test_user_field[und][0][value]'] = '-1'; $edit['test_user_field[und][0][value]'] = '-1';
$this->drupalPost(NULL, $edit, t('Create new account')); $this->drupalPost(NULL, $edit, t('Create new account'));
$this->assertRaw(t('%name does not accept the value -1.', array('%name' => $instance['label'])), 'Field validation error was correctly reported.'); $this->assertRaw(t('%name does not accept the value -1.', array('%name' => $instance->label())), 'Field validation error was correctly reported.');
// Submit with valid data. // Submit with valid data.
$value = rand(1, 255); $value = rand(1, 255);
@ -247,8 +247,8 @@ class UserRegistrationTest extends WebTestBase {
$this->assertEqual($new_user->test_user_field->value, $value, 'The field value was correclty saved.'); $this->assertEqual($new_user->test_user_field->value, $value, 'The field value was correclty saved.');
// Check that the 'add more' button works. // Check that the 'add more' button works.
$field['cardinality'] = FIELD_CARDINALITY_UNLIMITED; $field->cardinality = FIELD_CARDINALITY_UNLIMITED;
field_update_field($field); $field->save();
foreach (array('js', 'nojs') as $js) { foreach (array('js', 'nojs') as $js) {
$this->drupalGet('user/register'); $this->drupalGet('user/register');
// Add two inputs. // Add two inputs.

View File

@ -315,7 +315,7 @@ function user_install_picture_field() {
'default_image' => FALSE, 'default_image' => FALSE,
), ),
); );
$field = field_create_field($field); entity_create('field_entity', $field)->save();
$instance = array( $instance = array(
'field_name' => 'user_picture', 'field_name' => 'user_picture',
@ -335,7 +335,7 @@ function user_install_picture_field() {
'default_image' => 0, 'default_image' => 0,
), ),
); );
field_create_instance($instance); entity_create('field_instance', $instance)->save();
// Assign form display settings for the 'default' view mode. // Assign form display settings for the 'default' view mode.
entity_get_form_display('user', 'user', 'default') entity_get_form_display('user', 'user', 'default')

View File

@ -61,7 +61,7 @@ class DefaultViewsTest extends ViewTestBase {
// Setup a field and instance. // Setup a field and instance.
$this->field_name = drupal_strtolower($this->randomName()); $this->field_name = drupal_strtolower($this->randomName());
$this->field = array( entity_create('field_entity', array(
'field_name' => $this->field_name, 'field_name' => $this->field_name,
'type' => 'taxonomy_term_reference', 'type' => 'taxonomy_term_reference',
'settings' => array( 'settings' => array(
@ -72,14 +72,12 @@ class DefaultViewsTest extends ViewTestBase {
), ),
), ),
) )
); ))->save();
field_create_field($this->field); entity_create('field_instance', array(
$this->instance = array(
'field_name' => $this->field_name, 'field_name' => $this->field_name,
'entity_type' => 'node', 'entity_type' => 'node',
'bundle' => 'page', 'bundle' => 'page',
); ))->save();
field_create_instance($this->instance);
// Create a time in the past for the archive. // Create a time in the past for the archive.
$time = REQUEST_TIME - 3600; $time = REQUEST_TIME - 3600;

View File

@ -55,7 +55,7 @@ class TaggedWithTest extends WizardTestBase {
$this->tag_vocabulary->save(); $this->tag_vocabulary->save();
// Create the tag field itself. // Create the tag field itself.
$this->tag_field = array( $this->tag_field = entity_create('field_entity', array(
'field_name' => 'field_views_testing_tags', 'field_name' => 'field_views_testing_tags',
'type' => 'taxonomy_term_reference', 'type' => 'taxonomy_term_reference',
'cardinality' => FIELD_CARDINALITY_UNLIMITED, 'cardinality' => FIELD_CARDINALITY_UNLIMITED,
@ -67,8 +67,8 @@ class TaggedWithTest extends WizardTestBase {
), ),
), ),
), ),
); ));
field_create_field($this->tag_field); $this->tag_field->save();
// Create an instance of the tag field on one of the content types, and // Create an instance of the tag field on one of the content types, and
// configure it to display an autocomplete widget. // configure it to display an autocomplete widget.
@ -77,7 +77,7 @@ class TaggedWithTest extends WizardTestBase {
'entity_type' => 'node', 'entity_type' => 'node',
'bundle' => $this->node_type_with_tags->type, 'bundle' => $this->node_type_with_tags->type,
); );
field_create_instance($this->tag_instance); entity_create('field_instance', $this->tag_instance)->save();
entity_get_form_display('node', $this->node_type_with_tags->type, 'default') entity_get_form_display('node', $this->node_type_with_tags->type, 'default')
->setComponent('field_views_testing_tags', array( ->setComponent('field_views_testing_tags', array(
@ -108,7 +108,7 @@ class TaggedWithTest extends WizardTestBase {
$node_add_path = 'node/add/' . $this->node_type_with_tags->type; $node_add_path = 'node/add/' . $this->node_type_with_tags->type;
// Create three nodes, with different tags. // Create three nodes, with different tags.
$tag_field = $this->tag_field['field_name'] . '[' . Language::LANGCODE_NOT_SPECIFIED . ']'; $tag_field = $this->tag_field->id() . '[' . Language::LANGCODE_NOT_SPECIFIED . ']';
$edit = array(); $edit = array();
$edit['title'] = $node_tag1_title = $this->randomName(); $edit['title'] = $node_tag1_title = $this->randomName();
$edit[$tag_field] = 'tag1'; $edit[$tag_field] = 'tag1';
@ -189,7 +189,7 @@ class TaggedWithTest extends WizardTestBase {
// "tagged with" form element should not appear for it too. // "tagged with" form element should not appear for it too.
$instance = $this->tag_instance; $instance = $this->tag_instance;
$instance['bundle'] = $this->node_type_without_tags->type; $instance['bundle'] = $this->node_type_without_tags->type;
field_create_instance($instance); entity_create('field_instance', $instance)->save();
entity_get_form_display('node', $this->node_type_without_tags->type, 'default') entity_get_form_display('node', $this->node_type_without_tags->type, 'default')
->setComponent('field_views_testing_tags', array( ->setComponent('field_views_testing_tags', array(
'type' => 'taxonomy_autocomplete', 'type' => 'taxonomy_autocomplete',

View File

@ -93,7 +93,7 @@ for ($i = 0; $i < 24; $i++) {
), ),
), ),
); );
field_create_field($field); entity_create('field_entity', $field)->save();
$node_types = $i > 11 ? array('page') : array_keys(node_type_get_types()); $node_types = $i > 11 ? array('page') : array_keys(node_type_get_types());
foreach ($node_types as $bundle) { foreach ($node_types as $bundle) {
$instance = array( $instance = array(
@ -132,7 +132,7 @@ for ($i = 0; $i < 24; $i++) {
'settings' => array(), 'settings' => array(),
); );
} }
field_create_instance($instance); entity_create('field_instance', $instance)->save();
} }
$parents = array(); $parents = array();
// Vocabularies without hierarchy get one term, single parent vocabularies get // Vocabularies without hierarchy get one term, single parent vocabularies get