2 // $Id: story.module 144 2007-03-28 07:52:20Z thierry $
6 * Enables users to submit stories, articles or similar content.
10 * Implementation of hook_help().
12 function story_help($section) {
14 case 'admin/help#story':
15 $output = '<p>'. t('The story module is used to create a content post type called <em>stories.</em> Stories are articles in their simplest form: they have a title, a teaser and a body. Stories are typically used to post news articles or as a group blog. ') .'</p>';
16 $output .= '<p>'. t('The story administration interface allows for complex configuration. It provides a submission form, workflow, default view permission, default edit permission, permissions for permission, and attachments. Trackbacks can also be enabled.') .'</p>';
17 $output .= t('<p>You can</p>
19 <li>post a story at <a href="%node-add-story">create content >> story</a>.</li>
20 <li>configure story at <a href="%admin-settings-content-types-story">administer >> settings >> content types >> configure story</a>.</li>
22 ', array('%node-add-story' => url('node/add/story'), '%admin-settings-content-types-story' => url('admin/settings/content-types/story')));
23 $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%story">Story page</a>.', array('%story' => 'http://drupal.org/handbook/modules/story/')) .'</p>';
25 case 'admin/modules#description':
26 return t('Allows users to submit stories, articles or similar content.');
27 case 'node/add#story':
28 return t('Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.');
33 * Implementation of hook_node_info().
35 function story_node_info() {
36 return array('story' => array('name' => t('story'), 'base' => 'story'));
40 * Implementation of hook_perm().
42 function story_perm() {
43 return array('create stories', 'edit own stories');
47 * Implementation of hook_access().
49 function story_access($op, $node) {
52 if ($op == 'create') {
53 return user_access('create stories');
56 if ($op == 'update' || $op == 'delete') {
57 if (user_access('edit own stories') && ($user->uid == $node->uid)) {
64 * Implementation of hook_menu().
66 function story_menu($may_cache) {
70 $items[] = array('path' => 'node/add/story', 'title' => t('story'),
71 'access' => user_access('create stories'));
78 * Implementation of hook_form().
80 function story_form(&$node) {
81 $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5);
82 $form['body_filter']['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
83 $form['body_filter']['format'] = filter_form($node->format);