Hello,
I'm going to use the Date API of the Date Module to render a simple date widget.
There is not much documentation but the most helpful is: Date Form Elements
I created the following field definitions in the .install file and my code is based on the node_example:
function _event_installed_fields() {
$t = get_t();
return array(
'event_date' => array(
'field_name' => 'event_date',
'type' => 'date',
'settings' => array(
'tz_handling' => 'date',
),
),
);
}
function _event_installed_instances() {
$t = get_t();
return array(
'event_date' => array(
'field_name' => 'event_date',
'label' => $t('Der Zeitpunkt des Events.'),
'widget' => array(
'type' => 'date_select', // see https://drupal.org/node/1364748
),
'display' => array(
'event_list' => array(
'label' => 'hidden',
'type' => 'date_select',
),
),
),
);
}
This is my event_form() in .module:
function event_form($node, $form_state) {
$form = array();
$type = node_type_get_type($node);
// implementation of the title field