ListFieldUITestCase::createListField

  1. drupal
    1. 8
    2. 7
Versions
7 protected ListFieldUITestCase::createListField($type)

Helper function to create list field of a given type.

Parameters

string $type 'list_integer', 'list_float', 'list_text' or 'list_boolean'

Code

modules/field/modules/list/tests/list.test, line 332

<?php
protected function createListField($type) {
  // Create a test field and instance.
  $field = array(
    'field_name' => $this->field_name, 
    'type' => $type,
  );
  field_create_field($field);
  $instance = array(
    'field_name' => $this->field_name, 
    'entity_type' => 'node', 
    'bundle' => $this->type,
  );
  field_create_instance($instance);

  $this->admin_path = 'admin/structure/types/manage/' . $this->hyphen_type . '/fields/' . $this->field_name;
}
?>