Projet

Général

Profil

Révision e4c061ad

Ajouté par Assos Assos il y a plus de 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/themes/adminimal_theme/theme-settings.php
17 17
function adminimal_form_system_theme_settings_alter(&$form, &$form_state) {
18 18

  
19 19
  // Get adminimal theme path.
20
  global $base_url;
20 21
  $adminimal_path = drupal_get_path('theme', 'adminimal');
21
  $custom_css_path = $adminimal_path . '/css/custom.css';
22
  $old_css_path = $adminimal_path . '/css/custom.css';
23
  $custom_css_path = 'public://adminimal-custom.css';
24
  $custom_css_dir = str_replace($base_url . '/', "", file_create_url($custom_css_path));
25
  $custom_css_url = file_create_url($custom_css_path);
26

  
27
  // Try to create the adminimal-custom.css file automatically.
28
  if (!file_exists($custom_css_path)) {
29

  
30
    // Try to migrate from the old css.
31
    if (file_exists($old_css_path)) {
32
      file_unmanaged_copy($old_css_path, $custom_css_path, FILE_EXISTS_ERROR);
33
    }
34
    // Else create e new blank css file.
35
    else {
36
      file_unmanaged_save_data("", $custom_css_path, FILE_EXISTS_ERROR);
37
    }
38

  
39
  }
40

  
41
  // Notify user to remove his old css file.
42
  if (file_exists($old_css_path)) {
43
    drupal_set_message(t('Please delete the old @css_location file, as its no longer used.', array('@css_location file' => $old_css_path)), 'warning');
44
  }
22 45

  
23 46
  $form['adminimal_custom'] = array(
24 47
    '#type' => 'fieldset',
......
66 89

  
67 90
  $form['adminimal_custom']['custom_css'] = array(
68 91
    '#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.'),
92
    '#title' => t('Use "adminimal-custom.css"'),
93
    '#description' => t('Include adminimal-custom.css file to override or add custom css code without subthememing/hacking Adminimal Theme.'),
72 94
    '#default_value' => theme_get_setting('custom_css'),
73 95
  );
74 96

  
......
86 108

  
87 109
  if (file_exists($custom_css_path)) {
88 110
    $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>")),
111
      '#markup' => t('Custom CSS file Found in: !css', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")),
90 112
      '#prefix' => '<div class="messages status custom_css_found">',
91 113
      '#suffix' => '</div>',
92 114
    );
93 115
  }
94 116
  else {
95 117
    $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>")),
118
      '#markup' => t('Custom CSS file not found. You must create the !css file manually.', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")),
97 119
      '#prefix' => '<div class="messages error custom_css_not_found">',
98 120
      '#suffix' => '</div>',
99 121
    );

Formats disponibles : Unified diff