function HierarchicalTermFormatterTestCase::addTestFieldToPage in Hierarchical Term Formatter 7
Set up a text field on the page content type so we can configure it.
See also
1 call to HierarchicalTermFormatterTestCase::addTestFieldToPage()
- HierarchicalTermFormatterTestCase::setUp in ./
hierarchical_term_formatter.test - Sets up a Drupal site for running functional and integration tests.
File
- ./
hierarchical_term_formatter.test, line 150 - Tests for Field Multiple Limit, based on examples from field.test
Class
- HierarchicalTermFormatterTestCase
- Test the field formatter settings work.
Code
function addTestFieldToPage() {
$this->entity_type = 'node';
$this->field_name = 'taxonomy_' . $this->vocabulary->machine_name;
$this->bundle = 'page';
$field = array(
'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
'type' => 'taxonomy_term_reference',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => $this->vocabulary->machine_name,
'parent' => 0,
),
),
),
);
field_create_field($field);
$this->instance = array(
'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
'bundle' => 'page',
'entity_type' => 'node',
'widget' => array(
'type' => 'options_select',
),
'display' => array(
'default' => array(
'type' => 'hierarchical_term_formatter',
),
),
);
field_create_instance($this->instance);
}