Projet

Général

Profil

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

root / drupal7 / sites / all / themes / adaptivetheme / at_core / inc / forms / at_core.submit.inc @ a08833bd

1
<?php
2

    
3
/**
4
 * @file
5
 * Process all form values. Uses multiple other include files and helper
6
 * functions to handle various operations.
7
 */
8
global $path_to_at_core;
9
$path_to_at_core = drupal_get_path('theme', 'adaptivetheme');
10

    
11
// Helper functions for processing the page layout and font families.
12
include($path_to_at_core . '/inc/forms/at_core.submit.builders.inc');
13

    
14
/**
15
 * Custom submit function - this mostly builds and saves stylesheets for
16
 * various features such as the responsive layout and font styles.
17
 *
18
 * @param $form
19
 * @param $form_state
20
 */
21
function at_core_settings_submit($form, &$form_state) {
22
  global $path_to_at_core;
23

    
24
  // Set form_state values into one variable
25
  $values = $form_state['values'];
26

    
27
  // Get the active theme name, $theme_key will return the admin theme
28
  $theme_name = $form_state['build_info']['args'][0];
29

    
30
  // Set values for our three possible paths to the generated files
31
  $public_files = 'public://adaptivetheme/' . $theme_name . '_files';
32
  $theme_directory = drupal_get_path('theme', $theme_name) . '/generated_files';
33
  $custom_path = $values['custom_files_path'];
34

    
35
  // Set the path variable to the right path
36
  if ($values['global_files_path'] === 'public_files') {
37
    $path = $public_files;
38
  }
39
  elseif ($values['global_files_path'] === 'theme_directory') {
40
    $path = $theme_directory;
41
  }
42
  elseif ($values['global_files_path'] === 'custom_path') {
43
    $path = $custom_path;
44
  }
45
  $values['path'] = $path;
46

    
47
  // Set up the files directory for the generated files
48
  file_prepare_directory($path, FILE_CREATE_DIRECTORY);
49
  variable_set('theme_' . $theme_name . '_files_directory', $path);
50

    
51
  // Include processing for automagical info builder
52
  require_once($path_to_at_core . '/inc/forms/at_core.submit.info.inc');
53
  at_core_submit_info($values, $theme_name, $path);
54

    
55
  // Include processing for page & panels layouts, and responsive styles
56
  require_once($path_to_at_core . '/inc/forms/at_core.submit.responsive.inc');
57
  at_core_submit_reponsive($values, $theme_name, $path);
58

    
59
  if ($values['enable_extensions'] === 1) {
60
    // Include processing for fonts
61
    if (isset($values['enable_font_settings']) && $values['enable_font_settings'] === 1) {
62
      require_once($path_to_at_core . '/inc/fonts.inc');
63
      require_once($path_to_at_core . '/inc/forms/at_core.submit.fonts.inc');
64
      at_core_submit_fonts($values, $theme_name, $path);
65
    }
66
    // Include processing for Custom CSS
67
    if (isset($values['enable_custom_css']) && $values['enable_custom_css'] === 1) {
68
      require_once($path_to_at_core . '/inc/forms/at_core.submit.customcss.inc');
69
      at_core_submit_custom_css($values, $theme_name, $path);
70
    }
71
    // Include processing for the Menu Toggle
72
    if (isset($values['enable_menu_toggle']) && $values['enable_menu_toggle'] === 1) {
73
      require_once($path_to_at_core . '/inc/forms/at_core.submit.menutoggle.inc');
74
      at_core_submit_menu_toggle($values, $theme_name, $path);
75
    }
76
    // Set variables for device detection environment
77
    variable_set('at_detection', isset($values['detection']) ? $values['detection'] : FALSE);
78
    variable_set('at_browscap_detect', isset($values['browscap_detect']) ? $values['browscap_detect'] : FALSE);
79
    variable_set('at_mobile_detect', isset($values['mobile_detect']) ? $values['mobile_detect'] : FALSE);
80
  }
81

    
82
  // Color inc save
83
  if (module_exists('color')) {
84
    if (isset($values['at-color']) && $values['at-color'] == TRUE) {
85
      require_once($path_to_at_core . '/inc/forms/at_core.submit.color.inc');
86
      at_core_submit_color($values, $theme_name, $path);
87
    }
88
  }
89

    
90
  // Change query-strings on css/js files to enforce reload for all users.
91
  _drupal_flush_css_js();
92

    
93
  // Clear the aggregated file caches to update changes
94
  if (variable_get('preprocess_css', '') == 1) {
95
    drupal_clear_css_cache();
96
  }
97
  if (variable_get('preprocess_js', '') == 1) {
98
    drupal_clear_js_cache();
99
  }
100
}