Posted by JMOmandown on January 19, 2013 at 10:31pm
1 follower
| Project: | Date |
| Version: | 7.x-2.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I was just curious of the proper way to set the default value to NONE when creating the date field via PHP code as follows. I have tried setting the default_value parameter to NULL and none without success:
<?php
$fields_array = array(
array(
'field' => array(
'field_name' => 'field_test_date',
'type' => 'datetime',
'cardinality' => 1,
'label' => 'Calendar',
'settings' => array(),
),
'instance' => array(
'field_name' => 'field_test_date',
'entity_type' => 'field_collection_item',
'bundle' => 'field_test_c',
'label' => 'Calendar',
'cardinality' => 1,
'description' => '',
'#default_value' => NULL,
'widget' => array(
'type' => 'text_textfield',
'weight' => 0,
'settings' => array('size' => 50),
),
'display' => array(
'default' => array(
'label' => 'above',
'settings' => array(),
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
),
),
'required' => FALSE,
)
),
);
?>