Révision 74f6bef0
Ajouté par Assos Assos il y a plus de 10 ans
drupal7/sites/all/themes/adaptivetheme/at_core/inc/forms/settings.headings.inc | ||
---|---|---|
4 | 4 |
* @file |
5 | 5 |
* Generate form elments for the Headings Styles settings. |
6 | 6 |
*/ |
7 |
function at_core_headings_form(&$form) { |
|
8 |
// Title styles |
|
9 |
$form['at']['titles'] = array( |
|
10 |
'#type' => 'fieldset', |
|
11 |
'#title' => t('Title Styles'), |
|
12 |
'#description' => t('<h3>Title Styles</h3><p>Add extra styles to headings. Text shadows only work for CSS3 capable browsers such as Firefox, Safari, IE9 etc.</p>'), |
|
13 |
'#weight' => -100, |
|
14 |
); |
|
7 | 15 |
|
8 |
// Title styles |
|
9 |
$form['at']['titles'] = array( |
|
10 |
'#type' => 'fieldset', |
|
11 |
'#title' => t('Title Styles'), |
|
12 |
'#description' => t('<h3>Title Styles</h3><p>Add extra styles to headings. Text shadows only work for CSS3 capable browsers such as Firefox, Safari, IE9 etc.</p>'), |
|
13 |
'#weight' => -100, |
|
14 |
); |
|
16 |
// Array of valid title types |
|
17 |
$headings_valid_types = array( |
|
18 |
'site_name', |
|
19 |
'site_slogan', |
|
20 |
'page_title', |
|
21 |
'node_title', |
|
22 |
'block_title', |
|
23 |
'comment_title', |
|
24 |
); |
|
15 | 25 |
|
16 |
// Array of valid title types |
|
17 |
$headings_valid_types = array( |
|
18 |
'site_name', |
|
19 |
'site_slogan', |
|
20 |
'page_title', |
|
21 |
'node_title', |
|
22 |
'block_title', |
|
23 |
'comment_title', |
|
24 |
); |
|
26 |
// Get the fonts list |
|
27 |
$form_elements = font_elements(); |
|
25 | 28 |
|
26 |
// Get the fonts list |
|
27 |
$form_elements = font_elements(); |
|
29 |
foreach ($form_elements as $key => $value) { |
|
28 | 30 |
|
29 |
foreach ($form_elements as $key => $value) {
|
|
31 |
$heading = $key;
|
|
30 | 32 |
|
31 |
$heading = $key;
|
|
33 |
if (in_array($heading, $headings_valid_types)) {
|
|
32 | 34 |
|
33 |
if (in_array($heading, $headings_valid_types)) { |
|
35 |
$element = $value['element']; // e.g. "ptf" (page_title_font), this is used to set array keys and eventually body classes |
|
36 |
$setting = $heading; // use the key for these settings, it doesnt have "font" in it |
|
37 |
$container = $value['setting']; // the theme setting used to retrieve the font values, e.g. "site_name_font" |
|
34 | 38 |
|
35 |
$element = $value['element']; // e.g. "ptf" (page_title_font), this is used to set array keys and eventually body classes |
|
36 |
$setting = $heading; // use the key for these settings, it doesnt have "font" in it |
|
37 |
$container = $value['setting']; // the theme setting used to retrieve the font values, e.g. "site_name_font" |
|
39 |
$setting_container = str_replace('_', '-', $container) . '-style'; // a nicer string for fielset classes |
|
40 |
$title = str_replace('_', ' ', drupal_ucfirst($heading)); // use the key for titles, it doesnt have "font" in it |
|
38 | 41 |
|
39 |
$setting_container = str_replace('_', '-', $container) . '-style'; // a nicer string for fielset classes |
|
40 |
$title = str_replace('_', ' ', drupal_ucfirst($heading)); // use the key for titles, it doesnt have "font" in it |
|
42 |
// Set easy reusable variables |
|
43 |
$setting_case = $setting . '_case'; |
|
44 |
$setting_weight = $setting . '_weight'; |
|
45 |
$setting_alignment = $setting . '_alignment'; |
|
46 |
$setting_shadow = $setting . '_shadow'; |
|
41 | 47 |
|
42 |
// Set easy reusable variables |
|
43 |
$setting_case = $setting . '_case'; |
|
44 |
$setting_weight = $setting . '_weight'; |
|
45 |
$setting_alignment = $setting . '_alignment'; |
|
46 |
$setting_shadow = $setting . '_shadow'; |
|
48 |
// Fieldset wrapper for each title |
|
49 |
$form['at']['titles']['' . $setting_container . ''] = array( |
|
50 |
'#type' => 'fieldset', |
|
51 |
'#title' => t($title), |
|
52 |
'#description' => t("<strong>$title</strong>"), |
|
53 |
'#attributes' => array('class' => array('headings-styles-wrapper')), |
|
54 |
); |
|
47 | 55 |
|
48 |
// Fieldset wrapper for each title
|
|
49 |
$form['at']['titles']['' . $setting_container . ''] = array(
|
|
50 |
'#type' => 'fieldset',
|
|
51 |
'#title' => t($title),
|
|
52 |
'#description' => t("<strong>$title</strong>"),
|
|
53 |
'#attributes' => array('class' => array('headings-styles-wrapper')),
|
|
54 |
); |
|
56 |
// Case
|
|
57 |
$form['at']['titles']['' . $setting_container . '']['' . $setting_case . ''] = array(
|
|
58 |
'#type' => 'select',
|
|
59 |
'#title' => t('Case'),
|
|
60 |
'#default_value' => at_get_setting($setting_case),
|
|
61 |
'#options' => font_style_options('case', $element),
|
|
62 |
);
|
|
55 | 63 |
|
56 |
// Case
|
|
57 |
$form['at']['titles']['' . $setting_container . '']['' . $setting_case . ''] = array(
|
|
58 |
'#type' => 'select', |
|
59 |
'#title' => t('Case'),
|
|
60 |
'#default_value' => at_get_setting($setting_case),
|
|
61 |
'#options' => font_style_options('case', $element),
|
|
62 |
); |
|
64 |
// Weight
|
|
65 |
$form['at']['titles']['' . $setting_container . '']['' . $setting_weight . ''] = array(
|
|
66 |
'#type' => 'select',
|
|
67 |
'#title' => t('Weight'),
|
|
68 |
'#default_value' => at_get_setting($setting_weight),
|
|
69 |
'#options' => font_style_options('weight', $element),
|
|
70 |
);
|
|
63 | 71 |
|
64 |
// Weight
|
|
65 |
$form['at']['titles']['' . $setting_container . '']['' . $setting_weight . ''] = array(
|
|
66 |
'#type' => 'select', |
|
67 |
'#title' => t('Weight'),
|
|
68 |
'#default_value' => at_get_setting($setting_weight),
|
|
69 |
'#options' => font_style_options('weight', $element),
|
|
70 |
); |
|
72 |
// Alignment
|
|
73 |
$form['at']['titles']['' . $setting_container . '']['' . $setting_alignment . ''] = array(
|
|
74 |
'#type' => 'select',
|
|
75 |
'#title' => t('Alignment'),
|
|
76 |
'#default_value' => at_get_setting($setting_alignment),
|
|
77 |
'#options' => font_style_options('alignment', $element),
|
|
78 |
);
|
|
71 | 79 |
|
72 |
// Alignment |
|
73 |
$form['at']['titles']['' . $setting_container . '']['' . $setting_alignment . ''] = array( |
|
74 |
'#type' => 'select', |
|
75 |
'#title' => t('Alignment'), |
|
76 |
'#default_value' => at_get_setting($setting_alignment), |
|
77 |
'#options' => font_style_options('alignment', $element), |
|
78 |
); |
|
79 |
|
|
80 |
// Text shadow |
|
81 |
$form['at']['titles']['' . $setting_container . '']['' . $setting_shadow . ''] = array( |
|
82 |
'#type' => 'select', |
|
83 |
'#title' => t('Shadow'), |
|
84 |
'#default_value' => at_get_setting($setting_shadow), |
|
85 |
'#options' => font_style_options('shadow', $element), |
|
86 |
); |
|
80 |
// Text shadow |
|
81 |
$form['at']['titles']['' . $setting_container . '']['' . $setting_shadow . ''] = array( |
|
82 |
'#type' => 'select', |
|
83 |
'#title' => t('Shadow'), |
|
84 |
'#default_value' => at_get_setting($setting_shadow), |
|
85 |
'#options' => font_style_options('shadow', $element), |
|
86 |
); |
|
87 |
} |
|
87 | 88 |
} |
88 | 89 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules