Projet

Général

Profil

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

root / drupal7 / sites / all / themes / adminimal_theme / theme-settings.php @ 87dbc3bf

1
<?php
2

    
3

    
4
/**
5
 * @file
6
 * Theme setting callbacks for the Adminimal theme.
7
 */
8

    
9
/**
10
 * Implements hook_form_FORM_ID_alter().
11
 *
12
 * @param $form
13
 *   The form.
14
 * @param $form_state
15
 *   The form state.
16
 */
17
function adminimal_form_system_theme_settings_alter(&$form, &$form_state) {
18

    
19
  // Get adminimal theme path.
20
  $adminimal_path = drupal_get_path('theme', 'adminimal');
21
  $custom_css_path = $adminimal_path . '/css/custom.css';
22

    
23
  $form['adminimal_custom'] = array(
24
    '#type' => 'fieldset',
25
    '#title' => t('Adminimal Customization'),
26
    '#weight' => -10,
27
  );
28

    
29
  $form['adminimal_custom']['display_icons_config'] = array(
30
    '#type' => 'checkbox',
31
    '#title' => t('Display icons in Configuration page'),
32
    '#default_value' => theme_get_setting('display_icons_config'),
33
  );
34

    
35
  $form['adminimal_custom']['use_custom_media_queries'] = array(
36
    '#type' => 'checkbox',
37
    '#title' => t('Use Custom Media Queries'),
38
    '#description' => t('You can override the mobile and tablet media queries from this option. Use it only if you know what media queries are and how to use them.'),
39
    '#default_value' => theme_get_setting('use_custom_media_queries'),
40
  );
41

    
42
  $form['adminimal_custom']['media_queries'] = array(
43
    '#type' => 'fieldset',
44
    '#title' => t('Custom Media Queries'),
45
    '#states' => array(
46
      // Hide the settings when the cancel notify checkbox is disabled.
47
      'visible' => array(
48
       ':input[name="use_custom_media_queries"]' => array('checked' => TRUE),
49
      ),
50
     ),
51
  );
52

    
53
  $form['adminimal_custom']['media_queries']['media_query_mobile'] = array(
54
    '#type' => 'textfield',
55
    '#title' => t('Mobile media query'),
56
    '#description' => t('The media query to load the mobile.css styles.'),
57
    '#default_value' => theme_get_setting('media_query_mobile'),
58
  );
59

    
60
  $form['adminimal_custom']['media_queries']['media_query_tablet'] = array(
61
    '#type' => 'textfield',
62
    '#title' => t('Tablet media query'),
63
    '#description' => t('The media query to load the tablet.css styles.'),
64
    '#default_value' => theme_get_setting('media_query_tablet'),
65
  );
66

    
67
  $form['adminimal_custom']['custom_css'] = array(
68
    '#type' => 'checkbox',
69
    '#title' => t('Use "custom.css"'),
70
    '#description' => t('Include custom.css file to override default Adminimal styles
71
     or add additional styles without subthememing/hacking Adminimal Theme.'),
72
    '#default_value' => theme_get_setting('custom_css'),
73
  );
74

    
75
  $form['adminimal_custom']['adminimal_custom_check'] = array(
76
    '#type' => 'fieldset',
77
    '#title' => t('Custom CSS file check'),
78
    '#weight' => 50,
79
    '#states' => array(
80
      // Hide the settings when the cancel notify checkbox is disabled.
81
      'visible' => array(
82
       ':input[name="custom_css"]' => array('checked' => TRUE),
83
      ),
84
     ),
85
  );
86

    
87
  if (file_exists($custom_css_path)) {
88
    $form['adminimal_custom']['adminimal_custom_check']['custom_css_description'] = array(
89
      '#markup' => t('Custom CSS file Found in: !css', array('!css' => "<span class='css_path'>" . $custom_css_path . "</span>")),
90
      '#prefix' => '<div class="messages status custom_css_found">',
91
      '#suffix' => '</div>',
92
    );
93
  }
94
  else {
95
    $form['adminimal_custom']['adminimal_custom_check']['custom_css_not_found'] = array(
96
      '#markup' => t('Custom CSS file not found. You must create the !css file manually.', array('!css' => "<span class='css_path'>" . $custom_css_path . "</span>")),
97
      '#prefix' => '<div class="messages error custom_css_not_found">',
98
      '#suffix' => '</div>',
99
    );
100
  }
101
}