You are here

function i18nTaxonomyTestCase::createTermField in Internationalization 7

Setup a field and instance.

2 calls to i18nTaxonomyTestCase::createTermField()
i18nTaxonomyTestCase::testTaxonomyTermLocalize in i18n_taxonomy/i18n_taxonomy.test
i18nTaxonomyTestCase::testTaxonomyTermTranslate in i18n_taxonomy/i18n_taxonomy.test

File

i18n_taxonomy/i18n_taxonomy.test, line 218
Test case for multilingual taxonomy

Class

i18nTaxonomyTestCase
@file Test case for multilingual taxonomy

Code

function createTermField($machine_name, $widget = 'options_select') {
  $field_name = drupal_strtolower($this
    ->randomName());
  $this->field = array(
    'field_name' => $field_name,
    'type' => 'taxonomy_term_reference',
    'settings' => array(
      'allowed_values' => array(
        array(
          'vocabulary' => $machine_name,
          'parent' => '0',
        ),
      ),
    ),
  );
  field_create_field($this->field);
  $this->instance = array(
    'field_name' => $field_name,
    'entity_type' => 'test_entity',
    'bundle' => 'test_bundle',
    'widget' => array(
      'type' => $widget,
    ),
    'display' => array(
      'full' => array(
        'type' => 'taxonomy_term_reference_link',
      ),
    ),
  );
  field_create_instance($this->instance);
  return $field_name;
}