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

Contents of /contributions/modules/tag_editor/tag_editor.module

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


Revision 1.2 - (show annotations) (download) (as text)
Wed Dec 10 22:24:41 2008 UTC (11 months, 2 weeks ago) by Gurpartap
Branch: MAIN
CVS Tags: DRUPAL-6--0-2, HEAD
Changes since 1.1: +9 -0 lines
File MIME type: text/x-php
Added comments to all functions in module and JS
1 <?php
2 // $Id: Exp $
3
4 /**
5 * Implementation of hook_nodeapi().
6 */
7 function tag_editor_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
8 if ($op == 'prepare') {
9 $path = drupal_get_path('module', 'tag_editor');
10 $vocabulary_id = variable_get('tag_editor_tag_field', NULL);
11 drupal_add_js(array(
12 'tag_editor' => array(
13 'tag_field' => 'edit-taxonomy-tags-' . $vocabulary_id,
14 ),
15 ), 'setting');
16 drupal_add_js($path . '/scripts/tag_editor.js');
17 drupal_add_css($path . '/scripts/tag_editor.css');
18 }
19 }
20
21 /**
22 * Implementation of hook_menu().
23 */
24 function tag_editor_menu() {
25 $items = array();
26
27 $items['admin/settings/tag_editor'] = array(
28 'title' => t('Tag editor'),
29 'description' => t('Configure the tag editor for a specific "Tags"-enabled vocabulary.'),
30 'page callback' => 'drupal_get_form',
31 'page arguments' => array('tag_editor_settings'),
32 'access arguments' => array('administer site configuration'),
33 'type' => MENU_NORMAL_ITEM,
34 );
35
36 return $items;
37 }
38
39 /**
40 * Menu callback; Returns settings form.
41 */
42 function tag_editor_settings() {
43 $form = array();
44
45 $form['tag_editor_tag_field'] = array(
46 '#type' => 'textfield',
47 '#title' => t('Vocabulary ID'),
48 '#prefix' => '<div class="container-inline">',
49 '#suffix' => '</div>',
50 '#description' => t('Configure the tag editor for a specific "Tags"-enabled vocabulary.'),
51 '#default_value' => variable_get('tag_editor_tag_field', NULL),
52 '#required' => TRUE,
53 '#size' => 2,
54 );
55
56 return system_settings_form($form);
57 }

  ViewVC Help
Powered by ViewVC 1.1.2