I have just started to use Drupal and I'm trying to add programmatically field in the .install file.
$field = array(
'field_name' => 'title',
'cardinality' => 1,
'type' => 'text',
'settings' => array(
'max_length' => 1024,
),
);
field_create_field($field);
$instance = array(
'field_name' => 'title',
'label' => $t('Title'),
'type' => 'text',
'widget' => array(
'type' => 'text_textfield',
'weight' => 1.0,
),
'display' => array(
'default' => array(
'label' => $t('label'),
'type' => 'text',
),
),
);
$instance['entity_type'] = 'node';
$instance['bundle'] = 'mytype';
field_create_instance($instance);
The field is added correctly but it is disabled in the Manage Display. How can I change the region column from 'disabled' to 'content'? I tried to add 'region' => 'content' in the instance array but it is not working and I cannot find a good example or documentation about the problem.
Thanks.