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

Diff of /contributions/modules/themefen/themefen.module

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

revision 1.2, Mon Jun 16 18:33:37 2008 UTC revision 1.3, Tue Jun 17 10:57:08 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: themefen.module,v 1.1 2008/06/16 16:58:49 kiam Exp $  // $Id: themefen.module,v 1.2 2008/06/16 18:33:37 kiam Exp $
3    
4  /**  /**
5   * @file   * @file
6   * Changes the theme settings form to make it use less space.   * Enhances the theme settings form.
7   */   */
8    
9  /***********************************************************************  /***********************************************************************
10   * Drupal hooks.   * Drupal hooks.
11   **********************************************************************/   **********************************************************************/
12    
13  /*  /**
14   * Implementation of hook_form_alter().   * Implementation of hook_form_alter().
15   */   */
16  function themefen_form_alter($form_id, &$form) {  function themefen_form_alter($form_id, &$form) {
# Line 19  function themefen_form_alter($form_id, & Line 19  function themefen_form_alter($form_id, &
19        $key = $form['var']['#value'];        $key = $form['var']['#value'];
20        if ($key == 'theme_settings') { /* The form is not specific to a theme. */        if ($key == 'theme_settings') { /* The form is not specific to a theme. */
21          if (isset($form['theme_settings']) && isset($form['node_info'])) {          if (isset($form['theme_settings']) && isset($form['node_info'])) {
22              // Change  the prefix, and postfix HTML of the fieldsets, if
23              // it has not been applied (themesettings.module usually
24              // does it).
25              if (isset($form['theme_settings']['#prefix'])) {
26                if (drupal_substr($form['theme_settings']['#prefix'], 0, drupal_strlen('<div class="clear-block">')) != '<div class="clear-block">') {
27                  $form['theme_settings']['#prefix'] = '<div class="clear-block">'. $form['theme_settings']['#prefix'];
28                  $form['node_info']['#suffix'] = $form['node_info']['#suffix'] .'</div>';
29                }
30              }
31    
32            // Wrap the 'theme_settings', and 'node_info' fieldsets in a            // Wrap the 'theme_settings', and 'node_info' fieldsets in a
33            // collapsible fieldset.            // collapsible fieldset.
34            $form['general_settings'] = array(            $form['general_settings'] = array(
# Line 32  function themefen_form_alter($form_id, & Line 42  function themefen_form_alter($form_id, &
42            // Remove the old filedsets from the form.            // Remove the old filedsets from the form.
43            unset($form['theme_settings']);            unset($form['theme_settings']);
44            unset($form['node_info']);            unset($form['node_info']);
45    
46              // Remove  the CSS class attribute from the logo (if
47              // themesettings.module didn't do it before).
48              if (isset($form['logo']['#attributes']['class'])) {
49                unset($form['logo']['#attributes']['class']);
50              }
51          }          }
52        }        }
53          // Remove not necessary fields (code taken by themesettings.module).
54          if (isset($form['favicon']['text']['#value'])) {
55            $form['favicon']['#description'] = $form['favicon']['text']['#value'];
56            unset($form['favicon']['text']);
57          }
58    
59          // Remove an erroneous attribute introduced by themesetytings.module.
60          if (isset($form['favicon']['#descripton'])) {
61            $form['favicon']['#description'] = $form['favicon']['#descripton'];
62            unset($form['favicon']['#descripton']);
63          }
64    
65        // Make all the fieldsets collapsible.        // Make all the fieldsets collapsible.
66        foreach ($form as $key => $value) {        foreach ($form as $key => $value) {
67          if (isset($value['#type']) && $value['#type'] == 'fieldset') {          if (isset($value['#type']) && $value['#type'] == 'fieldset') {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.2