1

This is my field definition:

'ms_date' => array(
            'field_name' => 'ms_date',
            'type' => 'datetime',
            'cardinality' => 1,
            'settings' => array(
                'cache_count' => '4',
                'cache_enabled' => 0,
                'granularity' => array(
                    'day' => 'day',
                    'hour' => 'hour',
                    'minute' => 'minute',
                    'month' => 'month',
                    'second' => 'second',
                    'year' => 'year',
                ),
                'timezone_db' => 'UTC',
                'todate' => '',
                'tz_handling' => 'site',
            ),
        ),

and the instance definition:

 'ms_date' => array(
        'field_name' => 'ms_date',
        'entity_type' => 'node',
        'bundle' => 'ms_core',
        'label' => $t('date'),
        'widget' => array(
            'active' => 1,
            'module' => 'date',
            'settings' => array(
                'increment' => 15,
                'input_format' => 'm/d/Y - H:i:s',
                'input_format_custom' => '',
                'label_position' => 'above',
                'text_parts' => array(),
                'year_range' => '-3:+3',
            ),
            'type' => 'date_text',
            'weight' => '1',
        ),
        'settings' => array(
            'cache_count' => '4',
            'cache_enabled' => 0,
            'granularity' => array(
                'day' => 'day',
                'hour' => 'hour',
                'minute' => 'minute',
                'month' => 'month',
                'second' => 'second',
                'year' => 'year',
            ),
            'timezone_db' => 'UTC',
            'todate' => '',
            'tz_handling' => 'site',
        ),
    ),

I'm using these structures with field_create_field and field_create_instance respectively.

Currently the "Collect an end date" textfield is missing when I create this field. How do I enable it?

2

You just need to set the todate under the settings array, I believe the 2 options available are

'todate' => 'optional',

and

'todate' => 'required',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.