[development] Modifying event date in hook_form

Ron Parker sysop at scbbs.com
Wed Dec 5 17:50:04 UTC 2007

Thank you.  Using hook_form_alter and weighting the agenda module higher 
than the event module resolves the problem.


Gerhard Killesreiter wrote:

>Hash: SHA1
>Ron Parker schrieb:
>>I've posted this in Forums, but doesn't look like I'm going to get a
>>response, and I'm pretty sure someone here knows this right off the bat.
>>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.
>><>To use it, I create an event node, then the module allows me to create
>>an agenda node that corresponds to the event node. The agenda content
>>type has start/end date fields. I do not have jscalendar.module
>>installed.  I wish to pass the start and end dates of the corresponding
>>event node to the agenda node automatically.
>>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.
>That's probably because event.module replaces your form stuff by its own
>in event_form_alter. What you need to do is to implement your own
>hook_form_alter and alter the stuff event put in, specifically th
>default values. For this to work you need to make sure your module has a
>higher weight in the system table than event.module.
>	Gerhard
>Version: GnuPG v1.4.6 (GNU/Linux)
>__________ NOD32 2703 (20071205) Information __________
>This message was checked by NOD32 antivirus system.

Ron Parker
Software Creations               http://www.scbbs.com
Self-Administration Web Site     http://saw.scbbs.com
SDSS Subscription Mgmt Service   http://sdss.scbbs.com
Central Ave Dance Ensemble       http://www.centralavedance.com
R & B Salsa                      http://www.randbsalsa.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20071205/1190d077/attachment-0001.htm 

More information about the development mailing list