Projet

Général

Profil

Paste
Télécharger (3,02 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / rubik / theme-settings.php @ 4b706e38

1
<?php
2
/**
3
 * Implements hook_form_system_theme_settings_alter() function.
4
 *
5
 * @param $form
6
 *   Nested array of form elements that comprise the form.
7
 * @param $form_state
8
 *   A keyed array containing the current state of the form.
9
 */
10
function rubik_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL) {
11
  // Work-around for a core bug affecting admin themes. See issue #943212.
12
  if (isset($form_id)) {
13
    return;
14
  }
15

    
16
  $form['rubik'] = array(
17
    '#type' => 'fieldset',
18
    '#title' => t('Rubik'),
19
  );
20
  $form['rubik']['rubik_show_branding'] = array(
21
    '#type' => 'checkbox',
22
    '#title' => t('Show branding'),
23
    '#description' => t('Display the "branding" line at the top of the page with breadcrumbs and secondary menu.'),
24
    '#default_value' => theme_get_setting('rubik_show_branding', 'rubik'),
25
  );
26
  $form['rubik']['rubik_inline_field_descriptions'] = array(
27
    '#type' => 'checkbox',
28
    '#title' => t('Display form field descriptions inline.'),
29
    '#description' => t("By default, each field's description is displayed in a pop-up, which is only visible when hovering over that field. Select this option to make all field descriptions visible at all times."),
30
    '#default_value' => theme_get_setting('rubik_inline_field_descriptions', 'rubik'),
31
  );
32
  $form['rubik']['rubik_disable_sticky_sidebar'] = array(
33
    '#type' => 'checkbox',
34
    '#title' => t('Disable sticky sidebar'),
35
    '#description' => t("By default, the sidebar will fix itself when scrolling down a form. If you have a lot of fields in the sidebar, consider disabling the sticky sidebar to view them all."),
36
    '#default_value' => theme_get_setting('rubik_disable_sticky_sidebar', 'rubik'),
37
  );
38
  $form['rubik']['rubik_disable_sidebar_in_form'] = array(
39
    '#type' => 'checkbox',
40
    '#title' => t('Disable sidebar in forms'),
41
    '#description' => t("By default, the sidebar is enabled for forms."),
42
    '#default_value' => theme_get_setting('rubik_disable_sidebar_in_form', 'rubik'),
43
  );
44
  $form['rubik']['rubik_sidebar_field_ui'] = array(
45
    '#type' => 'checkbox',
46
    '#title' => t('Display fields in the sidebar of the node edit form.'),
47
    '#description' => t("By default, each field is displayed in the main content area of the node edit form. This option allows you to move fields into the sidebar to improve user experience."),
48
    '#default_value' => theme_get_setting('rubik_sidebar_field_ui', 'rubik'),
49
    '#states' => array(
50
      'invisible' => array(
51
        ':input[name="rubik_disable_sidebar_in_form"]' => array('checked' => TRUE),
52
      ),
53
    ),
54
  );
55

    
56
  // If the sidebar is disabled, we need to disable the sidebar field ui as well.
57
  $rubik_disable_sidebar_in_form = theme_get_setting('rubik_disable_sidebar_in_form', 'rubik');
58
  if ($rubik_disable_sidebar_in_form == 1) {
59
    $form['rubik']['rubik_sidebar_field_ui']['#default_value'] = 0;
60
  }
61
  
62
  // Rebuild theme registry on form save.
63
  if (!empty($form_state)) {
64
    // Rebuild .info data.
65
    system_rebuild_theme_data();
66
    // Rebuild theme registry.
67
    drupal_theme_rebuild();
68
  }
69

    
70
}