function DraggableviewsFieldAPIHandlerTestCase::createField in DraggableViews 7.2
1 call to DraggableviewsFieldAPIHandlerTestCase::createField()
File
- test/
draggableviews.test, line 315 - Test cases file.
Class
- DraggableviewsFieldAPIHandlerTestCase
- Testing Field API Handler.
Code
function createField() {
$field = array(
'translatable' => '0',
'entity_types' => array(),
'settings' => array(),
'storage' => array(
'type' => 'field_sql_storage',
'settings' => array(),
'module' => 'field_sql_storage',
'active' => '1',
'details' => array(
'sql' => array(
'FIELD_LOAD_CURRENT' => array(
'field_data_field_weight' => array(
'value' => 'field_weight_value',
),
),
'FIELD_LOAD_REVISION' => array(
'field_revision_field_weight' => array(
'value' => 'field_weight_value',
),
),
),
),
),
'foreign keys' => array(),
'indexes' => array(),
'id' => '5',
'field_name' => 'field_weight',
'type' => 'number_integer',
'module' => 'number',
'active' => '1',
'locked' => '0',
'cardinality' => '1',
'deleted' => '0',
'columns' => array(
'value' => array(
'type' => 'int',
'not null' => FALSE,
),
),
'bundles' => array(
'node' => array(
0 => 'article',
),
),
);
field_create_field($field);
$instance = array(
'label' => 'Weight',
'widget' => array(
'weight' => 0,
'type' => 'number',
'module' => 'number',
'active' => 0,
'settings' => array(),
),
'settings' => array(
'min' => '',
'max' => '',
'prefix' => '',
'suffix' => '',
'user_register_form' => FALSE,
),
'display' => array(
'default' => array(
'label' => 'above',
'type' => 'number_integer',
'settings' => array(
'thousand_separator' => ' ',
'decimal_separator' => '.',
'scale' => 0,
'prefix_suffix' => TRUE,
),
'module' => 'number',
'weight' => 11,
),
),
'required' => 0,
'description' => '',
'default_value' => NULL,
'id' => '7',
'field_id' => '5',
'field_name' => 'field_weight',
'entity_type' => 'node',
'bundle' => 'article',
'deleted' => '0',
);
field_create_instance($instance);
}