I'm creating an agenda module for 5.x. So far, it only requires the
event module. The module creates a new content type: "agenda". It is
set to appear in all calendars (for now) so has event start and end
date fields associated with it.
I'm currently trying to use the following code in hook_form,
which I modified from the event_form_alter() function:
$event = node_load($node->event_id);
// Load corresponding event node
if (arg(1) == 'add' || arg(1) == 'ognodeadd') {
$form['event_start'] = array(
'#type' => 'fieldset',
'#title' => t('Start date'),
'#weight' => -15
);
$form['event_start']['date'] =
event_form_date($event->event_start, 'start',
$event->start_offset);
}But, nothing is coming through. I still get the default time when creating a new agenda node, and not the time from the corresponding event node. I know the hook itself (agenda_form) is working because other code does work:
if (arg(1) == 'add' || arg(1) == 'ognodeadd') {
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#required' => true,
'#default_value' => theme('agenda_default_title', $event),
'#weight' => -5
);
} else {
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#required' => true,
'#default_value' => $node->title,
'#weight' => -5
);
}
I have tried other ways of doing it suggested here:
But, nothing seems to be working for me. Can someone please help me with this?