array('name' => t('event'), 'base' => 'basicevent')); } /** * Implementation of hook_perm(). */ function basicevent_perm() { return array('create events', 'edit own events'); } /** * Implementation of hook_access(). */ function basicevent_access($op, $node) { global $user; switch($op) { case 'create': return user_access('create events'); break; case 'update': case 'delete': if (user_access('edit own events') && ($user->uid == $node->uid)) { return TRUE; } break; } } /** * Implementation of hook_menu(). */ function basicevent_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array('path' => 'node/add/event', 'title' => t('event'), 'access' => user_access('create events')); } return $items; } /** * Implementation of hook_form(). */ function basicevent_form(&$node) { // warn them if this isn't set to appear in the calendar if (variable_get('event_nodeapi_event', 'never') == 'never') { $link = l(t('event content-type settings page'), 'admin/settings/content-types/event'); drupal_set_message(t('The event node is currently set to never appear in the calendar. You will not be able to set the start and end dates until an administrator changes the content-type settings. This is done using the %link.', array('%link' => $link))); } $form['title'] = array( '#type' => 'textfield', '#title' => t('Title'), '#default_value' => $node->title, '#size' => 60, '#maxlength' => 128, '#required' => TRUE ); $form['body_filter']['body'] = array( '#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE ); $form['body_filter']['format'] = filter_form($node->format); return $form; }