/[drupal]/contributions/modules/quotes/quotes.node.inc
ViewVC logotype

Contents of /contributions/modules/quotes/quotes.node.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Mon Sep 7 18:26:23 2009 UTC (2 months, 2 weeks ago) by nancyw
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +5 -5 lines
File MIME type: text/x-php
Latest from Charles Mattice.
1 <?php
2 // $Id: quotes.node.inc,v 1.2 2009/08/28 16:28:01 nancyw Exp $
3
4 /**
5 * @file
6 * The quotes module allows users to maintain a list of quotes that
7 * can be displayed in any number of administrator-defined quote
8 * blocks.
9 *
10 * @copyright Copyright (c) 2003-2007 Jim Riggs. All rights reserved.
11 * @author Jim Riggs <drupal at jim and lissa dot com>
12 */
13
14 /**
15 * Implements hook_form().
16 */
17 function quotes_form(&$node, &$param) {
18 $form = array('quotes_data' => array());
19
20 $form['title'] = array(
21 '#type' => 'textfield',
22 '#title' => t('Title'),
23 '#required' => FALSE,
24 '#default_value' => $node->title,
25 '#description' => t('Enter the title for the quote(s). If you include the variable %%id, it will be replaced by the new quote\'s ID.'),
26 '#weight' => -10
27 );
28
29 if (user_access('import quotes')) {
30 $form['quotes_data']['quotes_format'] = array(
31 '#type' => 'radios',
32 '#title' => t('Format'),
33 '#required' => TRUE,
34 '#default_value' => ($node->quotes_format ? $node->quotes_format : 'single'),
35 '#options' => array(
36 'single' => t('Single quote.'),
37 'text' => t('Import tab-separated text.'),
38 'fortune' => t('Import Fortune file.'),
39 ),
40 );
41 }
42 else {
43 $form['quotes_data']['quotes_format'] = array(
44 '#type' => 'value',
45 '#value' => 'single',
46 );
47 }
48
49 $form['quotes_data']['body'] = array(
50 '#type' => 'textarea',
51 '#title' => t('Quote'),
52 '#required' => TRUE,
53 '#rows' => 10,
54 '#default_value' => $node->body,
55 '#description' => t('Enter the text of the quote or the group of quotes to be imported.'),
56 );
57
58 $form['quotes_data']['quotes_author'] = array(
59 '#type' => 'textarea',
60 '#title' => t('Author'),
61 '#rows' => 2,
62 '#maxlength' => 1023,
63 '#default_value' => $node->quotes_author,
64 );
65
66 $form['quotes_data']['quotes_citation'] = array(
67 '#type' => 'textarea',
68 '#title' => t('Citation'),
69 '#rows' => 2,
70 '#maxlength' => 1023,
71 '#default_value' => $node->quotes_citation,
72 '#text_format' => $node->format,
73 );
74
75 if (user_access('promote quotes to block')) {
76 $form['quotes_data']['quotes_promote'] = array(
77 '#type' => 'checkbox',
78 '#title' => t('Display in quote blocks'),
79 '#default_value' => (isset($node->quotes_promote) ? $node->quotes_promote : 1),
80 );
81 }
82
83 $form['#redirect'] = 'quotes';
84
85 return $form;
86 }
87
88 /**
89 * Implements hook_validate().
90 */
91 function quotes_validate($node, &$form) {
92 // Bail if we are doing a single quote.
93 if ($node->quotes_format == 'single') {
94 return;
95 }
96
97 _quotes_parse_import($node, TRUE);
98 }

  ViewVC Help
Powered by ViewVC 1.1.2