/[drupal]/contributions/modules/taxonomy_hide/taxonomy_hide.admin.inc
ViewVC logotype

Diff of /contributions/modules/taxonomy_hide/taxonomy_hide.admin.inc

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

revision 1.1, Sun May 11 04:38:51 2008 UTC revision 1.1.2.1, Sun May 11 04:38:51 2008 UTC
# Line 0  Line 1 
1    <?php
2    // $Id: $
3    
4    /**
5     * Menu callback for administration settings.
6     */
7    function _taxonomy_hide_admin_settings() {
8      $form['taxonomy_hide_group_by_vocabulary'] = array(
9        '#type'           => 'checkbox',
10        '#title'          => t('Group by vocabulary'),
11        '#default_value'  => variable_get('taxonomy_hide_group_by_vocabulary', 0),
12        '#description'    => t('Check this box to group terms by vocabulary in node views.'),
13      );
14      $form['taxonomy_hide'] = array(
15        '#type'           => 'fieldset',
16        '#title'          => t('Vocabulary settings'),
17      );
18    
19      // Note that the settings will be saved as an array whose keys are the
20      // vocabulary ids ($vid) and whose values are 0 (disabled) or $vid (enabled).
21      //
22      // The default_value should be an array whose values are the enabled
23      // vocabulary ids.
24      //
25      // The options should be an array whose keys are the vocabulary ids, and whose
26      // values are the names of the vocabularies.
27      $select = array();
28      $vocabularies = taxonomy_get_vocabularies();
29      foreach ($vocabularies as $vocabulary) {
30        $select[$vocabulary->vid] = $vocabulary->name;
31      }
32      $form['taxonomy_hide']['taxonomy_hide_vocabularies'] = array(
33        '#type'           => 'checkboxes',
34        '#title'          => t('Hide vocabularies'),
35        '#default_value'  => array_keys(array_filter(variable_get('taxonomy_hide_vocabularies', array()))),
36        '#options'        => $select,
37        '#description'    => t('Select the vocabularies whose terms should disappear from node views'),
38        '#multiple'       => true,
39      );
40    
41    
42      // Fieldset holding checkboxes for node type settings
43      $form['node_types'] = array(
44        '#description'  => t('Filters for node types. Node type settings will override the default filters. If none are checked for a type, the default filter will be used.'),
45        '#collapsible'  => TRUE,
46        '#collapsed'    => TRUE,
47        '#title'        => t('Vocabulary filters for each node type'),
48        '#type'         => 'fieldset',
49      );
50    
51      $node_types = node_get_types();
52      foreach ($node_types as $type) {
53        $select = array();
54        $vocabularies = taxonomy_get_vocabularies($type->type);
55        if ($vocabularies) {
56          foreach ($vocabularies as $vocabulary) {
57            $select[$vocabulary->vid] = $vocabulary->name;
58          }
59          $form['node_types']['taxonomy_hide_vocabularies_'.$type->type] = array(
60            '#default_value'  => array_keys(array_filter(variable_get('taxonomy_hide_vocabularies_'.$type->type, array()))),
61            '#options'        => $select,
62            '#type'           => 'checkboxes',
63            '#title'          => t('Hide vocabularies for '.$type->name),
64          );
65        }
66      }
67    
68      return system_settings_form($form);
69    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

  ViewVC Help
Powered by ViewVC 1.1.2