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

Contents of /contributions/modules/active_tags/active_tags.module

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


Revision 1.2 - (show annotations) (download) (as text)
Fri Sep 12 09:28:44 2008 UTC (14 months, 1 week ago) by darrenmuk
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.1: +2 -2 lines
File MIME type: text/x-php
Added isset() check on vid for vocabulary add form
1 <?php
2 // $Id: active_tags.module,v 1.1 2008/09/12 08:31:03 darrenmuk Exp $
3
4 function active_tags_init() {
5 if (arg(2) == 'edit' || arg(1) == 'add') {
6 drupal_add_css(drupal_get_path('module', 'active_tags') . '/active_tags.css', 'module');
7 $settings = array();
8 foreach (taxonomy_get_vocabularies() as $id => $values) {
9 if (variable_get('active_tags_'.$id, 0) == 1) {
10 $settings[] = "#edit-taxonomy-tags-$id-wrapper";
11 }
12 }
13 drupal_add_js(array('active_tags' => $settings), 'setting');
14 drupal_add_js(drupal_get_path('module', 'active_tags') . '/active_tags.js', 'module');
15 }
16 }
17
18 function active_tags_form_alter(&$form, $form_state, $form_id) {
19 if ($form_id == 'taxonomy_form_vocabulary') {
20 $form['settings']['active_tags'] = array(
21 '#type' => 'checkbox',
22 '#title' => t('Active Tags'),
23 '#default_value' => (isset($form['vid'])) ? variable_get('active_tags_'.$form['vid']['#value'], 0) : 0,
24 '#description' => t('Swaps this vocabulary widget for an enhanced tag field if browser supports javascript.'),
25 );
26 $form['#submit'][] = 'active_tags_form_vocabulary_submit';
27 }
28 }
29
30 function active_tags_form_vocabulary_submit($form, &$form_state) {
31 variable_set('active_tags_'.$form_state['values']['vid'], $form_state['values']['active_tags']);
32 return true;
33 }
34
35
36

  ViewVC Help
Powered by ViewVC 1.1.2