/[drupal]/contributions/modules/nodecloud/nodecloud.module
ViewVC logotype

Contents of /contributions/modules/nodecloud/nodecloud.module

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


Revision 1.3 - (show annotations) (download) (as text)
Fri Apr 25 07:03:30 2008 UTC (19 months ago) by herc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +3 -4 lines
File MIME type: text/x-php
settings form migrated to 6.x FAPI
1 <?php
2 // $Id: nodecloud.module,v 1.2 2008/04/25 06:51:23 herc Exp $
3
4 define(NODECLOUD_MIN, .8);
5 define(NODECLOUD_MAX, 2.5);
6
7 /**
8 * Implementation of hook_menu().
9 */
10 function nodecloud_menu() {
11 $items['admin/settings/nodecloud'] = array(
12 'title' => 'Node Cloud',
13 'description' => 'Set the site wide settings for Node Cloud',
14 'page callback' => 'drupal_get_form',
15 'page arguments' => array('nodecloud_settings'),
16 'access arguments' => array('administer site configuration'),
17 'type' => MENU_NORMAL_ITEM
18 );
19 return $items;
20 }
21
22 /**
23 * Menu callback; presents general configuration options.
24 */
25 function nodecloud_settings() {
26 $form['nodecloud_min'] = array(
27 '#type' => 'textfield',
28 '#title' => t('Minimum font size (in "EM" units)'),
29 '#default_value' => variable_get('nodecloud_min', NODECLOUD_MIN)
30 );
31 $form['nodecloud_max'] = array(
32 '#type' => 'textfield',
33 '#title' => t('Maximum font size (in "EM" units)'),
34 '#default_value' => variable_get('nodecloud_max', NODECLOUD_MAX)
35 );
36 return system_settings_form($form);
37 }
38
39 function nodecloud_settings_validate($form, &$form_state) {
40 if ($form_state['values']['nodecloud_min'] == 0) {
41 form_set_error('nodecloud_min', t("You can not use 0 as a minimum value"));
42 }
43 if ($form_state['values']['nodecloud_max'] <= $form_state['values']['nodecloud_min']) {
44 form_set_error('nodecloud_max', t("The maximum value must be greater than the minimim value"));
45 }
46 }
47
48

  ViewVC Help
Powered by ViewVC 1.1.2