diff --git a/at_core/inc/forms/at_core.submit.color.inc b/at_core/inc/forms/at_core.submit.color.inc index b60ac03..0283a34 100755 --- a/at_core/inc/forms/at_core.submit.color.inc +++ b/at_core/inc/forms/at_core.submit.color.inc @@ -13,22 +13,24 @@ * strings, which color module validates to avoid XSS. */ -$palette = $form_state['values']['palette']; +function at_core_submit_color(&$form_state) { + $palette = $form_state['values']['palette']; -if ($form_state['values']['info']['schemes']) { - $form_state['values']['info']['schemes']['']['colors'] = $palette; -} + if ($form_state['values']['info']['schemes']) { + $form_state['values']['info']['schemes']['']['colors'] = $palette; + } -$info = $form_state['values']['info']; + $info = $form_state['values']['info']; -$color_info = array(); -$color_info[] = " $value) { + // Find the right font for each element + foreach ($font_elements as $key => $value) { - // Each item in $font_elements has 3 key value pairs - $element = $value['element'] ? $value['element'] : ''; // a key to use later - $selector = $value['selector'] ? $value['selector'] : ''; // the selector to use when building the CSS - $setting = $value['setting'] ? $value['setting'] : ''; // the theme setting used to retrieve the font values + // Each item in $font_elements has 3 key value pairs + $element = $value['element'] ? $value['element'] : ''; // a key to use later + $selector = $value['selector'] ? $value['selector'] : ''; // the selector to use when building the CSS + $setting = $value['setting'] ? $value['setting'] : ''; // the theme setting used to retrieve the font values - // Deal with the custom CSS selectors. - if ($selector == 'custom_css' && !empty($values['selectors_css'])) { - $selector = filter_xss($values['selectors_css']); // sanitize user entered data - } - if ($selector == 'custom_css' && empty($values['selectors_css'])) { - $selector = 'ruby ruby'; // Valid but highly unlikely to ever match anything - } + // Deal with the custom CSS selectors. + if ($selector == 'custom_css' && !empty($values['selectors_css'])) { + $selector = filter_xss($values['selectors_css']); // sanitize user entered data + } + if ($selector == 'custom_css' && empty($values['selectors_css'])) { + $selector = 'ruby ruby'; // Valid but highly unlikely to ever match anything + } - // Get the font type if isset, not all font settings have a type - if (isset($values[$setting . '_type'])) { - $font_type = $values[$setting . '_type']; - } - else { - $font_type = ''; // this is an individual "in-content" heading - } + // Get the font type if isset, not all font settings have a type + if (isset($values[$setting . '_type'])) { + $font_type = $values[$setting . '_type']; + } + else { + $font_type = ''; // this is an individual "in-content" heading + } - // Get the font size if isset, not all font settings have size - if (isset($values[$setting . '_size'])) { - $font_size = $values[$setting . '_size']; - } - else { - $font_size = ''; // this is a grouped "in-content" heading or custom selectors - } + // Get the font size if isset, not all font settings have size + if (isset($values[$setting . '_size'])) { + $font_size = $values[$setting . '_size']; + } + else { + $font_size = ''; // this is a grouped "in-content" heading or custom selectors + } - // Get the font value (the font name or family) for the right font type if isset, - // not all font settings have a value - if (isset($values[$setting . (!empty($font_type) ? '_' . $font_type : '')])) { - $font_value = $values[$setting . (!empty($font_type) ? '_' . $font_type : '')]; - } + // Get the font value (the font name or family) for the right font type if isset, + // not all font settings have a value + if (isset($values[$setting . (!empty($font_type) ? '_' . $font_type : '')])) { + $font_value = $values[$setting . (!empty($font_type) ? '_' . $font_type : '')]; + } - // Initialize the $font_values array variables - $font_values['font_family'] = ''; - $font_values['font_size'] = ''; - $font_values['font_style'] = ''; - $font_values['font_weight'] = ''; + // Initialize the $font_values array variables + $font_values['font_family'] = ''; + $font_values['font_size'] = ''; + $font_values['font_style'] = ''; + $font_values['font_weight'] = ''; - // Some Content Headings have no type or family, we add these first, - // these are the h1 to h6 settings that only have a size - if ($font_type === '') { - $font_values['font_size'] = $font_size; + // Some Content Headings have no type or family, we add these first, + // these are the h1 to h6 settings that only have a size + if ($font_type === '') { + $font_values['font_size'] = $font_size; - // Add styles to the array for printing into the stylsheet - $font_styles_data[] = at_build_font_families($element, $selector, $font_values); - } + // Add styles to the array for printing into the stylsheet + $font_styles_data[] = at_build_font_families($element, $selector, $font_values); + } - // Websafe Fonts - if ($font_type === '') { - // Get a list of websafe fonts - $websafe_fonts = websafe_fonts_list($element); - // Loop over the websafe fonts list and get a match - foreach ($websafe_fonts as $k => $v) { - if ($k == $font_value) { - $font_family = $v; + // Websafe Fonts + if ($font_type === '') { + // Get a list of websafe fonts + $websafe_fonts = websafe_fonts_list($element); + // Loop over the websafe fonts list and get a match + foreach ($websafe_fonts as $k => $v) { + if ($k == $font_value) { + $font_family = $v; + } } - } - $font_values['font_family'] = $font_family; - $font_values['font_size'] = $font_size; + $font_values['font_family'] = $font_family; + $font_values['font_size'] = $font_size; - // Add styles to the array for printing into the stylsheet - $font_styles_data[] = at_build_font_families($element, $selector, $font_values); - } + // Add styles to the array for printing into the stylsheet + $font_styles_data[] = at_build_font_families($element, $selector, $font_values); + } - // Custom Font stacks (user entered data) - if ($font_type === 'cfs') { - $font_values['font_family'] = drupal_strip_dangerous_protocols($font_value); // sanitize user entered data - $font_values['font_size'] = $font_size; - // Add styles to the array for printing into the stylsheet - $font_styles_data[] = at_build_font_families($element, $selector, $font_values); - } + // Custom Font stacks (user entered data) + if ($font_type === 'cfs') { + $font_values['font_family'] = drupal_strip_dangerous_protocols($font_value); // sanitize user entered data + $font_values['font_size'] = $font_size; + // Add styles to the array for printing into the stylsheet + $font_styles_data[] = at_build_font_families($element, $selector, $font_values); + } - // Google Fonts (user entered data) - if ($font_type === 'gwf') { - $font_value = "'" . $font_value . "'"; - $font_values['font_family'] = filter_xss_admin($font_value); // sanitize user entered data - $font_values['font_size'] = $font_size; + // Google Fonts (user entered data) + if ($font_type === 'gwf') { + $font_value = "'" . $font_value . "'"; + $font_values['font_family'] = filter_xss_admin($font_value); // sanitize user entered data + $font_values['font_size'] = $font_size; - // Add styles to the array for printing into the stylsheet - $font_styles_data[] = at_build_font_families($element, $selector, $font_values); - } + // Add styles to the array for printing into the stylsheet + $font_styles_data[] = at_build_font_families($element, $selector, $font_values); + } - // Font Your Face - if ($font_your_face_enabled === TRUE) { - if ($font_type === 'fyf') { - // pull the font list, we need to iterate over it - $fyf_fonts = font_your_face_fonts_list($element); // this is a keyed array - // loop over fyf_fonts list and get a match and retrive the font name - foreach ($fyf_fonts as $k => $v) { - if ($k == $font_value) { - $font_value = $v; + // Font Your Face + if ($font_your_face_enabled === TRUE) { + if ($font_type === 'fyf') { + // pull the font list, we need to iterate over it + $fyf_fonts = font_your_face_fonts_list($element); // this is a keyed array + // loop over fyf_fonts list and get a match and retrive the font name + foreach ($fyf_fonts as $k => $v) { + if ($k == $font_value) { + $font_value = $v; + } } - } - // Get the font objects from font-your-face, we need additional data out - // of each object - $enabled_fonts = fontyourface_get_fonts('enabled = 1'); - foreach ($enabled_fonts as $font) { - // we need to know if the $font_value matches a $font->name - if ($font_value == $font->name) { - // Now we need a buch of variables to get the font family, style and weight - $font_values['font_family'] = $font->css_family ? $font->css_family : ''; - $font_values['font_style'] = $font->css_style ? $font->css_style : ''; - $font_values['font_weight'] = $font->css_weight ? $font->css_weight : ''; + // Get the font objects from font-your-face, we need additional data out + // of each object + $enabled_fonts = fontyourface_get_fonts('enabled = 1'); + foreach ($enabled_fonts as $font) { + // we need to know if the $font_value matches a $font->name + if ($font_value == $font->name) { + // Now we need a buch of variables to get the font family, style and weight + $font_values['font_family'] = $font->css_family ? $font->css_family : ''; + $font_values['font_style'] = $font->css_style ? $font->css_style : ''; + $font_values['font_weight'] = $font->css_weight ? $font->css_weight : ''; + } } + // Load the font size + $font_values['font_size'] = $font_size; + // Add styles to the array for printing into the stylsheet + $font_styles_data[] = at_build_font_families($element, $selector, $font_values); } - // Load the font size - $font_values['font_size'] = $font_size; - // Add styles to the array for printing into the stylsheet - $font_styles_data[] = at_build_font_families($element, $selector, $font_values); } } -} - -// Output data to file -if (!empty($font_styles_data)) { - $font_styles = implode("\n", $font_styles_data); - $font_styles = preg_replace('/^[ \t]*[\r\n]+/m', '', $font_styles); - $file_name = $theme_name . '.fonts.css'; - $filepath = "$path/$file_name"; - file_unmanaged_save_data($font_styles, $filepath, FILE_EXISTS_REPLACE); -} + + // Output data to file + if (!empty($font_styles_data)) { + $font_styles = implode("\n", $font_styles_data); + $font_styles = preg_replace('/^[ \t]*[\r\n]+/m', '', $font_styles); + $file_name = $theme_name . '.fonts.css'; + $filepath = "$path/$file_name"; + file_unmanaged_save_data($font_styles, $filepath, FILE_EXISTS_REPLACE); + } +} \ No newline at end of file diff --git a/at_core/inc/forms/at_core.submit.inc b/at_core/inc/forms/at_core.submit.inc index 14caed9..42c14f2 100755 --- a/at_core/inc/forms/at_core.submit.inc +++ b/at_core/inc/forms/at_core.submit.inc @@ -10,7 +10,7 @@ global $path_to_at_core; $path_to_at_core = drupal_get_path('theme', 'adaptivetheme'); // Helper functions for processing the page layout and font families. -require_once($path_to_at_core . '/inc/forms/at_core.submit.builders.inc'); +include($path_to_at_core . '/inc/forms/at_core.submit.builders.inc'); /** * Custom submit function - this mostly builds and saves stylesheets for diff --git a/at_core/inc/forms/at_core.submit.info.inc b/at_core/inc/forms/at_core.submit.info.inc index 3365874..1d1cbae 100755 --- a/at_core/inc/forms/at_core.submit.info.inc +++ b/at_core/inc/forms/at_core.submit.info.inc @@ -9,132 +9,135 @@ * theme settings as defaults. */ -$theme_settings = $values; -if ($theme_settings) { - $dynamic_settings_info = array(); - $static_settings_info = array(); - $lt = list_themes(); - foreach ($lt as $key => $value) { - if ($theme_name == $key) { - $this_themes_info = $lt[$theme_name]->info; - foreach ($this_themes_info as $k => $v) { - // Basic info - name, desc, base theme, release, core, engine and screenshot - if ($k == 'name') { - $static_settings_info[] = 'name = ' . $v; - } - if ($k == 'description') { - $v = $v ? $v : $theme_name . ' is rocking the hardest!'; - $static_settings_info[] = 'description = ' . $v; - } - if ($k == 'base theme') { - $static_settings_info[] = 'base theme = ' . $v; - } - if ($k == 'release') { - $static_settings_info[] = 'release = ' . $v; - } - if ($k == 'core') { - $static_settings_info[] = 'core = 7.x'; - } - if ($k == 'engine') { - $static_settings_info[] = 'engine = phptemplate'; - } - if ($k == 'screenshot') { - $static_settings_info[] = 'screenshot = screenshot.png'; - } - // Stylesheets - if ($k == 'stylesheets' && !empty($k)) { - foreach ($v as $media_target => $stylesheet_file) { - foreach ($stylesheet_file as $stylesheet_file_name => $stylesheet_file_path) { - $static_settings_info[] = "stylesheets[$media_target][] = $stylesheet_file_name"; +function at_core_submit_info(&$form_state) { + $values = $form_state['values']; + $theme_settings = $values; + if ($theme_settings) { + $dynamic_settings_info = array(); + $static_settings_info = array(); + $lt = list_themes(); + foreach ($lt as $key => $value) { + if ($theme_name == $key) { + $this_themes_info = $lt[$theme_name]->info; + foreach ($this_themes_info as $k => $v) { + // Basic info - name, desc, base theme, release, core, engine and screenshot + if ($k == 'name') { + $static_settings_info[] = 'name = ' . $v; + } + if ($k == 'description') { + $v = $v ? $v : $theme_name . ' is rocking the hardest!'; + $static_settings_info[] = 'description = ' . $v; + } + if ($k == 'base theme') { + $static_settings_info[] = 'base theme = ' . $v; + } + if ($k == 'release') { + $static_settings_info[] = 'release = ' . $v; + } + if ($k == 'core') { + $static_settings_info[] = 'core = 7.x'; + } + if ($k == 'engine') { + $static_settings_info[] = 'engine = phptemplate'; + } + if ($k == 'screenshot') { + $static_settings_info[] = 'screenshot = screenshot.png'; + } + // Stylesheets + if ($k == 'stylesheets' && !empty($k)) { + foreach ($v as $media_target => $stylesheet_file) { + foreach ($stylesheet_file as $stylesheet_file_name => $stylesheet_file_path) { + $static_settings_info[] = "stylesheets[$media_target][] = $stylesheet_file_name"; + } } } - } - // IE Stylesheets - if ($k == 'ie_stylesheets' && !empty($k)) { - foreach ($v as $media_target => $condition) { - foreach ($condition as $conditional_comment => $condition_file) { - foreach ($condition_file as $conditional_file_path) { - $static_settings_info[] = "ie_stylesheets[$media_target][$conditional_comment][] = $conditional_file_path"; + // IE Stylesheets + if ($k == 'ie_stylesheets' && !empty($k)) { + foreach ($v as $media_target => $condition) { + foreach ($condition as $conditional_comment => $condition_file) { + foreach ($condition_file as $conditional_file_path) { + $static_settings_info[] = "ie_stylesheets[$media_target][$conditional_comment][] = $conditional_file_path"; + } } } } - } - // Scripts - if ($k == 'scripts' && !empty($k)) { - foreach ($v as $script => $file) { - $static_settings_info[] = "scripts[] = $script"; + // Scripts + if ($k == 'scripts' && !empty($k)) { + foreach ($v as $script => $file) { + $static_settings_info[] = "scripts[] = $script"; + } } - } - // IE Scripts - if ($k == 'ie_scripts' && !empty($k)) { - foreach ($v as $condition => $condition_file) { - foreach ($condition_file as $conditional_file_path) { - $static_settings_info[] = "ie_scripts[$condition][] = $conditional_file_path"; + // IE Scripts + if ($k == 'ie_scripts' && !empty($k)) { + foreach ($v as $condition => $condition_file) { + foreach ($condition_file as $conditional_file_path) { + $static_settings_info[] = "ie_scripts[$condition][] = $conditional_file_path"; + } } } - } - // Regions - if ($k == 'regions') { - foreach ($v as $name => $label) { - $static_settings_info[] = "regions[$name] = $label"; + // Regions + if ($k == 'regions') { + foreach ($v as $name => $label) { + $static_settings_info[] = "regions[$name] = $label"; + } } - } - // Features - if ($k == 'features') { - foreach ($v as $feature_key => $feature) { - $static_settings_info[] = "features[] = $feature"; + // Features + if ($k == 'features') { + foreach ($v as $feature_key => $feature) { + $static_settings_info[] = "features[] = $feature"; + } } } } } - } - if (!empty($static_settings_info)) { - $static_settings = implode("\n", $static_settings_info); - } - // Might need to check this and add some more exclusions - $exclusions = array( - 'var', - 'default_logo', - 'logo_path', - 'logo_upload', - 'default_favicon', - 'favicon_path', - 'favicon_upload', - 'submit', - 'form_build_id', - 'form_token', - 'form_id', - 'check', - 'output', - 'op', - 'scheme', - 'palette', - 'theme', - 'info', - 'at-layout__active_tab', - 'at-settings__active_tab', - 'at__active_tab', - ); - foreach ($theme_settings as $setting_name => $setting_value) { - if ($setting_name == 'global_gutter_width') { - if (empty($setting_value)) { - $exclusions[] = 'global_gutter_width'; - } + if (!empty($static_settings_info)) { + $static_settings = implode("\n", $static_settings_info); } - if (isset($setting_value) && $setting_value !== '' && !in_array($setting_name, $exclusions)) { - if (empty($setting_value) && !is_numeric($setting_value)) { - $setting_value = "''"; + // Might need to check this and add some more exclusions + $exclusions = array( + 'var', + 'default_logo', + 'logo_path', + 'logo_upload', + 'default_favicon', + 'favicon_path', + 'favicon_upload', + 'submit', + 'form_build_id', + 'form_token', + 'form_id', + 'check', + 'output', + 'op', + 'scheme', + 'palette', + 'theme', + 'info', + 'at-layout__active_tab', + 'at-settings__active_tab', + 'at__active_tab', + ); + foreach ($theme_settings as $setting_name => $setting_value) { + if ($setting_name == 'global_gutter_width') { + if (empty($setting_value)) { + $exclusions[] = 'global_gutter_width'; + } + } + if (isset($setting_value) && $setting_value !== '' && !in_array($setting_name, $exclusions)) { + if (empty($setting_value) && !is_numeric($setting_value)) { + $setting_value = "''"; + } + $dynamic_settings_info[] = "settings[$setting_name] = $setting_value"; } - $dynamic_settings_info[] = "settings[$setting_name] = $setting_value"; + } + if (!empty($dynamic_settings_info)) { + $dynamic_settings_info = $dynamic_settings_info ? $dynamic_settings_info : "''"; + $dynamic_settings = implode("\n", $dynamic_settings_info); + } + if (!empty($static_settings_info) && !empty($dynamic_settings_info)) { + $combined_values = $static_settings . "\n" . $dynamic_settings; // ideally run a sanity check but all of them convert entities, which won't work for code + $filepath = $path . '/' . $theme_name . '_settings.info'; + file_unmanaged_save_data($combined_values, $filepath, FILE_EXISTS_REPLACE); } } - if (!empty($dynamic_settings_info)) { - $dynamic_settings_info = $dynamic_settings_info ? $dynamic_settings_info : "''"; - $dynamic_settings = implode("\n", $dynamic_settings_info); - } - if (!empty($static_settings_info) && !empty($dynamic_settings_info)) { - $combined_values = $static_settings . "\n" . $dynamic_settings; // ideally run a sanity check but all of them convert entities, which won't work for code - $filepath = $path . '/' . $theme_name . '_settings.info'; - file_unmanaged_save_data($combined_values, $filepath, FILE_EXISTS_REPLACE); - } -} +} \ No newline at end of file diff --git a/at_core/inc/forms/at_core.submit.responsive.inc b/at_core/inc/forms/at_core.submit.responsive.inc index c3b8fa7..42f59df 100755 --- a/at_core/inc/forms/at_core.submit.responsive.inc +++ b/at_core/inc/forms/at_core.submit.responsive.inc @@ -11,516 +11,519 @@ * default layout CSS file (for when desktop first method has been selected). */ -// Get the page layout config array -$layout_variables = page_layout(); +function at_core_submit_reponsive(&$form_state) { + $values = $form_state['values']; + // Get the page layout config array + $layout_variables = page_layout(); + + // $layouts will hold all the page level layouts + $layouts = array(); + + // Initialize the $is_default_layout variable, we use this to test against + $is_default_layout = $values['global_default_layout']; + + // Get the panels config array + $rpl = responsive_panels_data_structure(); + + // Not all layouts generate their Panels CSS, we need to add a float delcaration + // those that do + $float = ".at-panel .region {display:inline;float:left}"; + + // Holds all styles from the responsive stylesheets + $responsive_styles = array(); + + // Get the values for the panels layouts + unset($rpl['one']); // unset panels layout one, it has no layout data + foreach ($rpl as $grouped => $panels_layout_groups) { + foreach ($panels_layout_groups as $panel_layout_group) { + foreach ($panel_layout_group as $group_items => $item_value) { + $panel_subtypes[] = $item_value['theme']; + if (array_key_exists('styles', $item_value)) { + $panel_styles[] = $item_value['styles']; + } + } + } + } -// $layouts will hold all the page level layouts -$layouts = array(); + // If the Cascading media queries CSS file is enabled, load these styles first + if ($values['enable_custom_media_queries'] === 1) { + $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.custom.css', FALSE); + $responsive_styles[] = $responsive_css . "\n"; + } -// Initialize the $is_default_layout variable, we use this to test against -$is_default_layout = $values['global_default_layout']; + // Set variables for respond.js + $load_respondjs = FALSE; + if ($values['load_respondjs'] === 1) { + $load_respondjs = TRUE; + } -// Get the panels config array -$rpl = responsive_panels_data_structure(); + // Set variables for onmediaquery.js and media_queries.js + $responsive_js_css = ''; + $responsive_js = FALSE; + if ($values['load_onmediaqueryjs'] === 1 && $values['disable_responsive_styles'] === 0) { + $responsive_js = TRUE; + } + + // Gutter width + $gutters = "/* Gutters are not currently overridden in theme settings, but may be in theme CSS */"; + if (isset($values['enable_markup_overides']) && $values['enable_markup_overides'] === 1) { + if (isset($values['global_gutter_width']) && is_numeric($values['global_gutter_width'])) { + $gutter = check_plain($values['global_gutter_width']) . 'px'; + $gutters = "/* Gutters */" . "\n" . "#main-content,.block-inner,.pane-inner,.menu-wrapper,.branding-elements,.breadcrumb-wrapper,.attribution,.at-panel .rounded-corner,.block-panels-mini > .block-title,div.messages {margin-left:$gutter;margin-right:$gutter;} #content .panel-display,#content .panel-flexible {margin-left:-$gutter;margin-right:-$gutter;}"; + } + } -// Not all layouts generate their Panels CSS, we need to add a float delcaration -// those that do -$float = ".at-panel .region {display:inline;float:left}"; + // Smartphone Portrait + if ($values['smartphone_portrait_media_query']) { -// Holds all styles from the responsive stylesheets -$responsive_styles = array(); + $device = 'smartphone_portrait'; -// Get the values for the panels layouts -unset($rpl['one']); // unset panels layout one, it has no layout data -foreach ($rpl as $grouped => $panels_layout_groups) { - foreach ($panels_layout_groups as $panel_layout_group) { - foreach ($panel_layout_group as $group_items => $item_value) { - $panel_subtypes[] = $item_value['theme']; - if (array_key_exists('styles', $item_value)) { - $panel_styles[] = $item_value['styles']; + // Build an array of page layout settings values + foreach ($layout_variables as $key => $value) { + if (isset($values["$device" . '_' . "$value"])) { + $smartphone_portrait_layout_data[$value] = filter_xss_admin($values["$device" . '_' . "$value"]); } } - } -} - -// If the Cascading media queries CSS file is enabled, load these styles first -if ($values['enable_custom_media_queries'] === 1) { - $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.custom.css', FALSE); - $responsive_styles[] = $responsive_css . "\n"; -} - -// Set variables for respond.js -$load_respondjs = FALSE; -if ($values['load_respondjs'] === 1) { - $load_respondjs = TRUE; -} - -// Set variables for onmediaquery.js and media_queries.js -$responsive_js_css = ''; -$responsive_js = FALSE; -if ($values['load_onmediaqueryjs'] === 1 && $values['disable_responsive_styles'] === 0) { - $responsive_js = TRUE; -} - -// Gutter width -$gutters = "/* Gutters are not currently overridden in theme settings, but may be in theme CSS */"; -if (isset($values['enable_markup_overides']) && $values['enable_markup_overides'] === 1) { - if (isset($values['global_gutter_width']) && is_numeric($values['global_gutter_width'])) { - $gutter = check_plain($values['global_gutter_width']) . 'px'; - $gutters = "/* Gutters */" . "\n" . "#main-content,.block-inner,.pane-inner,.menu-wrapper,.branding-elements,.breadcrumb-wrapper,.attribution,.at-panel .rounded-corner,.block-panels-mini > .block-title,div.messages {margin-left:$gutter;margin-right:$gutter;} #content .panel-display,#content .panel-flexible {margin-left:-$gutter;margin-right:-$gutter;}"; - } -} + // In smartphone portrait we invoke the layout builder, but the values are not + // used since the CSS is actually hard coded. I have done this because, at some + // stage in the future this layout might not be hard coded and we might really + // need to return a dynamically built layout. Note that $layout is only ever + // used in desktop first - never in mobile first. + $layout = at_build_page_layout($smartphone_portrait_layout_data['layout'], $smartphone_portrait_layout_data['sidebar_first'], $smartphone_portrait_layout_data['sidebar_second'], $smartphone_portrait_layout_data['sidebar_unit']); + + $method = $smartphone_portrait_layout_data['layout']; + $comment = "/* $device $method */\n"; + $width = "\n" . '.container {width:' . $smartphone_portrait_layout_data['page_width'] . $smartphone_portrait_layout_data['page_unit'] . '}'; + $media_query = $smartphone_portrait_layout_data['media_query']; + + if ($responsive_js == TRUE) { + $responsive_js_css = 'html {font-family: smartphone_portrait} /* Font family for media_queries.js */'; + } + + // If mobile first then smartphone portrait needs to do nothing, else its + // problematic to set the layout later due to the cascade and inheritance + if ($is_default_layout === 'smartphone-portrait') { + $css = ''; + // If responsive js is TRUE we output the media query with CSS styles + if ($responsive_js == TRUE) { + $css = $comment . '@media ' . $media_query . ' {' . "\n" . $responsive_js_css . "\n" . '}'; + } + } + else { + // Smartphone portrait panels are all 100% width and stacked, we need to + // overpower the default layouts when in desktop first mode + $smartphone_portrait_panels_layout = '.at-panel .region,.at-panel .panel-row,.at-panel .panel-row .region,.at-panel .inset-wrapper{float:none;display:block;width:100%}'; -// Smartphone Portrait -if ($values['smartphone_portrait_media_query']) { + // Build the styles string + $styles = $width . "\n" . $layout . "\n" . $smartphone_portrait_panels_layout; - $device = 'smartphone_portrait'; + // Reset styles if we are loading responsive js + if ($responsive_js == TRUE) { + $styles = "\n" . $responsive_js_css . "\n" . $width . "\n" . $layout . "\n" . $smartphone_portrait_panels_layout; + } - // Build an array of page layout settings values - foreach ($layout_variables as $key => $value) { - if (isset($values["$device" . '_' . "$value"])) { - $smartphone_portrait_layout_data[$value] = filter_xss_admin($values["$device" . '_' . "$value"]); + // CSS wrapped in the media query + $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; } - } - // In smartphone portrait we invoke the layout builder, but the values are not - // used since the CSS is actually hard coded. I have done this because, at some - // stage in the future this layout might not be hard coded and we might really - // need to return a dynamically built layout. Note that $layout is only ever - // used in desktop first - never in mobile first. - $layout = at_build_page_layout($smartphone_portrait_layout_data['layout'], $smartphone_portrait_layout_data['sidebar_first'], $smartphone_portrait_layout_data['sidebar_second'], $smartphone_portrait_layout_data['sidebar_unit']); - - $method = $smartphone_portrait_layout_data['layout']; - $comment = "/* $device $method */\n"; - $width = "\n" . '.container {width:' . $smartphone_portrait_layout_data['page_width'] . $smartphone_portrait_layout_data['page_unit'] . '}'; - $media_query = $smartphone_portrait_layout_data['media_query']; - if ($responsive_js == TRUE) { - $responsive_js_css = 'html {font-family: smartphone_portrait} /* Font family for media_queries.js */'; + // Get and wrap the responsive CSS styles in the relative media query + $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.smartphone.portrait.css', FALSE); + $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; + + $layouts[] = $css; } - // If mobile first then smartphone portrait needs to do nothing, else its - // problematic to set the layout later due to the cascade and inheritance - if ($is_default_layout === 'smartphone-portrait') { - $css = ''; - // If responsive js is TRUE we output the media query with CSS styles - if ($responsive_js == TRUE) { - $css = $comment . '@media ' . $media_query . ' {' . "\n" . $responsive_js_css . "\n" . '}'; + // Smartphone Landscape + if ($values['smartphone_landscape_layout']) { + + $device = 'smartphone_landscape'; + + // Build an array of page layout settings values + foreach ($layout_variables as $key => $value) { + if (isset($values["$device" . '_' . "$value"])) { + $smartphone_landscape_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]); + } } - } - else { - // Smartphone portrait panels are all 100% width and stacked, we need to - // overpower the default layouts when in desktop first mode - $smartphone_portrait_panels_layout = '.at-panel .region,.at-panel .panel-row,.at-panel .panel-row .region,.at-panel .inset-wrapper{float:none;display:block;width:100%}'; + $layout = at_build_page_layout($smartphone_landscape_layout_data['layout'], $smartphone_landscape_layout_data['sidebar_first'], $smartphone_landscape_layout_data['sidebar_second'], $smartphone_landscape_layout_data['sidebar_unit']); + + $method = $smartphone_landscape_layout_data['layout']; + $comment = "/* $device $method */\n"; + $width = "\n" . '.container {width:' . $smartphone_landscape_layout_data['page_width'] . $smartphone_landscape_layout_data['page_unit'] . '}'; + $media_query = $smartphone_landscape_layout_data['media_query']; + + // Get the panel layout settings + foreach ($panel_subtypes as $subtype) { + $smartphone_landscape_panel_settings[] = $device . '_' . $subtype; + } + + foreach ($smartphone_landscape_panel_settings as $setting) { + if (!empty($values[$setting])) { + $option = $values[$setting]; + } + else { + // Provide a fallback layout in case settings fail during submit + $smartphone_landscape_panel_substr_setting = substr($setting, 21); + $smartphone_landscape_panel_substr_setting = str_replace('_', '-', $smartphone_landscape_panel_substr_setting) . '-stack'; + $option = $smartphone_landscape_panel_substr_setting; + } + $smartphone_landscape_panels_data[] = $option; + } + + // Generate the panels layouts + $smartphone_landscape_panels_css = at_build_panels_layout_css($panel_styles, $smartphone_landscape_panels_data); + $panels_layouts = $float . $smartphone_landscape_panels_css; // Build the styles string - $styles = $width . "\n" . $layout . "\n" . $smartphone_portrait_panels_layout; + $styles = $width . "\n" . $layout . "\n" . $panels_layouts; // Reset styles if we are loading responsive js if ($responsive_js == TRUE) { - $styles = "\n" . $responsive_js_css . "\n" . $width . "\n" . $layout . "\n" . $smartphone_portrait_panels_layout; + $responsive_js_css = "\n" . 'html {font-family: smartphone_landscape} /* Font family for media_queries.js */'; + $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; } // CSS wrapped in the media query $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; - } - // Get and wrap the responsive CSS styles in the relative media query - $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.smartphone.portrait.css', FALSE); - $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; + // Get and wrap the responsive CSS styles in the relative media query + $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.smartphone.landscape.css', FALSE); + $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; - $layouts[] = $css; -} - -// Smartphone Landscape -if ($values['smartphone_landscape_layout']) { - - $device = 'smartphone_landscape'; - - // Build an array of page layout settings values - foreach ($layout_variables as $key => $value) { - if (isset($values["$device" . '_' . "$value"])) { - $smartphone_landscape_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]); - } + $layouts[] = $css; } - $layout = at_build_page_layout($smartphone_landscape_layout_data['layout'], $smartphone_landscape_layout_data['sidebar_first'], $smartphone_landscape_layout_data['sidebar_second'], $smartphone_landscape_layout_data['sidebar_unit']); - $method = $smartphone_landscape_layout_data['layout']; - $comment = "/* $device $method */\n"; - $width = "\n" . '.container {width:' . $smartphone_landscape_layout_data['page_width'] . $smartphone_landscape_layout_data['page_unit'] . '}'; - $media_query = $smartphone_landscape_layout_data['media_query']; + // Tablet Portrait + if ($values['tablet_portrait_layout']) { - // Get the panel layout settings - foreach ($panel_subtypes as $subtype) { - $smartphone_landscape_panel_settings[] = $device . '_' . $subtype; - } + $device = 'tablet_portrait'; - foreach ($smartphone_landscape_panel_settings as $setting) { - if (!empty($values[$setting])) { - $option = $values[$setting]; + // Build an array of page layout settings values + foreach ($layout_variables as $key => $value) { + if (isset($values["$device" . '_' . "$value"])) { + $tablet_portrait_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]); + } } - else { - // Provide a fallback layout in case settings fail during submit - $smartphone_landscape_panel_substr_setting = substr($setting, 21); - $smartphone_landscape_panel_substr_setting = str_replace('_', '-', $smartphone_landscape_panel_substr_setting) . '-stack'; - $option = $smartphone_landscape_panel_substr_setting; + // Workaround upgrade issues for some settings + if ($tablet_portrait_layout_data['layout'] == 'two_col_stack') { + $tablet_portrait_layout_data['layout'] = 'two_sidebars_right_stack'; } - $smartphone_landscape_panels_data[] = $option; - } + $layout = at_build_page_layout($tablet_portrait_layout_data['layout'], $tablet_portrait_layout_data['sidebar_first'], $tablet_portrait_layout_data['sidebar_second'], $tablet_portrait_layout_data['sidebar_unit']); - // Generate the panels layouts - $smartphone_landscape_panels_css = at_build_panels_layout_css($panel_styles, $smartphone_landscape_panels_data); - $panels_layouts = $float . $smartphone_landscape_panels_css; + $method = $tablet_portrait_layout_data['layout']; + $comment = "/* $device $method */\n"; + $width = "\n" . '.container {width:' . $tablet_portrait_layout_data['page_width'] . $tablet_portrait_layout_data['page_unit'] . '}'; + $media_query = $tablet_portrait_layout_data['media_query']; - // Build the styles string - $styles = $width . "\n" . $layout . "\n" . $panels_layouts; + // Get the panel layout settings and CSS for these layouts + foreach ($panel_subtypes as $subtype) { + $tablet_portrait_panel_settings[] = $device . '_' . $subtype; + } - // Reset styles if we are loading responsive js - if ($responsive_js == TRUE) { - $responsive_js_css = "\n" . 'html {font-family: smartphone_landscape} /* Font family for media_queries.js */'; - $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; - } + foreach ($tablet_portrait_panel_settings as $setting) { + if (!empty($values[$setting])) { + $option = $values[$setting]; + } + else { + // Provide a fallback layout in case settings fail during submit + $tablet_portrait_panel_substr_setting = substr($setting, 16); + $tablet_portrait_panel_substr_setting = str_replace('_', '-', $tablet_portrait_panel_substr_setting); + $option = $tablet_portrait_panel_substr_setting; + } + $tablet_portrait_panels_data[] = $option; + } - // CSS wrapped in the media query - $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; + // Generate the panels layouts + $tablet_portrait_panels_css = at_build_panels_layout_css($panel_styles, $tablet_portrait_panels_data); + $panels_layouts = $float . $tablet_portrait_panels_css; - // Get and wrap the responsive CSS styles in the relative media query - $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.smartphone.landscape.css', FALSE); - $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; + // Build the styles string + $styles = $width . "\n" . $layout . "\n" . $panels_layouts; - $layouts[] = $css; -} + // Reset styles if we are loading responsive js + if ($responsive_js == TRUE) { + $responsive_js_css = "\n" . 'html {font-family: tablet_portrait} /* Font family for media_queries.js */'; + $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; + } -// Tablet Portrait -if ($values['tablet_portrait_layout']) { + // CSS wrapped in the media query + $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; - $device = 'tablet_portrait'; + // Get and wrap the responsive CSS styles in the relative media query + $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.tablet.portrait.css', FALSE); + $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; - // Build an array of page layout settings values - foreach ($layout_variables as $key => $value) { - if (isset($values["$device" . '_' . "$value"])) { - $tablet_portrait_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]); - } + $layouts[] = $css; } - // Workaround upgrade issues for some settings - if ($tablet_portrait_layout_data['layout'] == 'two_col_stack') { - $tablet_portrait_layout_data['layout'] = 'two_sidebars_right_stack'; - } - $layout = at_build_page_layout($tablet_portrait_layout_data['layout'], $tablet_portrait_layout_data['sidebar_first'], $tablet_portrait_layout_data['sidebar_second'], $tablet_portrait_layout_data['sidebar_unit']); - $method = $tablet_portrait_layout_data['layout']; - $comment = "/* $device $method */\n"; - $width = "\n" . '.container {width:' . $tablet_portrait_layout_data['page_width'] . $tablet_portrait_layout_data['page_unit'] . '}'; - $media_query = $tablet_portrait_layout_data['media_query']; + // Tablet Landscape + if ($values['tablet_landscape_layout']) { - // Get the panel layout settings and CSS for these layouts - foreach ($panel_subtypes as $subtype) { - $tablet_portrait_panel_settings[] = $device . '_' . $subtype; - } + $device = 'tablet_landscape'; - foreach ($tablet_portrait_panel_settings as $setting) { - if (!empty($values[$setting])) { - $option = $values[$setting]; + // Build an array of page layout settings values + foreach ($layout_variables as $key => $value) { + if (isset($values["$device" . '_' . "$value"])) { + $tablet_landscape_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]); + } } - else { - // Provide a fallback layout in case settings fail during submit - $tablet_portrait_panel_substr_setting = substr($setting, 16); - $tablet_portrait_panel_substr_setting = str_replace('_', '-', $tablet_portrait_panel_substr_setting); - $option = $tablet_portrait_panel_substr_setting; + // Workaround upgrade issues for some settings + if ($tablet_portrait_layout_data['layout'] == 'two_col_stack') { + $tablet_portrait_layout_data['layout'] = 'two_sidebars_right_stack'; } - $tablet_portrait_panels_data[] = $option; - } - - // Generate the panels layouts - $tablet_portrait_panels_css = at_build_panels_layout_css($panel_styles, $tablet_portrait_panels_data); - $panels_layouts = $float . $tablet_portrait_panels_css; + $layout = at_build_page_layout($tablet_landscape_layout_data['layout'], $tablet_landscape_layout_data['sidebar_first'], $tablet_landscape_layout_data['sidebar_second'], $tablet_landscape_layout_data['sidebar_unit']); - // Build the styles string - $styles = $width . "\n" . $layout . "\n" . $panels_layouts; + $method = $tablet_landscape_layout_data['layout']; + $comment = "/* $device $method */\n"; + $width = "\n" . '.container {width:' . $tablet_landscape_layout_data['page_width'] . $tablet_landscape_layout_data['page_unit'] . '}'; + $media_query = $tablet_landscape_layout_data['media_query']; - // Reset styles if we are loading responsive js - if ($responsive_js == TRUE) { - $responsive_js_css = "\n" . 'html {font-family: tablet_portrait} /* Font family for media_queries.js */'; - $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; - } - - // CSS wrapped in the media query - $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; + // Get the panel layout settings + foreach ($panel_subtypes as $subtype) { + $tablet_landscape_panel_settings[] = $device . '_' . $subtype; + } + foreach ($tablet_landscape_panel_settings as $setting) { + if (!empty($values[$setting])) { + $option = $values[$setting]; + } + else { + // Provide a fallback layout in case settings fail during submit + $tablet_landscape_panel_substr_setting = substr($setting, 17); + $tablet_landscape_panel_substr_setting = str_replace('_', '-', $tablet_landscape_panel_substr_setting); + $option = $tablet_landscape_panel_substr_setting; + } + $tablet_landscape_panels_data[] = $option; + } + // Generate the panels layouts + $tablet_landscape_panels_css = at_build_panels_layout_css($panel_styles, $tablet_landscape_panels_data); + $panels_layouts = $float . $tablet_landscape_panels_css; - // Get and wrap the responsive CSS styles in the relative media query - $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.tablet.portrait.css', FALSE); - $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; + // Build the styles string + $styles = $width . "\n" . $layout . "\n" . $panels_layouts; - $layouts[] = $css; -} + // Reset styles if we are loading responsive js + if ($responsive_js == TRUE) { + $responsive_js_css = "\n" . 'html {font-family: tablet_landscape} /* Font family for media_queries.js */'; + $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; + } -// Tablet Landscape -if ($values['tablet_landscape_layout']) { + // CSS wrapped in the media query + $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; - $device = 'tablet_landscape'; + // Get and wrap the responsive CSS styles in the relative media query + $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.tablet.landscape.css', FALSE); + $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; - // Build an array of page layout settings values - foreach ($layout_variables as $key => $value) { - if (isset($values["$device" . '_' . "$value"])) { - $tablet_landscape_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]); - } + $layouts[] = $css; } - // Workaround upgrade issues for some settings - if ($tablet_portrait_layout_data['layout'] == 'two_col_stack') { - $tablet_portrait_layout_data['layout'] = 'two_sidebars_right_stack'; - } - $layout = at_build_page_layout($tablet_landscape_layout_data['layout'], $tablet_landscape_layout_data['sidebar_first'], $tablet_landscape_layout_data['sidebar_second'], $tablet_landscape_layout_data['sidebar_unit']); - $method = $tablet_landscape_layout_data['layout']; - $comment = "/* $device $method */\n"; - $width = "\n" . '.container {width:' . $tablet_landscape_layout_data['page_width'] . $tablet_landscape_layout_data['page_unit'] . '}'; - $media_query = $tablet_landscape_layout_data['media_query']; + // Standard Layout (bigscreen) + if ($values['bigscreen_layout']) { - // Get the panel layout settings - foreach ($panel_subtypes as $subtype) { - $tablet_landscape_panel_settings[] = $device . '_' . $subtype; - } - foreach ($tablet_landscape_panel_settings as $setting) { - if (!empty($values[$setting])) { - $option = $values[$setting]; - } - else { - // Provide a fallback layout in case settings fail during submit - $tablet_landscape_panel_substr_setting = substr($setting, 17); - $tablet_landscape_panel_substr_setting = str_replace('_', '-', $tablet_landscape_panel_substr_setting); - $option = $tablet_landscape_panel_substr_setting; + $device = 'bigscreen'; + + // Build an array of page layout settings values + foreach ($layout_variables as $key => $value) { + if (isset($values["$device" . '_' . "$value"])) { + $bigscreen_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]); + } } - $tablet_landscape_panels_data[] = $option; - } - // Generate the panels layouts - $tablet_landscape_panels_css = at_build_panels_layout_css($panel_styles, $tablet_landscape_panels_data); - $panels_layouts = $float . $tablet_landscape_panels_css; + $layout = at_build_page_layout($bigscreen_layout_data['layout'], $bigscreen_layout_data['sidebar_first'], $bigscreen_layout_data['sidebar_second'], $bigscreen_layout_data['sidebar_unit']); - // Build the styles string - $styles = $width . "\n" . $layout . "\n" . $panels_layouts; + $method = $bigscreen_layout_data['layout']; + $comment = "/* $device $method */"; + $width = "\n" . '.container {width:' . $bigscreen_layout_data['page_width'] . $bigscreen_layout_data['page_unit'] . '}'; + $media_query = $bigscreen_layout_data['media_query']; - // Reset styles if we are loading responsive js - if ($responsive_js == TRUE) { - $responsive_js_css = "\n" . 'html {font-family: tablet_landscape} /* Font family for media_queries.js */'; - $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; - } + // Standard layout can have a max-width + if ($values['bigscreen_set_max_width'] === 1 && $bigscreen_layout_data['page_unit'] === '%') { + if (!empty($values['bigscreen_max_width'])) { + $width = "\n" . '.container {width:' . $bigscreen_layout_data['page_width'] . $bigscreen_layout_data['page_unit'] . ';max-width:' . $values['bigscreen_max_width'] . $values['bigscreen_max_width_unit'] . '}'; + } + else { + $width = "\n" . '.container {width:' . $bigscreen_layout_data['page_width'] . $bigscreen_layout_data['page_unit'] . ';max-width:' . $values['bigscreen_max_width'] . $values['bigscreen_max_width_unit'] . '}'; + } + } - // CSS wrapped in the media query - $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; + // Get the panel layout settings + foreach ($panel_subtypes as $subtype) { + $bigscreen_panel_settings[] = $device . '_' . $subtype; + } + foreach ($bigscreen_panel_settings as $setting) { + if (!empty($values[$setting])) { + $option = $values[$setting]; + } + else { + // Provide a fallback layout in case settings fail during submit + $bigscreen_panel_substr_setting = substr($setting, 16); + $bigscreen_panel_substr_setting = str_replace('_', '-', $bigscreen_panel_substr_setting); + $option = $bigscreen_panel_substr_setting; + } + $bigscreen_panels_data[] = $option; + } + // Generate the panels layouts + $bigscreen_panels_css = at_build_panels_layout_css($panel_styles, $bigscreen_panels_data); - // Get and wrap the responsive CSS styles in the relative media query - $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.tablet.landscape.css', FALSE); - $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; + // Prepend the float + $panels_layouts = $float . $bigscreen_panels_css; - $layouts[] = $css; -} + // Build the styles string + $styles = $width . "\n" . $layout . "\n" . $panels_layouts; -// Standard Layout (bigscreen) -if ($values['bigscreen_layout']) { + // Reset styles if we are loading responsive js + if ($responsive_js == TRUE) { + $responsive_js_css = "\n" . 'html {font-family: standard} /* Font family for media_queries.js */'; + $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; + } - $device = 'bigscreen'; + // CSS wrapped in the media query + // $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; - // Build an array of page layout settings values - foreach ($layout_variables as $key => $value) { - if (isset($values["$device" . '_' . "$value"])) { - $bigscreen_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]); - } - } - $layout = at_build_page_layout($bigscreen_layout_data['layout'], $bigscreen_layout_data['sidebar_first'], $bigscreen_layout_data['sidebar_second'], $bigscreen_layout_data['sidebar_unit']); + // We need to do some conditional checks to account for the users settings: + // - is this mobile first or desktop first? + // - is the responsive capability disabled? - $method = $bigscreen_layout_data['layout']; - $comment = "/* $device $method */"; - $width = "\n" . '.container {width:' . $bigscreen_layout_data['page_width'] . $bigscreen_layout_data['page_unit'] . '}'; - $media_query = $bigscreen_layout_data['media_query']; + // Mobile first or Desktop first? + if ($is_default_layout === 'standard-layout') { + // DESKTOP FIRST + // Just the responsive js font family + $css = ''; + if ($responsive_js == TRUE) { + $css = $comment . "\n" . '@media ' . $media_query . ' {' . $responsive_js_css . "\n" . '}'; + } - // Standard layout can have a max-width - if ($values['bigscreen_set_max_width'] === 1 && $bigscreen_layout_data['page_unit'] === '%') { - if (!empty($values['bigscreen_max_width'])) { - $width = "\n" . '.container {width:' . $bigscreen_layout_data['page_width'] . $bigscreen_layout_data['page_unit'] . ';max-width:' . $values['bigscreen_max_width'] . $values['bigscreen_max_width_unit'] . '}'; + // Prepare a "default layout" for output to file when desktop first + $desktop_first_layout = $gutters . "\n" . $comment . $styles . "\n"; } else { - $width = "\n" . '.container {width:' . $bigscreen_layout_data['page_width'] . $bigscreen_layout_data['page_unit'] . ';max-width:' . $values['bigscreen_max_width'] . $values['bigscreen_max_width_unit'] . '}'; + // MOIBLE FIRST + $css = $comment . "\n" . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; + $desktop_first_layout = '/* Not likely, this is mobile first - this themer is rocking the hardest! */'; } - } - // Get the panel layout settings - foreach ($panel_subtypes as $subtype) { - $bigscreen_panel_settings[] = $device . '_' . $subtype; - } - foreach ($bigscreen_panel_settings as $setting) { - if (!empty($values[$setting])) { - $option = $values[$setting]; + // Responsive capability OFF? + if ($values['disable_responsive_styles'] === 1) { + // If its off we have to load something, so we choose to use the bigscreen + // layout and load that + $desktop_first_layout = $gutters . "\n" . $comment . $styles; } - else { - // Provide a fallback layout in case settings fail during submit - $bigscreen_panel_substr_setting = substr($setting, 16); - $bigscreen_panel_substr_setting = str_replace('_', '-', $bigscreen_panel_substr_setting); - $option = $bigscreen_panel_substr_setting; - } - $bigscreen_panels_data[] = $option; + + // add $css to the layouts array + $layouts[] = $css; } - // Generate the panels layouts - $bigscreen_panels_css = at_build_panels_layout_css($panel_styles, $bigscreen_panels_data); + //****** END bigscreen layout ******// - // Prepend the float - $panels_layouts = $float . $bigscreen_panels_css; + // Internet Exploder + // We only want to load what is absolutely required for IE, depending on the + // theme settings and what version we are targeting, remember, this only takes + // care of generating the stylesheets so what you see here are lots of messages + // being set for the themer to get a handle on what is going on, load.inc and + // adaptivetheme_preprocess_html() are actually loading the files. - // Build the styles string - $styles = $width . "\n" . $layout . "\n" . $panels_layouts; + // $lt_ie9_css's assigned values all come from the bigscreen layout, since its + // the last layout to assign values to those variables + $lt_ie9_css = $comment . $width . "\n" . $layout . "\n" . $panels_layouts; - // Reset styles if we are loading responsive js + // Reset $lt_ie9_css if we are loading responsive js if ($responsive_js == TRUE) { - $responsive_js_css = "\n" . 'html {font-family: standard} /* Font family for media_queries.js */'; - $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; + $lt_ie9_css = $comment . $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; + } + + // Get the lt ie8 panels layouts if enabled + $lt_ie8_css = '/* IE6/7 percentage rounding error fixes are OFF */'; + if ($values['load_ltie8css'] === 1) { + $ie_panels_layouts = drupal_load_stylesheet($path_to_panels_css . 'ie_defaults.css', FALSE); + $lt_ie8_css = $ie_panels_layouts; } - // CSS wrapped in the media query - // $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; + // Respond.js is OFF + if ($load_respondjs == FALSE) { - // We need to do some conditional checks to account for the users settings: - // - is this mobile first or desktop first? - // - is the responsive capability disabled? + // should we load the IE6/7 rounding error fixes? + if ($values['load_ltie8css'] === 1) { - // Mobile first or Desktop first? - if ($is_default_layout === 'standard-layout') { - // DESKTOP FIRST - // Just the responsive js font family - $css = ''; - if ($responsive_js == TRUE) { - $css = $comment . "\n" . '@media ' . $media_query . ' {' . $responsive_js_css . "\n" . '}'; + // add the E6/7 rounding error fixes to $lt_ie9_css, set a message in $lt_ie8_css + $lt_ie9_css = $comment . $width . "\n" . $layout . "\n" . $panels_layouts . "\n" . $ie_panels_layouts; + $lt_ie8_css = '/* The IE6/7 panels layouts are loading in the lt IE9 CSS, to save an HTTP request hit on your server */'; + + // Desktop first? + if ($is_default_layout === 'standard-layout') { + // repopulate $lt_ie8_css + $lt_ie8_css = $ie_panels_layouts; + } } + } - // Prepare a "default layout" for output to file when desktop first - $desktop_first_layout = $gutters . "\n" . $comment . $styles . "\n"; + // Respond.js is ON + if ($load_respondjs == TRUE) { + $lt_ie9_css = '/* respond.js is loading so we dont load this file. IE6, 7 and 8 will rely on respond.js to work its magic */'; } - else { - // MOIBLE FIRST - $css = $comment . "\n" . '@media ' . $media_query . ' {' . $styles . "\n" . '}'; - $desktop_first_layout = '/* Not likely, this is mobile first - this themer is rocking the hardest! */'; + + // Desktop first? + if ($is_default_layout === 'standard-layout') { + $lt_ie9_css = '/* The standard layout is the default layout, IE styles are not required because you are doing desktop first design */'; } // Responsive capability OFF? if ($values['disable_responsive_styles'] === 1) { - // If its off we have to load something, so we choose to use the bigscreen - // layout and load that - $desktop_first_layout = $gutters . "\n" . $comment . $styles; + $lt_ie9_css = '/* Responsive capabilites are disabled, we no longer need to load an IE specific layout */'; } - // add $css to the layouts array - $layouts[] = $css; -} -//****** END bigscreen layout ******// - -// Internet Exploder -// We only want to load what is absolutely required for IE, depending on the -// theme settings and what version we are targeting, remember, this only takes -// care of generating the stylesheets so what you see here are lots of messages -// being set for the themer to get a handle on what is going on, load.inc and -// adaptivetheme_preprocess_html() are actually loading the files. - -// $lt_ie9_css's assigned values all come from the bigscreen layout, since its -// the last layout to assign values to those variables -$lt_ie9_css = $comment . $width . "\n" . $layout . "\n" . $panels_layouts; - -// Reset $lt_ie9_css if we are loading responsive js -if ($responsive_js == TRUE) { - $lt_ie9_css = $comment . $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts; -} - -// Get the lt ie8 panels layouts if enabled -$lt_ie8_css = '/* IE6/7 percentage rounding error fixes are OFF */'; -if ($values['load_ltie8css'] === 1) { - $ie_panels_layouts = drupal_load_stylesheet($path_to_panels_css . 'ie_defaults.css', FALSE); - $lt_ie8_css = $ie_panels_layouts; -} - -// Respond.js is OFF -if ($load_respondjs == FALSE) { - - // should we load the IE6/7 rounding error fixes? - if ($values['load_ltie8css'] === 1) { + // Get and wrap the responsive CSS styles in the relative media query + $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.desktop.css', FALSE); + $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; + + // Generate the layout and responsive styles stylesheets + // Here we generate five files: + // 1. $theme_name.default.layout + // 2. $theme_name.responsive.layout + // 3. $theme_name.lt-ie9.layout + // 4. $theme_name.lt-ie8.layout + // 5. $theme_name.responsive.styles + // adaptivetheme_preprocess_html() will take care of loading the right ones + // when they are needed. + + // responsive layout + $responsive_layout_data = implode("\n", $layouts); + + // Prepend the gutters to the responsive layout if we're doing mobile first + if ($is_default_layout !== 'standard-layout') { + $responsive_layout = $gutters . "\n" . $responsive_layout_data; + } + else { + $responsive_layout = $responsive_layout_data; + } - // add the E6/7 rounding error fixes to $lt_ie9_css, set a message in $lt_ie8_css - $lt_ie9_css = $comment . $width . "\n" . $layout . "\n" . $panels_layouts . "\n" . $ie_panels_layouts; - $lt_ie8_css = '/* The IE6/7 panels layouts are loading in the lt IE9 CSS, to save an HTTP request hit on your server */'; + // Nuke $responsive_layout if we really don't need it + if ($values['disable_responsive_styles'] == 1) { + $responsive_layout = '/* Responsive capabilites are disabled, only the standard layout is loaded in themename.default.layout.css */'; + } - // Desktop first? - if ($is_default_layout === 'standard-layout') { - // repopulate $lt_ie8_css - $lt_ie8_css = $ie_panels_layouts; - } + // IE assignments, not sure why I am doing this, could be that I meant to do + // something at this stage and have forgotton for now... + $lt_ie9_layout = $lt_ie9_css; + $lt_ie8_layout = $lt_ie8_css; + + // Aggregate the design stylesheets + $responsive_css = implode("\n", $responsive_styles); + + // Regex relative paths. This mimics Drupal cores drupal_build_css_cache(), but + // its not as powerful because assets must be relative to the theme root. + $_base = base_path() . $path_to_responsive_css; + _drupal_build_css_path(NULL, $_base); + $responsive_css = preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', '_drupal_build_css_path', $responsive_css); + + // Build a keyed array: file names as key, layout data as value + $files = array( + "$theme_name.default.layout" => $desktop_first_layout, + "$theme_name.responsive.layout" => $responsive_layout, + "$theme_name.lt-ie9.layout" => $lt_ie9_layout, + "$theme_name.lt-ie8.layout" => $lt_ie8_layout, + "$theme_name.responsive.styles" => $responsive_css, + ); + + // Loop over the array and save each file, and we're done! + foreach ($files as $key => $value) { + $filepath = "$path/$key.css"; + file_unmanaged_save_data($value, $filepath, FILE_EXISTS_REPLACE); } -} - -// Respond.js is ON -if ($load_respondjs == TRUE) { - $lt_ie9_css = '/* respond.js is loading so we dont load this file. IE6, 7 and 8 will rely on respond.js to work its magic */'; -} - -// Desktop first? -if ($is_default_layout === 'standard-layout') { - $lt_ie9_css = '/* The standard layout is the default layout, IE styles are not required because you are doing desktop first design */'; -} - -// Responsive capability OFF? -if ($values['disable_responsive_styles'] === 1) { - $lt_ie9_css = '/* Responsive capabilites are disabled, we no longer need to load an IE specific layout */'; -} - -// Get and wrap the responsive CSS styles in the relative media query -$responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.desktop.css', FALSE); -$responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}'; - -// Generate the layout and responsive styles stylesheets -// Here we generate five files: -// 1. $theme_name.default.layout -// 2. $theme_name.responsive.layout -// 3. $theme_name.lt-ie9.layout -// 4. $theme_name.lt-ie8.layout -// 5. $theme_name.responsive.styles -// adaptivetheme_preprocess_html() will take care of loading the right ones -// when they are needed. - -// responsive layout -$responsive_layout_data = implode("\n", $layouts); - -// Prepend the gutters to the responsive layout if we're doing mobile first -if ($is_default_layout !== 'standard-layout') { - $responsive_layout = $gutters . "\n" . $responsive_layout_data; -} -else { - $responsive_layout = $responsive_layout_data; -} - -// Nuke $responsive_layout if we really don't need it -if ($values['disable_responsive_styles'] == 1) { - $responsive_layout = '/* Responsive capabilites are disabled, only the standard layout is loaded in themename.default.layout.css */'; -} - -// IE assignments, not sure why I am doing this, could be that I meant to do -// something at this stage and have forgotton for now... -$lt_ie9_layout = $lt_ie9_css; -$lt_ie8_layout = $lt_ie8_css; - -// Aggregate the design stylesheets -$responsive_css = implode("\n", $responsive_styles); - -// Regex relative paths. This mimics Drupal cores drupal_build_css_cache(), but -// its not as powerful because assets must be relative to the theme root. -$_base = base_path() . $path_to_responsive_css; -_drupal_build_css_path(NULL, $_base); -$responsive_css = preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', '_drupal_build_css_path', $responsive_css); - -// Build a keyed array: file names as key, layout data as value -$files = array( - "$theme_name.default.layout" => $desktop_first_layout, - "$theme_name.responsive.layout" => $responsive_layout, - "$theme_name.lt-ie9.layout" => $lt_ie9_layout, - "$theme_name.lt-ie8.layout" => $lt_ie8_layout, - "$theme_name.responsive.styles" => $responsive_css, -); - -// Loop over the array and save each file, and we're done! -foreach ($files as $key => $value) { - $filepath = "$path/$key.css"; - file_unmanaged_save_data($value, $filepath, FILE_EXISTS_REPLACE); -} +} \ No newline at end of file diff --git a/at_core/inc/forms/at_core.validate.inc b/at_core/inc/forms/at_core.validate.inc index b090475..9fa0206 100755 --- a/at_core/inc/forms/at_core.validate.inc +++ b/at_core/inc/forms/at_core.validate.inc @@ -9,7 +9,7 @@ */ function at_core_settings_validate($form, &$form_state) { - + dpm('we actually validated this.'); $values = $form_state['values']; $theme_name = $form_state['build_info']['args'][0]; diff --git a/at_core/inc/forms/settings.contextregions.inc b/at_core/inc/forms/settings.contextregions.inc index 4181db9..70ffd6d 100755 --- a/at_core/inc/forms/settings.contextregions.inc +++ b/at_core/inc/forms/settings.contextregions.inc @@ -1,70 +1,72 @@ $value) { - if (in_array($key, $unset_mobile_regions)) { - unset($key); - } - if (isset($key)) { - $mobile_regions[$key] = $value; + // Prepare regions + foreach ($info_array['regions'] as $key => $value) { + if (in_array($key, $unset_mobile_regions)) { + unset($key); + } + if (isset($key)) { + $mobile_regions[$key] = $value; + } } -} -// Add a option to the move regions list -$do_not_move = array('do_not_move' => ''); -$move_regions_list = array_merge($do_not_move, $mobile_regions); -array_reverse($move_regions_list); + // Add a option to the move regions list + $do_not_move = array('do_not_move' => ''); + $move_regions_list = array_merge($do_not_move, $mobile_regions); + array_reverse($move_regions_list); -// Top level wrapper fieldset -$form['at']['context-regions'] = array( - '#type' => 'fieldset', - '#title' => t('Mobile Regions (beta)'), - '#description' => t('

Mobile Regions and Blocks (beta)

These settings allow you to either unset regions in mobile devices, or move the regions blocks to another region when a mobile device is detected. Device detection is supplied by the Browscap module.

This feature should be considered beta at this time and has only been tested with the Drupal core block system, please post issues to the issue queue.

Caveats:

  1. Normal weight settings are lost when blocks are moved.
  2. If the target region has no blocks by default, Adaptivetheme will generate the region markup. The markup is hard coded and does not account for modifications elsewhere in your theme, such as region template suggestion overrides.
', array('!issue_queue' => 'http://drupal.org/project/issues/adaptivetheme')), - '#weight' => 30, -); -if (!function_exists('browscap_get_browser')) { - $form['at']['context-regions']['requirements'] = array( - '#markup' => t('Required: To use these settings you must first install the Browscap module. New settings will appear after you have enabled Browscap.', array('!browscap_module' => 'http://drupal.org/project/browscap')), + // Top level wrapper fieldset + $form['at']['context-regions'] = array( + '#type' => 'fieldset', + '#title' => t('Mobile Regions (beta)'), + '#description' => t('

Mobile Regions and Blocks (beta)

These settings allow you to either unset regions in mobile devices, or move the regions blocks to another region when a mobile device is detected. Device detection is supplied by the Browscap module.

This feature should be considered beta at this time and has only been tested with the Drupal core block system, please post issues to the issue queue.

Caveats:

  1. Normal weight settings are lost when blocks are moved.
  2. If the target region has no blocks by default, Adaptivetheme will generate the region markup. The markup is hard coded and does not account for modifications elsewhere in your theme, such as region template suggestion overrides.
', array('!issue_queue' => 'http://drupal.org/project/issues/adaptivetheme')), + '#weight' => 30, ); -} -elseif (function_exists('browscap_get_browser')) { - // Build form elements for each region - foreach ($mobile_regions as $mobile_region_name => $mobile_region_label) { + if (!function_exists('browscap_get_browser')) { + $form['at']['context-regions']['requirements'] = array( + '#markup' => t('Required: To use these settings you must first install the Browscap module. New settings will appear after you have enabled Browscap.', array('!browscap_module' => 'http://drupal.org/project/browscap')), + ); + } + elseif (function_exists('browscap_get_browser')) { + // Build form elements for each region + foreach ($mobile_regions as $mobile_region_name => $mobile_region_label) { - $mobile_region_title = check_plain($mobile_region_label); - $mobile_region_name = check_plain($mobile_region_name); + $mobile_region_title = check_plain($mobile_region_label); + $mobile_region_name = check_plain($mobile_region_name); - $form['at']['context-regions']['region-options-' . $mobile_region_name] = array( - '#type' => 'fieldset', - '#title' => t($mobile_region_title), - ); - $form['at']['context-regions']['region-options-' . $mobile_region_name]['unset_' . $mobile_region_name] = array( - '#type' => 'checkbox', - '#title' => t('Unset'), - '#default_value' => at_get_setting('unset_' . $mobile_region_name), - ); - $form['at']['context-regions']['region-options-' . $mobile_region_name]['move_' . $mobile_region_name] = array( - '#type' => 'select', - '#title' => t('Move blocks:'), - '#default_value' => at_get_setting('move_' . $mobile_region_name), - '#options' => $move_regions_list, - '#states' => array('invisible' => array('input[name=unset_' . $mobile_region_name . ']' => array('checked' => TRUE))), - ); + $form['at']['context-regions']['region-options-' . $mobile_region_name] = array( + '#type' => 'fieldset', + '#title' => t($mobile_region_title), + ); + $form['at']['context-regions']['region-options-' . $mobile_region_name]['unset_' . $mobile_region_name] = array( + '#type' => 'checkbox', + '#title' => t('Unset'), + '#default_value' => at_get_setting('unset_' . $mobile_region_name), + ); + $form['at']['context-regions']['region-options-' . $mobile_region_name]['move_' . $mobile_region_name] = array( + '#type' => 'select', + '#title' => t('Move blocks:'), + '#default_value' => at_get_setting('move_' . $mobile_region_name), + '#options' => $move_regions_list, + '#states' => array('invisible' => array('input[name=unset_' . $mobile_region_name . ']' => array('checked' => TRUE))), + ); + } } -} +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.cssexclude.inc b/at_core/inc/forms/settings.cssexclude.inc index 6e656fd..c98f691 100755 --- a/at_core/inc/forms/settings.cssexclude.inc +++ b/at_core/inc/forms/settings.cssexclude.inc @@ -5,170 +5,173 @@ * Generate settings for the CSS exclude form. */ +function at_core_css_exclude_form(&$form, 'theme_name') { + // We need some getters. -include_once(drupal_get_path('theme', 'adaptivetheme') . '/inc/get.inc'); + include_once(drupal_get_path('theme', 'adaptivetheme') . '/inc/get.inc'); -// Get the relevent CSS file data for building the form. -$css_data = at_get_css_files($theme_name); + // Get the relevent CSS file data for building the form. + $css_data = at_get_css_files($theme_name); -// regex pattern -$pattern = '/[^a-zA-Z0-9-]+/'; + // regex pattern + $pattern = '/[^a-zA-Z0-9-]+/'; -// -- DIE CSS DIE -- // -$form['at']['cssexcludes'] = array( - '#type' => 'fieldset', - '#title' => t('Unset CSS'), - '#weight' => 20, -); -$form['at']['cssexcludes']['die-css-die'] = array( - '#type' => 'fieldset', - '#title' => t('Unset CSS'), - '#description' => t('

Unset CSS

Stylesheet names are cached, if some are not showing in this list you may need to clear the cache.

In for some reason (it happens) the CSS files you want to unset never show here you can explicitly declare them in your info file as "unset_css", see your sub-themes info file under "Stylesheets" for instructions.

'), - '#attached' => array( - 'js' => array(drupal_get_path('theme', 'adaptivetheme') . '/scripts/check_all.js'), - ), -); + // -- DIE CSS DIE -- // + $form['at']['cssexcludes'] = array( + '#type' => 'fieldset', + '#title' => t('Unset CSS'), + '#weight' => 20, + ); + $form['at']['cssexcludes']['die-css-die'] = array( + '#type' => 'fieldset', + '#title' => t('Unset CSS'), + '#description' => t('

Unset CSS

Stylesheet names are cached, if some are not showing in this list you may need to clear the cache.

In for some reason (it happens) the CSS files you want to unset never show here you can explicitly declare them in your info file as "unset_css", see your sub-themes info file under "Stylesheets" for instructions.

'), + '#attached' => array( + 'js' => array(drupal_get_path('theme', 'adaptivetheme') . '/scripts/check_all.js'), + ), + ); -// Core -$core_defined = FALSE; -$form['at']['cssexcludes']['die-css-die']['core-excludes'] = array( - '#type' => 'fieldset', - '#title' => t('Unset Core CSS'), - '#description' => t('

Unset Core Module CSS

'), -); -foreach ($css_data as $key => $value) { - if ($value['type'] == 'unset_core') { - $core_defined = TRUE; - $setting = 'unset_css_' . preg_replace($pattern, '_', $key); - $title_parts = explode('/', $key); - $title = array_pop($title_parts); - $form['at']['cssexcludes']['die-css-die']['core-excludes'][$setting] = array( + // Core + $core_defined = FALSE; + $form['at']['cssexcludes']['die-css-die']['core-excludes'] = array( + '#type' => 'fieldset', + '#title' => t('Unset Core CSS'), + '#description' => t('

Unset Core Module CSS

'), + ); + foreach ($css_data as $key => $value) { + if ($value['type'] == 'unset_core') { + $core_defined = TRUE; + $setting = 'unset_css_' . preg_replace($pattern, '_', $key); + $title_parts = explode('/', $key); + $title = array_pop($title_parts); + $form['at']['cssexcludes']['die-css-die']['core-excludes'][$setting] = array( + '#type' => 'checkbox', + '#title' => t('@title (@key)', array('@title' => $title, '@key' => $key)), + '#default_value' => at_get_setting($setting) ? at_get_setting($setting) : 0, + '#attributes' => array('class' => array('drupal-core-css-file')), + '#weight' => 0, + ); + } + } + if ($core_defined === TRUE) { + $form['at']['cssexcludes']['die-css-die']['core-excludes']['core_check_all'] = array( '#type' => 'checkbox', - '#title' => t('@title (@key)', array('@title' => $title, '@key' => $key)), - '#default_value' => at_get_setting($setting) ? at_get_setting($setting) : 0, - '#attributes' => array('class' => array('drupal-core-css-file')), - '#weight' => 0, + '#title' => t('Unset All'), + '#default_value' => at_get_setting('core_check_all') ? at_get_setting('core_check_all') : 0, + '#weight' => -1, + ); + } + if ($core_defined === FALSE) { + $form['at']['cssexcludes']['die-css-die']['libraries-excludes']['nothing_core_defined'] = array( + '#markup' => t('No core stylesheets to unset? Hmmm, something is not right here, try clearning the sites cache, otherwise you might need to post an issue.', array('!link' => 'http://drupal.org/project/issues/adaptivetheme')), ); } -} -if ($core_defined === TRUE) { - $form['at']['cssexcludes']['die-css-die']['core-excludes']['core_check_all'] = array( - '#type' => 'checkbox', - '#title' => t('Unset All'), - '#default_value' => at_get_setting('core_check_all') ? at_get_setting('core_check_all') : 0, - '#weight' => -1, - ); -} -if ($core_defined === FALSE) { - $form['at']['cssexcludes']['die-css-die']['libraries-excludes']['nothing_core_defined'] = array( - '#markup' => t('No core stylesheets to unset? Hmmm, something is not right here, try clearning the sites cache, otherwise you might need to post an issue.', array('!link' => 'http://drupal.org/project/issues/adaptivetheme')), - ); -} -// Contrib -$contrib_defined = FALSE; -$form['at']['cssexcludes']['die-css-die']['contrib-excludes'] = array( - '#type' => 'fieldset', - '#title' => t('Unset Contrib Module CSS'), - '#description' => t('

Unset Contrib Module CSS

'), -); -foreach ($css_data as $key => $value) { - if ($value['type'] == 'contrib') { - $contrib_defined = TRUE; - $setting = 'unset_css_' . preg_replace($pattern, '_', $key); - $title_parts = explode('/', $key); - $title = array_pop($title_parts); - $form['at']['cssexcludes']['die-css-die']['contrib-excludes'][$setting] = array( + // Contrib + $contrib_defined = FALSE; + $form['at']['cssexcludes']['die-css-die']['contrib-excludes'] = array( + '#type' => 'fieldset', + '#title' => t('Unset Contrib Module CSS'), + '#description' => t('

Unset Contrib Module CSS

'), + ); + foreach ($css_data as $key => $value) { + if ($value['type'] == 'contrib') { + $contrib_defined = TRUE; + $setting = 'unset_css_' . preg_replace($pattern, '_', $key); + $title_parts = explode('/', $key); + $title = array_pop($title_parts); + $form['at']['cssexcludes']['die-css-die']['contrib-excludes'][$setting] = array( + '#type' => 'checkbox', + '#title' => t('@title (@key)', array('@title' => $title, '@key' => $key)), + '#default_value' => at_get_setting($setting) ? at_get_setting($setting) : 0, + '#attributes' => array('class' => array('contrib-module-css-file')), + '#weight' => 0, + ); + } + } + if ($contrib_defined === TRUE) { + $form['at']['cssexcludes']['die-css-die']['contrib-excludes']['contrib_check_all'] = array( '#type' => 'checkbox', - '#title' => t('@title (@key)', array('@title' => $title, '@key' => $key)), - '#default_value' => at_get_setting($setting) ? at_get_setting($setting) : 0, - '#attributes' => array('class' => array('contrib-module-css-file')), - '#weight' => 0, + '#title' => t('Unset All'), + '#default_value' => at_get_setting('contrib_check_all') ? at_get_setting('contrib_check_all') : 0, + '#weight' => -1, + ); + } + if ($contrib_defined === FALSE) { + $form['at']['cssexcludes']['die-css-die']['libraries-excludes']['nothing_contrib_defined'] = array( + '#markup' => t('No contrib module stylesheets to unset. If you think there should be, try clearing the sites cache. If they still do not show you may need to explicitly declare them in your sub-theme info file.'), ); } -} -if ($contrib_defined === TRUE) { - $form['at']['cssexcludes']['die-css-die']['contrib-excludes']['contrib_check_all'] = array( - '#type' => 'checkbox', - '#title' => t('Unset All'), - '#default_value' => at_get_setting('contrib_check_all') ? at_get_setting('contrib_check_all') : 0, - '#weight' => -1, - ); -} -if ($contrib_defined === FALSE) { - $form['at']['cssexcludes']['die-css-die']['libraries-excludes']['nothing_contrib_defined'] = array( - '#markup' => t('No contrib module stylesheets to unset. If you think there should be, try clearing the sites cache. If they still do not show you may need to explicitly declare them in your sub-theme info file.'), - ); -} -// Libs -$libraries_defined = FALSE; -$form['at']['cssexcludes']['die-css-die']['libraries-excludes'] = array( - '#type' => 'fieldset', - '#title' => t('Unset Libraries CSS'), - '#description' => t('

Unset Libraries CSS

'), -); -foreach ($css_data as $key => $value) { - if ($value['type'] == 'library') { - $libraries_defined = TRUE; - $setting = 'unset_css_' . preg_replace($pattern, '_', $key); - $title_parts = explode('/', $key); - $title = array_pop($title_parts); - $form['at']['cssexcludes']['die-css-die']['libraries-excludes'][$setting] = array( + // Libs + $libraries_defined = FALSE; + $form['at']['cssexcludes']['die-css-die']['libraries-excludes'] = array( + '#type' => 'fieldset', + '#title' => t('Unset Libraries CSS'), + '#description' => t('

Unset Libraries CSS

'), + ); + foreach ($css_data as $key => $value) { + if ($value['type'] == 'library') { + $libraries_defined = TRUE; + $setting = 'unset_css_' . preg_replace($pattern, '_', $key); + $title_parts = explode('/', $key); + $title = array_pop($title_parts); + $form['at']['cssexcludes']['die-css-die']['libraries-excludes'][$setting] = array( + '#type' => 'checkbox', + '#title' => t('@title (@key)', array('@title' => $title, '@key' => $key)), + '#default_value' => at_get_setting($setting) ? at_get_setting($setting) : 0, + '#attributes' => array('class' => array('library-css-file')), + '#weight' => 0, + ); + } + } + if ($libraries_defined === TRUE) { + $form['at']['cssexcludes']['die-css-die']['libraries-excludes']['libraries_check_all'] = array( '#type' => 'checkbox', - '#title' => t('@title (@key)', array('@title' => $title, '@key' => $key)), - '#default_value' => at_get_setting($setting) ? at_get_setting($setting) : 0, - '#attributes' => array('class' => array('library-css-file')), - '#weight' => 0, + '#title' => t('Unset All'), + '#default_value' => at_get_setting('libraries_check_all') ? at_get_setting('libraries_check_all') : 0, + '#weight' => -1, + ); + } + if ($libraries_defined === FALSE) { + $form['at']['cssexcludes']['die-css-die']['libraries-excludes']['nothing_libraries_defined'] = array( + '#markup' => t('No libraries stylesheets to unset. If you think there should be, try clearing the sites cache. If they still do not show you may need to explicitly declare them in your sub-theme info file.'), ); } -} -if ($libraries_defined === TRUE) { - $form['at']['cssexcludes']['die-css-die']['libraries-excludes']['libraries_check_all'] = array( - '#type' => 'checkbox', - '#title' => t('Unset All'), - '#default_value' => at_get_setting('libraries_check_all') ? at_get_setting('libraries_check_all') : 0, - '#weight' => -1, - ); -} -if ($libraries_defined === FALSE) { - $form['at']['cssexcludes']['die-css-die']['libraries-excludes']['nothing_libraries_defined'] = array( - '#markup' => t('No libraries stylesheets to unset. If you think there should be, try clearing the sites cache. If they still do not show you may need to explicitly declare them in your sub-theme info file.'), - ); -} -// Explicit (user defined in their sub-themes info file) -$user_defined = FALSE; -$form['at']['cssexcludes']['die-css-die']['explicit-excludes'] = array( - '#type' => 'fieldset', - '#title' => t('My Unset CSS Files'), - '#description' => t('

My Unset CSS Files

'), -); -foreach ($css_data as $key => $value) { - if ($value['type'] == 'user_defined') { - $user_defined = TRUE; - $setting = 'unset_css_' . preg_replace($pattern, '_', $key); - $title_parts = explode('/', $key); - $title = array_pop($title_parts); - $form['at']['cssexcludes']['die-css-die']['explicit-excludes'][$setting] = array( + // Explicit (user defined in their sub-themes info file) + $user_defined = FALSE; + $form['at']['cssexcludes']['die-css-die']['explicit-excludes'] = array( + '#type' => 'fieldset', + '#title' => t('My Unset CSS Files'), + '#description' => t('

My Unset CSS Files

'), + ); + foreach ($css_data as $key => $value) { + if ($value['type'] == 'user_defined') { + $user_defined = TRUE; + $setting = 'unset_css_' . preg_replace($pattern, '_', $key); + $title_parts = explode('/', $key); + $title = array_pop($title_parts); + $form['at']['cssexcludes']['die-css-die']['explicit-excludes'][$setting] = array( + '#type' => 'checkbox', + '#title' => t('@title (@key)', array('@title' => $title, '@key' => $key)), + '#default_value' => at_get_setting($setting) ? at_get_setting($setting) : 0, + '#attributes' => array('class' => array('user-defined-css-file')), + '#weight' => 0, + ); + } + } + if ($user_defined === TRUE) { + $form['at']['cssexcludes']['die-css-die']['explicit-excludes']['explicit_check_all'] = array( '#type' => 'checkbox', - '#title' => t('@title (@key)', array('@title' => $title, '@key' => $key)), - '#default_value' => at_get_setting($setting) ? at_get_setting($setting) : 0, - '#attributes' => array('class' => array('user-defined-css-file')), - '#weight' => 0, + '#title' => t('Unset All'), + '#default_value' => at_get_setting('explicit_check_all') ? at_get_setting('explicit_check_all') : 0, + '#weight' => -1, ); } -} -if ($user_defined === TRUE) { - $form['at']['cssexcludes']['die-css-die']['explicit-excludes']['explicit_check_all'] = array( - '#type' => 'checkbox', - '#title' => t('Unset All'), - '#default_value' => at_get_setting('explicit_check_all') ? at_get_setting('explicit_check_all') : 0, - '#weight' => -1, - ); -} -if ($user_defined === FALSE) { - $form['at']['cssexcludes']['die-css-die']['explicit-excludes']['nothing_user_defined'] = array( - '#markup' => t('No user defined stylesheets to unset. If you wish to define your own, see your sub-theme info file for details under the "Stylesheets" section.'), - ); -} + if ($user_defined === FALSE) { + $form['at']['cssexcludes']['die-css-die']['explicit-excludes']['nothing_user_defined'] = array( + '#markup' => t('No user defined stylesheets to unset. If you wish to define your own, see your sub-theme info file for details under the "Stylesheets" section.'), + ); + } +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.customcss.inc b/at_core/inc/forms/settings.customcss.inc index 0eb8164..7981be1 100755 --- a/at_core/inc/forms/settings.customcss.inc +++ b/at_core/inc/forms/settings.customcss.inc @@ -5,15 +5,17 @@ * Generate settings for the Custom CSS form. */ -$form['at']['custom-styles'] = array( - '#type' => 'fieldset', - '#title' => t('Custom CSS'), - '#weight' => 30, -); -$form['at']['custom-styles']['custom_css'] = array( - '#type' => 'textarea', - '#title' => t('Custom CSS'), - '#rows' => 15, - '#default_value' => at_get_setting('custom_css') ? filter_xss_admin(at_get_setting('custom_css')) : '/* Add any valid CSS declarations */', - '#description' => t("The styles you enter here will be saved to the public file system in themename.custom.css and are not affected by upgrades. Consider using a sub-theme if you need to make major changes. Note that due to security reason you cannot use the greater than symbol (>) as a child combinator selector."), -); +function at_core_custom_css_form(&$form) { + $form['at']['custom-styles'] = array( + '#type' => 'fieldset', + '#title' => t('Custom CSS'), + '#weight' => 30, + ); + $form['at']['custom-styles']['custom_css'] = array( + '#type' => 'textarea', + '#title' => t('Custom CSS'), + '#rows' => 15, + '#default_value' => at_get_setting('custom_css') ? filter_xss_admin(at_get_setting('custom_css')) : '/* Add any valid CSS declarations */', + '#description' => t("The styles you enter here will be saved to the public file system in themename.custom.css and are not affected by upgrades. Consider using a sub-theme if you need to make major changes. Note that due to security reason you cannot use the greater than symbol (>) as a child combinator selector."), + ); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.debug.inc b/at_core/inc/forms/settings.debug.inc index 1d1e8f3..230316f 100755 --- a/at_core/inc/forms/settings.debug.inc +++ b/at_core/inc/forms/settings.debug.inc @@ -5,75 +5,77 @@ * Generate settings for the Debuggers form. */ -$form['at-settings']['debug'] = array( - '#type' => 'fieldset', - '#title' => t('Debuggers'), -); -$form['at-settings']['debug']['debug-layout'] = array( - '#type' => 'fieldset', - '#title' => t('Debuggers'), - '#description' => t('

Debuggers

'), -); +function at_core_debug_form(&$form) { + $form['at-settings']['debug'] = array( + '#type' => 'fieldset', + '#title' => t('Debuggers'), + ); + $form['at-settings']['debug']['debug-layout'] = array( + '#type' => 'fieldset', + '#title' => t('Debuggers'), + '#description' => t('

Debuggers

'), + ); -// Highlight regions -$form['at-settings']['debug']['debug-layout']['expose_regions'] = array( - '#type' => 'checkbox', - '#title' => t('Highlight regions'), - '#default_value' => at_get_setting('expose_regions'), -); + // Highlight regions + $form['at-settings']['debug']['debug-layout']['expose_regions'] = array( + '#type' => 'checkbox', + '#title' => t('Highlight regions'), + '#default_value' => at_get_setting('expose_regions'), + ); -// Window size bookmarklet -$form['at-settings']['debug']['debug-layout']['show_window_size'] = array( - '#type' => 'checkbox', - '#title' => t('Show window size - appears in the bottom right corner'), - '#default_value' => at_get_setting('show_window_size'), -); + // Window size bookmarklet + $form['at-settings']['debug']['debug-layout']['show_window_size'] = array( + '#type' => 'checkbox', + '#title' => t('Show window size - appears in the bottom right corner'), + '#default_value' => at_get_setting('show_window_size'), + ); -// Version test -$form['at-settings']['debug']['debug-layout']['atcore_version_test'] = array( - '#type' => 'checkbox', - '#title' => t('Sub-theme compatibility test'), - '#default_value' => at_get_setting('atcore_version_test'), -); + // Version test + $form['at-settings']['debug']['debug-layout']['atcore_version_test'] = array( + '#type' => 'checkbox', + '#title' => t('Sub-theme compatibility test'), + '#default_value' => at_get_setting('atcore_version_test'), + ); -// Debug panels -$form['at-settings']['debug']['debug-panels'] = array( - '#type' => 'fieldset', - '#title' => t('

Debug Panels and Gpanels Layouts

'), - '#description' => t('

Debug Panels and Gpanels Layouts

'), -); -$form['at-settings']['debug']['debug-panels']['load_all_panels'] = array( - '#type' => 'checkbox', - '#title' => t('Load all panels in the front page content region'), - '#default_value' => at_get_setting('load_all_panels'), - '#description' => t('This will only load the layouts that ship with AT Core, the test is hard coded.'), -); -$form['at-settings']['debug']['debug-panels']['load_all_panels_no_sidebars'] = array( - '#type' => 'checkbox', - '#title' => t('Disable sidebars for the front page'), - '#default_value' => at_get_setting('load_all_panels_no_sidebars'), - '#states' => array( - 'visible' => array('input[name="load_all_panels"]' => array('checked' => TRUE)), - ), -); + // Debug panels + $form['at-settings']['debug']['debug-panels'] = array( + '#type' => 'fieldset', + '#title' => t('

Debug Panels and Gpanels Layouts

'), + '#description' => t('

Debug Panels and Gpanels Layouts

'), + ); + $form['at-settings']['debug']['debug-panels']['load_all_panels'] = array( + '#type' => 'checkbox', + '#title' => t('Load all panels in the front page content region'), + '#default_value' => at_get_setting('load_all_panels'), + '#description' => t('This will only load the layouts that ship with AT Core, the test is hard coded.'), + ); + $form['at-settings']['debug']['debug-panels']['load_all_panels_no_sidebars'] = array( + '#type' => 'checkbox', + '#title' => t('Disable sidebars for the front page'), + '#default_value' => at_get_setting('load_all_panels_no_sidebars'), + '#states' => array( + 'visible' => array('input[name="load_all_panels"]' => array('checked' => TRUE)), + ), + ); -// All media queries -$queries = '
'; -$queries .= '
Standard layout
@media ' . at_get_setting('bigscreen_media_query') . '
'; -$queries .= '
Tablet landscape
@media ' . at_get_setting('tablet_landscape_media_query') . '
'; -$queries .= '
Tablet portrait
@media ' . at_get_setting('tablet_portrait_media_query') . '
'; -$queries .= '
Smartphone landscape
@media ' . at_get_setting('smartphone_landscape_media_query') . '
'; -$queries .= '
Smartphone portrait
@media ' . at_get_setting('smartphone_portrait_media_query') . '
'; -$queries .= '
'; + // All media queries + $queries = '
'; + $queries .= '
Standard layout
@media ' . at_get_setting('bigscreen_media_query') . '
'; + $queries .= '
Tablet landscape
@media ' . at_get_setting('tablet_landscape_media_query') . '
'; + $queries .= '
Tablet portrait
@media ' . at_get_setting('tablet_portrait_media_query') . '
'; + $queries .= '
Smartphone landscape
@media ' . at_get_setting('smartphone_landscape_media_query') . '
'; + $queries .= '
Smartphone portrait
@media ' . at_get_setting('smartphone_portrait_media_query') . '
'; + $queries .= '
'; -// Sanity check -$queries = filter_xss($queries); + // Sanity check + $queries = filter_xss($queries); -$form['at-settings']['debug']['mediaqueries'] = array( - '#type' => 'fieldset', - '#title' => t('

All Media Queries

'), - '#description' => t('

All Media Queries

This shows the media queries currently being used by your theme. This is provided so you can easily save a backup copy for reference.

'), -); -$form['at-settings']['debug']['mediaqueries']['output'] = array( - '#markup' => $queries ? $queries : '', -); + $form['at-settings']['debug']['mediaqueries'] = array( + '#type' => 'fieldset', + '#title' => t('

All Media Queries

'), + '#description' => t('

All Media Queries

This shows the media queries currently being used by your theme. This is provided so you can easily save a backup copy for reference.

'), + ); + $form['at-settings']['debug']['mediaqueries']['output'] = array( + '#markup' => $queries ? $queries : '', + ); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.extensions.inc b/at_core/inc/forms/settings.extensions.inc index 4f45a8e..cdc83fc 100755 --- a/at_core/inc/forms/settings.extensions.inc +++ b/at_core/inc/forms/settings.extensions.inc @@ -5,115 +5,117 @@ * Generate settings for the Extensions form. */ -// Enable Extensions -$form['at-settings']['extend'] = array( - '#type' => 'fieldset', - '#title' => t('Extensions'), - '#description' => t('

Enable Additional Features

Extensions include many extras for configuring and styling your site. Enabled extensions will appear in new vertical tabs below the main setting. Extensions can be enabled or disabled individually, so you only load what you need. Disabling the global setting will globally disable most extensions, but not enable them.

Once you have enabled an extension you will need to configure its settings, then save the theme settings again (to save its configuration).

'), -); +function at_core_extensions_form(&$form) { + // Enable Extensions + $form['at-settings']['extend'] = array( + '#type' => 'fieldset', + '#title' => t('Extensions'), + '#description' => t('

Enable Additional Features

Extensions include many extras for configuring and styling your site. Enabled extensions will appear in new vertical tabs below the main setting. Extensions can be enabled or disabled individually, so you only load what you need. Disabling the global setting will globally disable most extensions, but not enable them.

Once you have enabled an extension you will need to configure its settings, then save the theme settings again (to save its configuration).

'), + ); -// Enable extensions, the extension settings are hidden by default to ease the -// the UI clutter, this setting is also used as a global enable/disable for any -// extension in other logical operations. -$form['at-settings']['extend']['enable_extensions'] = array( - '#type' => 'checkbox', - '#title' => t('Enable extensions (global setting)'), - '#default_value' => at_get_setting('enable_extensions'), -); + // Enable extensions, the extension settings are hidden by default to ease the + // the UI clutter, this setting is also used as a global enable/disable for any + // extension in other logical operations. + $form['at-settings']['extend']['enable_extensions'] = array( + '#type' => 'checkbox', + '#title' => t('Enable extensions (global setting)'), + '#default_value' => at_get_setting('enable_extensions'), + ); -$form['at-settings']['extend']['enable'] = array( - '#type' => 'fieldset', - '#title' => t('Extensions'), - '#states' => array( - 'visible' => array('input[name="enable_extensions"]' => array('checked' => TRUE)), - ), -); + $form['at-settings']['extend']['enable'] = array( + '#type' => 'fieldset', + '#title' => t('Extensions'), + '#states' => array( + 'visible' => array('input[name="enable_extensions"]' => array('checked' => TRUE)), + ), + ); -// Fonts -$form['at-settings']['extend']['enable']['enable_font_settings'] = array( - '#type' => 'checkbox', - '#title' => t('Fonts'), - '#default_value' => at_get_setting('enable_font_settings'), - '#description' => t('Apply fonts to site elements (page, titles, headings, menus and custom selectors). Supports websafe, custom and Google fonts, and @font-your-face integration.', array('!link' => 'http://drupal.org/project/fontyourface')), -); + // Fonts + $form['at-settings']['extend']['enable']['enable_font_settings'] = array( + '#type' => 'checkbox', + '#title' => t('Fonts'), + '#default_value' => at_get_setting('enable_font_settings'), + '#description' => t('Apply fonts to site elements (page, titles, headings, menus and custom selectors). Supports websafe, custom and Google fonts, and @font-your-face integration.', array('!link' => 'http://drupal.org/project/fontyourface')), + ); -// Title styles -$form['at-settings']['extend']['enable']['enable_heading_settings'] = array( - '#type' => 'checkbox', - '#title' => t('Title styles'), - '#default_value' => at_get_setting('enable_heading_settings'), - '#description' => t('Fine grain control over case, weight, alignment and CSS3 text shadows for page title, node, comment and block titles.'), -); + // Title styles + $form['at-settings']['extend']['enable']['enable_heading_settings'] = array( + '#type' => 'checkbox', + '#title' => t('Title styles'), + '#default_value' => at_get_setting('enable_heading_settings'), + '#description' => t('Fine grain control over case, weight, alignment and CSS3 text shadows for page title, node, comment and block titles.'), + ); -// Image alignment and captions -$form['at-settings']['extend']['enable']['enable_image_settings'] = array( - '#type' => 'checkbox', - '#title' => t('Image alignment and captions'), - '#default_value' => at_get_setting('enable_image_settings'), - '#description' => t('Set default image alignment, image captions and teaser image view.'), -); + // Image alignment and captions + $form['at-settings']['extend']['enable']['enable_image_settings'] = array( + '#type' => 'checkbox', + '#title' => t('Image alignment and captions'), + '#default_value' => at_get_setting('enable_image_settings'), + '#description' => t('Set default image alignment, image captions and teaser image view.'), + ); -// Apple touch icons -$form['at-settings']['extend']['enable']['enable_apple_touch_icons'] = array( - '#type' => 'checkbox', - '#title' => t('Apple touch icons'), - '#description' => t('Check this setting if you want to use touch icons for iOS, Android and Nokia devices.'), - '#default_value' => at_get_setting('enable_apple_touch_icons'), -); + // Apple touch icons + $form['at-settings']['extend']['enable']['enable_apple_touch_icons'] = array( + '#type' => 'checkbox', + '#title' => t('Apple touch icons'), + '#description' => t('Check this setting if you want to use touch icons for iOS, Android and Nokia devices.'), + '#default_value' => at_get_setting('enable_apple_touch_icons'), + ); -// Unset CSS -$form['at-settings']['extend']['enable']['enable_exclude_css'] = array( - '#type' => 'checkbox', - '#title' => t('Unset CSS Files'), - '#description' => t('Options to unset (exclude) CSS files from loading in your theme - includes settings for Core modules, CSS added by Libaries and your own declared exclusions (see your themes info file under "Stylesheets").'), - '#default_value' => at_get_setting('enable_exclude_css'), -); + // Unset CSS + $form['at-settings']['extend']['enable']['enable_exclude_css'] = array( + '#type' => 'checkbox', + '#title' => t('Unset CSS Files'), + '#description' => t('Options to unset (exclude) CSS files from loading in your theme - includes settings for Core modules, CSS added by Libaries and your own declared exclusions (see your themes info file under "Stylesheets").'), + '#default_value' => at_get_setting('enable_exclude_css'), + ); -// Custom CSS -$form['at-settings']['extend']['enable']['enable_custom_css'] = array( - '#type' => 'checkbox', - '#title' => t('Custom CSS'), - '#description' => t('Enter custom CSS rules for minor adjustment to your theme. Useful if you do not want to build a sub-theme and need modifications to survive theme upgrades if required.'), - '#default_value' => at_get_setting('enable_custom_css'), -); + // Custom CSS + $form['at-settings']['extend']['enable']['enable_custom_css'] = array( + '#type' => 'checkbox', + '#title' => t('Custom CSS'), + '#description' => t('Enter custom CSS rules for minor adjustment to your theme. Useful if you do not want to build a sub-theme and need modifications to survive theme upgrades if required.'), + '#default_value' => at_get_setting('enable_custom_css'), + ); -// Mobile regions and blocks -$form['at-settings']['extend']['enable']['enable_context_regions'] = array( - '#type' => 'checkbox', - '#title' => t('Mobile Regions and Blocks'), - '#description' => t('Unset regions or move blocks to another region in mobile devices. Requires the Browscap module for mobile device detection.', array('!browscap_module' => 'http://drupal.org/project/browscap')), - '#default_value' => at_get_setting('enable_context_regions'), -); + // Mobile regions and blocks + $form['at-settings']['extend']['enable']['enable_context_regions'] = array( + '#type' => 'checkbox', + '#title' => t('Mobile Regions and Blocks'), + '#description' => t('Unset regions or move blocks to another region in mobile devices. Requires the Browscap module for mobile device detection.', array('!browscap_module' => 'http://drupal.org/project/browscap')), + '#default_value' => at_get_setting('enable_context_regions'), + ); -// Float Region blocks -$form['at-settings']['extend']['enable']['enable_float_region_blocks'] = array( - '#type' => 'checkbox', - '#title' => t('Float Region blocks'), - '#description' => t('Float blocks in any region - this allows blocks to line up horizontally within a region, similar to a CSS grid or columns.'), - '#default_value' => at_get_setting('enable_float_region_blocks'), -); + // Float Region blocks + $form['at-settings']['extend']['enable']['enable_float_region_blocks'] = array( + '#type' => 'checkbox', + '#title' => t('Float Region blocks'), + '#description' => t('Float blocks in any region - this allows blocks to line up horizontally within a region, similar to a CSS grid or columns.'), + '#default_value' => at_get_setting('enable_float_region_blocks'), + ); -// Markup overrides -$form['at-settings']['extend']['enable']['enable_markup_overides'] = array( - '#type' => 'checkbox', - '#title' => t('Markup overrides'), - '#description' => t('Many additional options for adding, removing, hiding and changing site elements and markup - includes: -
    -
  • Set the gutter width
  • -
  • Use page--full-width-wrappers.tpl.php for 100% width header and footer designs
  • -
  • Enable page--[content-type].tpl.php suggestions
  • -
  • Wrap menu item text in SPAN tags
  • -
  • Breadcrumb Settings - hide, hide the home link, configure seperator, append the page title
  • -
  • Login Block - hide links, hide OpenID links, horizontal login block
  • -
  • Remove the frontpage title
  • -
  • Do not display the Main content block on the front page
  • -
  • Remove RSS feed icons
  • -
  • Hide comment titles
  • -
  • Remove menu link titles (tool tips)
  • -
  • Accessibility settings - set the skip navigation target ID, use extra fieldsets in the advanced search form
  • -
  • Add rel=author to user names
  • -
  • Add or remove CSS classes for pages, nodes, blocks, comments, menus and item lists
  • -
- '), - '#default_value' => at_get_setting('enable_markup_overides'), -); + // Markup overrides + $form['at-settings']['extend']['enable']['enable_markup_overides'] = array( + '#type' => 'checkbox', + '#title' => t('Markup overrides'), + '#description' => t('Many additional options for adding, removing, hiding and changing site elements and markup - includes: +
    +
  • Set the gutter width
  • +
  • Use page--full-width-wrappers.tpl.php for 100% width header and footer designs
  • +
  • Enable page--[content-type].tpl.php suggestions
  • +
  • Wrap menu item text in SPAN tags
  • +
  • Breadcrumb Settings - hide, hide the home link, configure seperator, append the page title
  • +
  • Login Block - hide links, hide OpenID links, horizontal login block
  • +
  • Remove the frontpage title
  • +
  • Do not display the Main content block on the front page
  • +
  • Remove RSS feed icons
  • +
  • Hide comment titles
  • +
  • Remove menu link titles (tool tips)
  • +
  • Accessibility settings - set the skip navigation target ID, use extra fieldsets in the advanced search form
  • +
  • Add rel=author to user names
  • +
  • Add or remove CSS classes for pages, nodes, blocks, comments, menus and item lists
  • +
+ '), + '#default_value' => at_get_setting('enable_markup_overides'), + ); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.floatregionblocks.inc b/at_core/inc/forms/settings.floatregionblocks.inc index ee9afed..3b37786 100755 --- a/at_core/inc/forms/settings.floatregionblocks.inc +++ b/at_core/inc/forms/settings.floatregionblocks.inc @@ -5,94 +5,96 @@ * Generate form elments for the Float Region Blocks settings. */ -// Regions we don't want to include -$unset_regions = array( - 'dashboard_main', - 'dashboard_sidebar', - 'dashboard_inactive', - 'page_bottom', - 'page_top', - 'content', // exclude the main content region -); +function at_core_float_region_blocks_form(&$form, $info_array) { + // Regions we don't want to include + $unset_regions = array( + 'dashboard_main', + 'dashboard_sidebar', + 'dashboard_inactive', + 'page_bottom', + 'page_top', + 'content', // exclude the main content region + ); -// Prepare regions -foreach ($info_array['regions'] as $key => $value) { - if (in_array($key, $unset_regions)) { - unset($key); - } - if (isset($key)) { - $regions[$key] = $value; + // Prepare regions + foreach ($info_array['regions'] as $key => $value) { + if (in_array($key, $unset_regions)) { + unset($key); + } + if (isset($key)) { + $regions[$key] = $value; + } } -} -// Setup the options for the select list -$fbr_options = array( - '' => t('none'), - '2' => '2', - '3' => '3', - '4' => '4', - '5' => '5', - '6' => '6', - '7' => '7', - '8' => '8', - '9' => '9', - '10' => '10', - '11' => '11', - '12' => '12', -); + // Setup the options for the select list + $fbr_options = array( + '' => t('none'), + '2' => '2', + '3' => '3', + '4' => '4', + '5' => '5', + '6' => '6', + '7' => '7', + '8' => '8', + '9' => '9', + '10' => '10', + '11' => '11', + '12' => '12', + ); -$direction_options = array( - 'left' => t('Left'), - 'right' => t('Right'), -); + $direction_options = array( + 'left' => t('Left'), + 'right' => t('Right'), + ); -// Don't include this feature for now, its too late in the cycle -// $breakpoints = array( -// '' => t('none - I can handle this in CSS'), -// 'smartphone_portrait' => t('Smartphone Portrait'), -// 'smartphone_landscape' => t('Smartphone Landscape'), -// 'tablet_portrait' => t('Tablet Portrait'), -// 'tablet_landscape' => t('Tablet Landscape'), -// ); + // Don't include this feature for now, its too late in the cycle + // $breakpoints = array( + // '' => t('none - I can handle this in CSS'), + // 'smartphone_portrait' => t('Smartphone Portrait'), + // 'smartphone_landscape' => t('Smartphone Landscape'), + // 'tablet_portrait' => t('Tablet Portrait'), + // 'tablet_landscape' => t('Tablet Landscape'), + // ); -// Top level wrapper fieldset -$form['at']['float-region-blocks'] = array( - '#type' => 'fieldset', - '#title' => t('Float Region Blocks'), - '#description' => t('

Float Region Blocks

Select number of columns(i) for each region. For example if you want four blocks to line horizontally up choose 4, then select the float direction. Clearing(ii) (if you are trying to create a grid) and mobile displays(iii) must be accounted for in your theme.

  1. This will not create real columns, it merely sets a width on each block in the region. For example if you select 4, each block will be 25% wide, if you then add a fifth block to that region it will wrap below the other four, and so on.
  2. There is no automagical clearing for uneven height blocks, so be weary of trying to create a grid with this. If you need real columns use a Gpanel or the Panels module.
  3. See responsive.custom.css in your theme for an example of how to control blocks in mobile displays.
', array('!gpanels_link' => 'http://adaptivethemes.com/documentation/using-gpanels', '!panels_link' => 'http://drupal.org/project/panels')), - '#weight' => 35, -); + // Top level wrapper fieldset + $form['at']['float-region-blocks'] = array( + '#type' => 'fieldset', + '#title' => t('Float Region Blocks'), + '#description' => t('

Float Region Blocks

Select number of columns(i) for each region. For example if you want four blocks to line horizontally up choose 4, then select the float direction. Clearing(ii) (if you are trying to create a grid) and mobile displays(iii) must be accounted for in your theme.

  1. This will not create real columns, it merely sets a width on each block in the region. For example if you select 4, each block will be 25% wide, if you then add a fifth block to that region it will wrap below the other four, and so on.
  2. There is no automagical clearing for uneven height blocks, so be weary of trying to create a grid with this. If you need real columns use a Gpanel or the Panels module.
  3. See responsive.custom.css in your theme for an example of how to control blocks in mobile displays.
', array('!gpanels_link' => 'http://adaptivethemes.com/documentation/using-gpanels', '!panels_link' => 'http://drupal.org/project/panels')), + '#weight' => 35, + ); -// Build form elements for each region -foreach ($regions as $region_name => $region_label) { + // Build form elements for each region + foreach ($regions as $region_name => $region_label) { - $title = check_plain($region_label); - $region_name = check_plain($region_name); + $title = check_plain($region_label); + $region_name = check_plain($region_name); - $form['at']['float-region-blocks']['region-options-' . $region_name] = array( - '#type' => 'fieldset', - '#title' => t("Options for the $title region"), - ); - $form['at']['float-region-blocks']['region-options-' . $region_name]['float_block_' . $region_name] = array( - '#type' => 'select', - '#title' => t($title), - '#default_value' => at_get_setting('float_block_' . $region_name), - '#options' => $fbr_options, - ); - $form['at']['float-region-blocks']['region-options-' . $region_name]['float_block_direction_' . $region_name] = array( - '#type' => 'radios', - '#title' => t('Float'), - '#default_value' => at_get_setting('float_block_direction_' . $region_name) ? at_get_setting('float_block_direction_' . $region_name) : 'left', - '#options' => $direction_options, - '#states' => array('invisible' => array('select[name=float_block_' . $region_name . ']' => array('value' => ''))), - ); + $form['at']['float-region-blocks']['region-options-' . $region_name] = array( + '#type' => 'fieldset', + '#title' => t("Options for the $title region"), + ); + $form['at']['float-region-blocks']['region-options-' . $region_name]['float_block_' . $region_name] = array( + '#type' => 'select', + '#title' => t($title), + '#default_value' => at_get_setting('float_block_' . $region_name), + '#options' => $fbr_options, + ); + $form['at']['float-region-blocks']['region-options-' . $region_name]['float_block_direction_' . $region_name] = array( + '#type' => 'radios', + '#title' => t('Float'), + '#default_value' => at_get_setting('float_block_direction_' . $region_name) ? at_get_setting('float_block_direction_' . $region_name) : 'left', + '#options' => $direction_options, + '#states' => array('invisible' => array('select[name=float_block_' . $region_name . ']' => array('value' => ''))), + ); - // Don't include this feature for now, its too late in the cycle, better to - // work on a much improved way of doing this for a point release later on. - //$form['at']['float-region-blocks']['region-options-' . $region_name]['float_block_breakpoint_' . $region_name] = array( - // '#type' => 'select', - // '#title' => t('Breakpoint'), - // '#default_value' => at_get_setting('float_block_breakpoint_' . $region_name), - // '#options' => $breakpoints, - //); -} + // Don't include this feature for now, its too late in the cycle, better to + // work on a much improved way of doing this for a point release later on. + //$form['at']['float-region-blocks']['region-options-' . $region_name]['float_block_breakpoint_' . $region_name] = array( + // '#type' => 'select', + // '#title' => t('Breakpoint'), + // '#default_value' => at_get_setting('float_block_breakpoint_' . $region_name), + // '#options' => $breakpoints, + //); + } +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.fonts.inc b/at_core/inc/forms/settings.fonts.inc index f1b4889..1bd4e1c 100755 --- a/at_core/inc/forms/settings.fonts.inc +++ b/at_core/inc/forms/settings.fonts.inc @@ -5,696 +5,698 @@ * Generate form elments for the font settings. */ -// Get the font elements array, this holds options and settings for each font type -$form_elements = font_elements(); - -// Get the font size lists -$font_sizes_em = font_sizes('em'); -$font_sizes_p = font_sizes('p'); - -// Get the google charsets and styles -$google_charsets = google_font_charsets(); -$google_styles = google_font_styles(); - -// Build a message for fonts depending on what is enabled -$fonts_message = t('

Fonts

First select the font type — websafe, google or custom — then select or enter the required information depending on the type. Adaptivetheme can also support any font supplied by the @font-your-face module, new settings and instructions will appear after you have installed @font-your-face.

To preview and gather required information for adding Google fonts see: google.com/webfonts. If you are adding extra styles or character sets these must exist for the specified font — use the Quick-use feature in Google fonts to check this information.

', -array( - '!gwf' => 'http://www.google.com/webfonts', - '!cfs' => 'http://coding.smashingmagazine.com/2009/09/22/complete-guide-to-css-font-stacks/', - '!module_fyf' => 'http://drupal.org/project/fontyourface', - ) -); - -// Build a list of font type options -$font_type_options = array( - '' => 'None', - '' => 'Websafe fonts', - 'gwf' => 'Basic Google font', - 'cfs' => 'Custom font stack', -); - -// Do some stuff if @font-your-face is enabled -$font_your_face_enabled = FALSE; -if (module_exists('fontyourface')) { - // add an option to the font type settings - $font_your_face_enabled = font_your_face_fonts_enabled(); - if ($font_your_face_enabled == TRUE) { - $fyf_type = array('fyf' => '@font-your-face'); - $font_type_options = array_merge($font_type_options, $fyf_type); - } +function at_fonts_form(&$form) { + // Get the font elements array, this holds options and settings for each font type + $form_elements = font_elements(); + + // Get the font size lists + $font_sizes_em = font_sizes('em'); + $font_sizes_p = font_sizes('p'); - // Special message once font your face in installed - $browse_fyf = l(t('@font-your-face library'), 'admin/appearance/fontyourface/browse', array('attributes' => array('target' => array('_blank')))); - $settings_fyf = l(t('"add selector in theme CSS"'), 'admin/appearance/fontyourface', array('attributes' => array('target' => array('_blank')))); - $fonts_message = t('

Fonts

First select the font type — websafe, google, custom or @font-your-face — then select or enter the required information depending on the type. To use @font-your-face you must first enable fonts in the !browse_fyf, then set those fonts to !settings_fyf. When you have done this the @font-your-face fonts will be availble here for you to apply to your content and titles. @font-your-face integration has only been tested with Google and Font Squirrel.

To preview and gather required information for adding Google fonts see: google.com/webfonts. If you are adding extra styles or character sets these must exist for the specified font — use the Quick-use feature in Google fonts to check this information.

', + // Get the google charsets and styles + $google_charsets = google_font_charsets(); + $google_styles = google_font_styles(); + + // Build a message for fonts depending on what is enabled + $fonts_message = t('

Fonts

First select the font type — websafe, google or custom — then select or enter the required information depending on the type. Adaptivetheme can also support any font supplied by the @font-your-face module, new settings and instructions will appear after you have installed @font-your-face.

To preview and gather required information for adding Google fonts see: google.com/webfonts. If you are adding extra styles or character sets these must exist for the specified font — use the Quick-use feature in Google fonts to check this information.

', array( '!gwf' => 'http://www.google.com/webfonts', '!cfs' => 'http://coding.smashingmagazine.com/2009/09/22/complete-guide-to-css-font-stacks/', - '!browse_fyf' => $browse_fyf, - '!settings_fyf' => $settings_fyf, + '!module_fyf' => 'http://drupal.org/project/fontyourface', ) ); -} - -// Some re-usable strings, fixing things in multiple places annoys me -$google_font_description = t('Paste the Google font name, e.g. Open Sans Condensed. Only add one font.'); -$custom_stack_description = t("Enter a comma seperated list of fonts, with no trailing comma. Names with spaces should be wrapped in single quotes, for example 'Times New Roman'."); - -// Fonts -$form['at']['font'] = array( - '#type' => 'fieldset', - '#title' => t('Fonts'), - '#description' => $fonts_message, - '#attributes' => array('class' => array('font-element-wrapper')), - '#weight' => -110, -); - -// Base font - global font family unless overridden by a more specific selector -$form['at']['font']['base-font'] = array( - '#type' => 'fieldset', - '#title' => t('Default font'), -); -$form['at']['font']['base-font']['base_font_type'] = array( - '#type' => 'select', - '#title' => t('Type'), - '#options' => $font_type_options, - '#default_value' => at_get_setting('base_font_type'), -); -$form['at']['font']['base-font']['base_font'] = array( - '#type' => 'select', - '#title' => t('Font'), - '#default_value' => at_get_setting('base_font'), - '#options' => str_replace("'", "", font_list('wsf', 'bf')), - '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => ''))), -); - -// Google web font -$form['at']['font']['base-font']['base_font_gwf'] = array( - '#type' => 'textfield', - '#title' => t('Google Font Name'), - '#default_value' => filter_xss_admin(at_get_setting('base_font_gwf')), - '#description' => $google_font_description, - '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'gwf'))), -); -$form['at']['font']['base-font']['base_font_gwf_styles'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Styles'), - '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'gwf'))), -); -$form['at']['font']['base-font']['base_font_gwf_styles']['base_font_gwf_add_styles'] = array( - '#type' => 'checkbox', - '#title' => t('Styles'), - '#default_value' => at_get_setting('base_font_gwf_add_styles'), -); -foreach ($google_styles as $style_key => $style_value) { - $form['at']['font']['base-font']['base_font_gwf_styles']["base_font_gwf_add_styles_$style_key"] = array( - '#type' => 'checkbox', - '#title' => t($style_value), - '#default_value' => at_get_setting("base_font_gwf_add_styles_$style_key"), - '#states' => array('visible' => array('input[name="base_font_gwf_add_styles"]' => array('checked' => TRUE))), + + // Build a list of font type options + $font_type_options = array( + '' => 'None', + '' => 'Websafe fonts', + 'gwf' => 'Basic Google font', + 'cfs' => 'Custom font stack', ); -} -$form['at']['font']['base-font']['base_font_gwf_charsets'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Character Sets'), - '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'gwf'))), -); -$form['at']['font']['base-font']['base_font_gwf_charsets']['base_font_gwf_add_charsets'] = array( - '#type' => 'checkbox', - '#title' => t('Character Sets'), - '#default_value' => at_get_setting('base_font_gwf_add_charsets'), - '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'gwf'))), -); -foreach ($google_charsets as $charset_key => $charset_value) { - $form['at']['font']['base-font']['base_font_gwf_charsets']["base_font_gwf_add_charsets_$charset_key"] = array( - '#type' => 'checkbox', - '#title' => t($charset_value), - '#default_value' => at_get_setting("base_font_gwf_add_charsets_$charset_key"), - '#states' => array('visible' => array('input[name="base_font_gwf_add_charsets"]' => array('checked' => TRUE))), + + // Do some stuff if @font-your-face is enabled + $font_your_face_enabled = FALSE; + if (module_exists('fontyourface')) { + // add an option to the font type settings + $font_your_face_enabled = font_your_face_fonts_enabled(); + if ($font_your_face_enabled == TRUE) { + $fyf_type = array('fyf' => '@font-your-face'); + $font_type_options = array_merge($font_type_options, $fyf_type); + } + + // Special message once font your face in installed + $browse_fyf = l(t('@font-your-face library'), 'admin/appearance/fontyourface/browse', array('attributes' => array('target' => array('_blank')))); + $settings_fyf = l(t('"add selector in theme CSS"'), 'admin/appearance/fontyourface', array('attributes' => array('target' => array('_blank')))); + $fonts_message = t('

Fonts

First select the font type — websafe, google, custom or @font-your-face — then select or enter the required information depending on the type. To use @font-your-face you must first enable fonts in the !browse_fyf, then set those fonts to !settings_fyf. When you have done this the @font-your-face fonts will be availble here for you to apply to your content and titles. @font-your-face integration has only been tested with Google and Font Squirrel.

To preview and gather required information for adding Google fonts see: google.com/webfonts. If you are adding extra styles or character sets these must exist for the specified font — use the Quick-use feature in Google fonts to check this information.

', + array( + '!gwf' => 'http://www.google.com/webfonts', + '!cfs' => 'http://coding.smashingmagazine.com/2009/09/22/complete-guide-to-css-font-stacks/', + '!browse_fyf' => $browse_fyf, + '!settings_fyf' => $settings_fyf, + ) + ); + } + + // Some re-usable strings, fixing things in multiple places annoys me + $google_font_description = t('Paste the Google font name, e.g. Open Sans Condensed. Only add one font.'); + $custom_stack_description = t("Enter a comma seperated list of fonts, with no trailing comma. Names with spaces should be wrapped in single quotes, for example 'Times New Roman'."); + + // Fonts + $form['at']['font'] = array( + '#type' => 'fieldset', + '#title' => t('Fonts'), + '#description' => $fonts_message, + '#attributes' => array('class' => array('font-element-wrapper')), + '#weight' => -110, ); -} - -// Custom font stack -$form['at']['font']['base-font']['base_font_cfs'] = array( - '#type' => 'textfield', - '#title' => t('Font'), - '#default_value' => filter_xss_admin(at_get_setting('base_font_cfs')), - '#description' => $custom_stack_description, - '#states' => array( - 'visible' => array('select[name="base_font_type"]' => array('value' => 'cfs')), - 'required' => array('select[name="base_font_type"]' => array('value' => 'cfs')), - ) -); - -// Font your face -if ($font_your_face_enabled == TRUE) { - $form['at']['font']['base-font']['base_font_fyf'] = array( + + // Base font - global font family unless overridden by a more specific selector + $form['at']['font']['base-font'] = array( + '#type' => 'fieldset', + '#title' => t('Default font'), + ); + $form['at']['font']['base-font']['base_font_type'] = array( + '#type' => 'select', + '#title' => t('Type'), + '#options' => $font_type_options, + '#default_value' => at_get_setting('base_font_type'), + ); + $form['at']['font']['base-font']['base_font'] = array( '#type' => 'select', '#title' => t('Font'), - '#default_value' => at_get_setting('base_font_fyf'), - '#options' => font_list('fyf', 'bf'), - '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'fyf'))), + '#default_value' => at_get_setting('base_font'), + '#options' => str_replace("'", "", font_list('wsf', 'bf')), + '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => ''))), + ); + + // Google web font + $form['at']['font']['base-font']['base_font_gwf'] = array( + '#type' => 'textfield', + '#title' => t('Google Font Name'), + '#default_value' => filter_xss_admin(at_get_setting('base_font_gwf')), + '#description' => $google_font_description, + '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'gwf'))), + ); + $form['at']['font']['base-font']['base_font_gwf_styles'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Styles'), + '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'gwf'))), + ); + $form['at']['font']['base-font']['base_font_gwf_styles']['base_font_gwf_add_styles'] = array( + '#type' => 'checkbox', + '#title' => t('Styles'), + '#default_value' => at_get_setting('base_font_gwf_add_styles'), ); -} - -// Size -$form['at']['font']['base-font']['base_font_size'] = array( - '#type' => 'select', - '#title' => t('Size'), - '#options' => $font_sizes_p, - '#description' => t('The default font size is set on the HTML element. All elements, margins, padding and widths using a relative unit such as em or % will scale relative to this value. Use "Not set" if you prefer to set this in your CSS. You can override this value in your responsive stylesheets also, to use a larger or smaller default size for different device types.'), - '#default_value' => at_get_setting('base_font_size'), - '#attributes' => array('class' => array('font-size-wrapper')), -); - -// Titles -$form['at']['font']['titles'] = array( - '#type' => 'fieldset', - '#title' => t('Titles'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, -); -foreach ($form_elements as $key => $value) { - - $form_type = $key; - $font_element_type = $value['type']; - - if ($font_element_type === 'title') { - - $element = $value['element']; // e.g. "bf" (base-font), this is used to set array keys - $setting = $value['setting']; // the theme setting used to retrieve the font values, e.g. "site_name_font" - - $setting_container = str_replace('_', '-', $setting) . '-selector'; // a nicer string for fielset classes - $title = str_replace('_', ' ', drupal_ucfirst($form_type)); // use the key for titles, it doesnt have "font" in it - - // Set easy reusable variables - $setting_type = $setting . '_type'; - $setting_font = $setting . '_font'; - $setting_gwf = $setting . '_gwf'; - $setting_cfs = $setting . '_cfs'; - $setting_yfy = $setting . '_fyf'; - $setting_size = $setting . '_size'; - - $form['at']['font']['titles'][$setting_container] = array( - '#type' => 'fieldset', - '#title' => t($title), + foreach ($google_styles as $style_key => $style_value) { + $form['at']['font']['base-font']['base_font_gwf_styles']["base_font_gwf_add_styles_$style_key"] = array( + '#type' => 'checkbox', + '#title' => t($style_value), + '#default_value' => at_get_setting("base_font_gwf_add_styles_$style_key"), + '#states' => array('visible' => array('input[name="base_font_gwf_add_styles"]' => array('checked' => TRUE))), ); - $form['at']['font']['titles'][$setting_container][$setting_type] = array( - '#type' => 'select', - '#title' => t('Type'), - '#options' => $font_type_options, - '#default_value' => at_get_setting($setting_type), + } + $form['at']['font']['base-font']['base_font_gwf_charsets'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Character Sets'), + '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'gwf'))), + ); + $form['at']['font']['base-font']['base_font_gwf_charsets']['base_font_gwf_add_charsets'] = array( + '#type' => 'checkbox', + '#title' => t('Character Sets'), + '#default_value' => at_get_setting('base_font_gwf_add_charsets'), + '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'gwf'))), + ); + foreach ($google_charsets as $charset_key => $charset_value) { + $form['at']['font']['base-font']['base_font_gwf_charsets']["base_font_gwf_add_charsets_$charset_key"] = array( + '#type' => 'checkbox', + '#title' => t($charset_value), + '#default_value' => at_get_setting("base_font_gwf_add_charsets_$charset_key"), + '#states' => array('visible' => array('input[name="base_font_gwf_add_charsets"]' => array('checked' => TRUE))), ); - $form['at']['font']['titles'][$setting_container][$setting] = array( + } + + // Custom font stack + $form['at']['font']['base-font']['base_font_cfs'] = array( + '#type' => 'textfield', + '#title' => t('Font'), + '#default_value' => filter_xss_admin(at_get_setting('base_font_cfs')), + '#description' => $custom_stack_description, + '#states' => array( + 'visible' => array('select[name="base_font_type"]' => array('value' => 'cfs')), + 'required' => array('select[name="base_font_type"]' => array('value' => 'cfs')), + ) + ); + + // Font your face + if ($font_your_face_enabled == TRUE) { + $form['at']['font']['base-font']['base_font_fyf'] = array( '#type' => 'select', '#title' => t('Font'), - '#default_value' => at_get_setting($setting), - '#options' => str_replace("'", "", font_list('wsf', $element)), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => ''))), + '#default_value' => at_get_setting('base_font_fyf'), + '#options' => font_list('fyf', 'bf'), + '#states' => array('visible' => array('select[name="base_font_type"]' => array('value' => 'fyf'))), ); + } - // Google web fonts - $form['at']['font']['titles'][$setting_container][$setting_gwf] = array( - '#type' => 'textfield', - '#title' => t('Google Font Name'), - '#default_value' => filter_xss_admin(at_get_setting($setting_gwf)), - '#description' => $google_font_description, - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - $title_styles_setting = $setting_gwf . '_add_styles'; - $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_styles'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Styles'), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_styles'][$title_styles_setting] = array( - '#type' => 'checkbox', - '#title' => t('Styles'), - '#default_value' => at_get_setting($title_styles_setting), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - foreach ($google_styles as $style_key => $style_value) { - $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_styles'][$title_styles_setting . '_' . $style_key] = array( + // Size + $form['at']['font']['base-font']['base_font_size'] = array( + '#type' => 'select', + '#title' => t('Size'), + '#options' => $font_sizes_p, + '#description' => t('The default font size is set on the HTML element. All elements, margins, padding and widths using a relative unit such as em or % will scale relative to this value. Use "Not set" if you prefer to set this in your CSS. You can override this value in your responsive stylesheets also, to use a larger or smaller default size for different device types.'), + '#default_value' => at_get_setting('base_font_size'), + '#attributes' => array('class' => array('font-size-wrapper')), + ); + + // Titles + $form['at']['font']['titles'] = array( + '#type' => 'fieldset', + '#title' => t('Titles'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + foreach ($form_elements as $key => $value) { + + $form_type = $key; + $font_element_type = $value['type']; + + if ($font_element_type === 'title') { + + $element = $value['element']; // e.g. "bf" (base-font), this is used to set array keys + $setting = $value['setting']; // the theme setting used to retrieve the font values, e.g. "site_name_font" + + $setting_container = str_replace('_', '-', $setting) . '-selector'; // a nicer string for fielset classes + $title = str_replace('_', ' ', drupal_ucfirst($form_type)); // use the key for titles, it doesnt have "font" in it + + // Set easy reusable variables + $setting_type = $setting . '_type'; + $setting_font = $setting . '_font'; + $setting_gwf = $setting . '_gwf'; + $setting_cfs = $setting . '_cfs'; + $setting_yfy = $setting . '_fyf'; + $setting_size = $setting . '_size'; + + $form['at']['font']['titles'][$setting_container] = array( + '#type' => 'fieldset', + '#title' => t($title), + ); + $form['at']['font']['titles'][$setting_container][$setting_type] = array( + '#type' => 'select', + '#title' => t('Type'), + '#options' => $font_type_options, + '#default_value' => at_get_setting($setting_type), + ); + $form['at']['font']['titles'][$setting_container][$setting] = array( + '#type' => 'select', + '#title' => t('Font'), + '#default_value' => at_get_setting($setting), + '#options' => str_replace("'", "", font_list('wsf', $element)), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => ''))), + ); + + // Google web fonts + $form['at']['font']['titles'][$setting_container][$setting_gwf] = array( + '#type' => 'textfield', + '#title' => t('Google Font Name'), + '#default_value' => filter_xss_admin(at_get_setting($setting_gwf)), + '#description' => $google_font_description, + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + $title_styles_setting = $setting_gwf . '_add_styles'; + $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_styles'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Styles'), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_styles'][$title_styles_setting] = array( '#type' => 'checkbox', - '#title' => t($style_value), - '#default_value' => at_get_setting($title_styles_setting . '_' . $style_key), - '#states' => array('visible' => array(":input[name=$title_styles_setting]" => array('checked' => TRUE))), + '#title' => t('Styles'), + '#default_value' => at_get_setting($title_styles_setting), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), ); - } - $title_charsets_setting = $setting_gwf . '_add_charsets'; - $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_charsets'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Character Sets'), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_charsets'][$title_charsets_setting] = array( - '#type' => 'checkbox', - '#title' => t('Character Sets'), - '#default_value' => at_get_setting($title_charsets_setting), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - foreach ($google_charsets as $charset_key => $charset_value) { - $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_charsets'][$title_charsets_setting . '_' . $charset_key] = array( + foreach ($google_styles as $style_key => $style_value) { + $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_styles'][$title_styles_setting . '_' . $style_key] = array( + '#type' => 'checkbox', + '#title' => t($style_value), + '#default_value' => at_get_setting($title_styles_setting . '_' . $style_key), + '#states' => array('visible' => array(":input[name=$title_styles_setting]" => array('checked' => TRUE))), + ); + } + $title_charsets_setting = $setting_gwf . '_add_charsets'; + $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_charsets'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Character Sets'), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_charsets'][$title_charsets_setting] = array( '#type' => 'checkbox', - '#title' => t($charset_value), - '#default_value' => at_get_setting($title_charsets_setting . '_' . $charset_key), - '#states' => array('visible' => array(":input[name=$title_charsets_setting]" => array('checked' => TRUE))), + '#title' => t('Character Sets'), + '#default_value' => at_get_setting($title_charsets_setting), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + foreach ($google_charsets as $charset_key => $charset_value) { + $form['at']['font']['titles'][$setting_container][$setting_container . '_gwf_charsets'][$title_charsets_setting . '_' . $charset_key] = array( + '#type' => 'checkbox', + '#title' => t($charset_value), + '#default_value' => at_get_setting($title_charsets_setting . '_' . $charset_key), + '#states' => array('visible' => array(":input[name=$title_charsets_setting]" => array('checked' => TRUE))), + ); + } + + // Custom font stack + $form['at']['font']['titles'][$setting_container][$setting_cfs] = array( + '#type' => 'textfield', + '#title' => t('Font'), + '#default_value' => drupal_strip_dangerous_protocols(at_get_setting($setting_cfs)), + '#description' => $custom_stack_description, + '#states' => array( + 'visible' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), + 'required' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), + ), ); - } - - // Custom font stack - $form['at']['font']['titles'][$setting_container][$setting_cfs] = array( - '#type' => 'textfield', - '#title' => t('Font'), - '#default_value' => drupal_strip_dangerous_protocols(at_get_setting($setting_cfs)), - '#description' => $custom_stack_description, - '#states' => array( - 'visible' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), - 'required' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), - ), - ); - // Font your face - if ($font_your_face_enabled == TRUE) { - $form['at']['font']['titles'][$setting_container][$setting_yfy] = array( + // Font your face + if ($font_your_face_enabled == TRUE) { + $form['at']['font']['titles'][$setting_container][$setting_yfy] = array( + '#type' => 'select', + '#title' => t('Font'), + '#default_value' => at_get_setting($setting_yfy), + '#options' => font_list('fyf', $element), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'fyf'))), + ); + } + + // Size + $form['at']['font']['titles'][$setting_container][$setting_size] = array( '#type' => 'select', - '#title' => t('Font'), - '#default_value' => at_get_setting($setting_yfy), - '#options' => font_list('fyf', $element), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'fyf'))), + '#title' => t('Size'), + '#options' => $font_sizes_em, + '#default_value' => at_get_setting($setting_size), + '#attributes' => array('class' => array('font-size-wrapper')), ); } - - // Size - $form['at']['font']['titles'][$setting_container][$setting_size] = array( - '#type' => 'select', - '#title' => t('Size'), - '#options' => $font_sizes_em, - '#default_value' => at_get_setting($setting_size), - '#attributes' => array('class' => array('font-size-wrapper')), - ); } -} -// In Content Headings -$form['at']['font']['headings'] = array( - '#type' => 'fieldset', - '#title' => t('Headings'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, -); -foreach ($form_elements as $key => $value) { + // In Content Headings + $form['at']['font']['headings'] = array( + '#type' => 'fieldset', + '#title' => t('Headings'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + foreach ($form_elements as $key => $value) { - $form_type = $key; - $font_element_subtype = $value['subtype']; + $form_type = $key; + $font_element_subtype = $value['subtype']; - // we have to handle subgroups seperatly - if ($font_element_subtype === 'heading_group') { + // we have to handle subgroups seperatly + if ($font_element_subtype === 'heading_group') { - // e.g. "bf" (base-font), this is used to set array keys - $element = $value['element']; + // e.g. "bf" (base-font), this is used to set array keys + $element = $value['element']; - // the theme setting used to retrieve the font values, e.g. "site_name_font" - $setting = $value['setting']; + // the theme setting used to retrieve the font values, e.g. "site_name_font" + $setting = $value['setting']; - // a nicer string for fielset classes - $setting_container = str_replace('_', '-', $setting) . '-selector'; + // a nicer string for fielset classes + $setting_container = str_replace('_', '-', $setting) . '-selector'; - // Custom titles - if ($element === 'h1h4') { - $title = 'h1 to h4'; - } - else { - $title = 'h5 and h6'; - } + // Custom titles + if ($element === 'h1h4') { + $title = 'h1 to h4'; + } + else { + $title = 'h5 and h6'; + } - // Set easy reusable variables - $setting_type = $setting . '_type'; - $setting_font = $setting . '_font'; - $setting_gwf = $setting . '_gwf'; - $setting_cfs = $setting . '_cfs'; - $setting_yfy = $setting . '_fyf'; + // Set easy reusable variables + $setting_type = $setting . '_type'; + $setting_font = $setting . '_font'; + $setting_gwf = $setting . '_gwf'; + $setting_cfs = $setting . '_cfs'; + $setting_yfy = $setting . '_fyf'; - $form['at']['font']['headings'][$setting_container] = array( - '#type' => 'fieldset', - '#title' => t($title), - ); - $form['at']['font']['headings'][$setting_container][$setting_type] = array( - '#type' => 'select', - '#title' => t('Type'), - '#options' => $font_type_options, - '#default_value' => at_get_setting($setting_type), - ); - $form['at']['font']['headings'][$setting_container][$setting] = array( - '#type' => 'select', - '#title' => t('Font'), - '#default_value' => at_get_setting($setting), - '#options' => str_replace("'", "", font_list('wsf', $element)), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => ''))), - ); + $form['at']['font']['headings'][$setting_container] = array( + '#type' => 'fieldset', + '#title' => t($title), + ); + $form['at']['font']['headings'][$setting_container][$setting_type] = array( + '#type' => 'select', + '#title' => t('Type'), + '#options' => $font_type_options, + '#default_value' => at_get_setting($setting_type), + ); + $form['at']['font']['headings'][$setting_container][$setting] = array( + '#type' => 'select', + '#title' => t('Font'), + '#default_value' => at_get_setting($setting), + '#options' => str_replace("'", "", font_list('wsf', $element)), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => ''))), + ); - // Google web fonts - $form['at']['font']['headings'][$setting_container][$setting_gwf] = array( - '#type' => 'textfield', - '#title' => t('Google Font Name'), - '#default_value' => filter_xss_admin(at_get_setting($setting_gwf)), - '#description' => $google_font_description, - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - $headings_styles_setting = $setting_gwf . '_add_styles'; - $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_styles'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Styles'), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_styles'][$headings_styles_setting] = array( - '#type' => 'checkbox', - '#title' => t('Styles'), - '#default_value' => at_get_setting($headings_styles_setting), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - foreach ($google_styles as $style_key => $style_value) { - $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_styles'][$headings_styles_setting . '_' . $style_key] = array( + // Google web fonts + $form['at']['font']['headings'][$setting_container][$setting_gwf] = array( + '#type' => 'textfield', + '#title' => t('Google Font Name'), + '#default_value' => filter_xss_admin(at_get_setting($setting_gwf)), + '#description' => $google_font_description, + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + $headings_styles_setting = $setting_gwf . '_add_styles'; + $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_styles'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Styles'), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_styles'][$headings_styles_setting] = array( '#type' => 'checkbox', - '#title' => t($style_value), - '#default_value' => at_get_setting($headings_styles_setting . '_' . $style_key), - '#states' => array('visible' => array(":input[name=$headings_styles_setting]" => array('checked' => TRUE))), + '#title' => t('Styles'), + '#default_value' => at_get_setting($headings_styles_setting), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), ); - } - $headings_charsets_setting = $setting_gwf . '_add_charsets'; - $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_charsets'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Character Sets'), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_charsets'][$headings_charsets_setting] = array( - '#type' => 'checkbox', - '#title' => t('Character Sets'), - '#default_value' => at_get_setting($headings_charsets_setting), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - foreach ($google_charsets as $charset_key => $charset_value) { - $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_charsets'][$headings_charsets_setting . '_' . $charset_key] = array( + foreach ($google_styles as $style_key => $style_value) { + $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_styles'][$headings_styles_setting . '_' . $style_key] = array( + '#type' => 'checkbox', + '#title' => t($style_value), + '#default_value' => at_get_setting($headings_styles_setting . '_' . $style_key), + '#states' => array('visible' => array(":input[name=$headings_styles_setting]" => array('checked' => TRUE))), + ); + } + $headings_charsets_setting = $setting_gwf . '_add_charsets'; + $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_charsets'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Character Sets'), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_charsets'][$headings_charsets_setting] = array( '#type' => 'checkbox', - '#title' => t($charset_value), - '#default_value' => at_get_setting($headings_charsets_setting . '_' . $charset_key), - '#states' => array('visible' => array(":input[name=$headings_charsets_setting]" => array('checked' => TRUE))), + '#title' => t('Character Sets'), + '#default_value' => at_get_setting($headings_charsets_setting), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), ); - } - - // Custom font stacks - $form['at']['font']['headings'][$setting_container][$setting_cfs] = array( - '#type' => 'textfield', - '#title' => t('Font'), - '#default_value' => filter_xss_admin(at_get_setting($setting_cfs)), - '#description' => $custom_stack_description, - '#states' => array( - 'visible' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), - 'required' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), - ), - ); - - // Font your face - if ($font_your_face_enabled == TRUE) { - $form['at']['font']['headings'][$setting_container][$setting_yfy] = array( - '#type' => 'select', + foreach ($google_charsets as $charset_key => $charset_value) { + $form['at']['font']['headings'][$setting_container][$setting_container . '_gwf_charsets'][$headings_charsets_setting . '_' . $charset_key] = array( + '#type' => 'checkbox', + '#title' => t($charset_value), + '#default_value' => at_get_setting($headings_charsets_setting . '_' . $charset_key), + '#states' => array('visible' => array(":input[name=$headings_charsets_setting]" => array('checked' => TRUE))), + ); + } + + // Custom font stacks + $form['at']['font']['headings'][$setting_container][$setting_cfs] = array( + '#type' => 'textfield', '#title' => t('Font'), - '#default_value' => at_get_setting($setting_yfy), - '#options' => font_list('fyf', $element), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'fyf'))), + '#default_value' => filter_xss_admin(at_get_setting($setting_cfs)), + '#description' => $custom_stack_description, + '#states' => array( + 'visible' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), + 'required' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), + ), ); + + // Font your face + if ($font_your_face_enabled == TRUE) { + $form['at']['font']['headings'][$setting_container][$setting_yfy] = array( + '#type' => 'select', + '#title' => t('Font'), + '#default_value' => at_get_setting($setting_yfy), + '#options' => font_list('fyf', $element), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'fyf'))), + ); + } } } -} -// Size for in-content headings -$form['at']['font']['headings']['sizes'] = array( - '#type' => 'fieldset', - '#title' => t('Size'), - '#attributes' => array('class' => array('font-element-wrapper')) -); -foreach ($form_elements as $key => $value) { + // Size for in-content headings + $form['at']['font']['headings']['sizes'] = array( + '#type' => 'fieldset', + '#title' => t('Size'), + '#attributes' => array('class' => array('font-element-wrapper')) + ); + foreach ($form_elements as $key => $value) { - $form_type = $key; - $font_element_subtype = $value['subtype']; + $form_type = $key; + $font_element_subtype = $value['subtype']; - // we have to handle subgroups seperatly - if ($font_element_subtype === 'heading_level') { + // we have to handle subgroups seperatly + if ($font_element_subtype === 'heading_level') { - // e.g. "bf" (base-font), this is used to set array keys - $element = $value['element']; + // e.g. "bf" (base-font), this is used to set array keys + $element = $value['element']; - // the theme setting used to retrieve the font values, e.g. "site_name_font" - $setting = $value['setting']; + // the theme setting used to retrieve the font values, e.g. "site_name_font" + $setting = $value['setting']; - // Set easy reusable variables - $setting_type = $setting . '_type'; - $setting_size = $setting . '_size'; + // Set easy reusable variables + $setting_type = $setting . '_type'; + $setting_size = $setting . '_size'; - $form['at']['font']['headings']['sizes'][$setting_size] = array( - '#type' => 'select', - '#title' => t($element), // element as title is fine in this context - '#options' => $font_sizes_em, - '#default_value' => at_get_setting($setting_size), - '#attributes' => array('class' => array('font-size-wrapper')), - ); + $form['at']['font']['headings']['sizes'][$setting_size] = array( + '#type' => 'select', + '#title' => t($element), // element as title is fine in this context + '#options' => $font_sizes_em, + '#default_value' => at_get_setting($setting_size), + '#attributes' => array('class' => array('font-size-wrapper')), + ); + } } -} -// Menus -$form['at']['font']['menus'] = array( - '#type' => 'fieldset', - '#title' => t('Menus'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, -); -foreach ($form_elements as $key => $value) { + // Menus + $form['at']['font']['menus'] = array( + '#type' => 'fieldset', + '#title' => t('Menus'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + foreach ($form_elements as $key => $value) { - $form_type = $key; - $font_element_type = $value['type']; + $form_type = $key; + $font_element_type = $value['type']; - if ($font_element_type === 'menu') { + if ($font_element_type === 'menu') { - // e.g. "bf" (base-font), this is used to set array keys - $element = $value['element']; + // e.g. "bf" (base-font), this is used to set array keys + $element = $value['element']; - // the theme setting used to retrieve the font values, e.g. "site_name_font" - $setting = $value['setting']; + // the theme setting used to retrieve the font values, e.g. "site_name_font" + $setting = $value['setting']; - // a nicer string for fielset classes - $setting_container = str_replace('_', '-', $setting) . '-selector'; + // a nicer string for fielset classes + $setting_container = str_replace('_', '-', $setting) . '-selector'; - // use the key for titles, it doesnt have "font" in it - $title = str_replace('_', ' ', drupal_ucfirst($form_type)); + // use the key for titles, it doesnt have "font" in it + $title = str_replace('_', ' ', drupal_ucfirst($form_type)); - // Set easy reusable variables - $setting_type = $setting . '_type'; - $setting_font = $setting . '_font'; - $setting_gwf = $setting . '_gwf'; - $setting_cfs = $setting . '_cfs'; - $setting_yfy = $setting . '_fyf'; - $setting_size = $setting . '_size'; + // Set easy reusable variables + $setting_type = $setting . '_type'; + $setting_font = $setting . '_font'; + $setting_gwf = $setting . '_gwf'; + $setting_cfs = $setting . '_cfs'; + $setting_yfy = $setting . '_fyf'; + $setting_size = $setting . '_size'; - $form['at']['font']['menus'][$setting_container] = array( - '#type' => 'fieldset', - '#title' => t($title), - ); - $form['at']['font']['menus'][$setting_container][$setting_type] = array( - '#type' => 'select', - '#title' => t('Type'), - '#options' => $font_type_options, - '#default_value' => at_get_setting($setting_type), - ); - $form['at']['font']['menus'][$setting_container][$setting] = array( - '#type' => 'select', - '#title' => t('Font'), - '#default_value' => at_get_setting($setting), - '#options' => str_replace("'", "", font_list('wsf', $element)), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => ''))), - ); + $form['at']['font']['menus'][$setting_container] = array( + '#type' => 'fieldset', + '#title' => t($title), + ); + $form['at']['font']['menus'][$setting_container][$setting_type] = array( + '#type' => 'select', + '#title' => t('Type'), + '#options' => $font_type_options, + '#default_value' => at_get_setting($setting_type), + ); + $form['at']['font']['menus'][$setting_container][$setting] = array( + '#type' => 'select', + '#title' => t('Font'), + '#default_value' => at_get_setting($setting), + '#options' => str_replace("'", "", font_list('wsf', $element)), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => ''))), + ); - // Google web fonts - $form['at']['font']['menus'][$setting_container][$setting_gwf] = array( - '#type' => 'textfield', - '#title' => t('Google Font Name'), - '#default_value' => filter_xss_admin(at_get_setting($setting_gwf)), - '#description' => $google_font_description, - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - $menus_styles_setting = $setting_gwf . '_add_styles'; - $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_styles'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Styles'), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_styles'][$menus_styles_setting] = array( - '#type' => 'checkbox', - '#title' => t('Styles'), - '#default_value' => at_get_setting($menus_styles_setting), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - foreach ($google_styles as $style_key => $style_value) { - $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_styles'][$menus_styles_setting . '_' . $style_key] = array( + // Google web fonts + $form['at']['font']['menus'][$setting_container][$setting_gwf] = array( + '#type' => 'textfield', + '#title' => t('Google Font Name'), + '#default_value' => filter_xss_admin(at_get_setting($setting_gwf)), + '#description' => $google_font_description, + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + $menus_styles_setting = $setting_gwf . '_add_styles'; + $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_styles'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Styles'), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_styles'][$menus_styles_setting] = array( '#type' => 'checkbox', - '#title' => t($style_value), - '#default_value' => at_get_setting($menus_styles_setting . '_' . $style_key), - '#states' => array('visible' => array(":input[name=$menus_styles_setting]" => array('checked' => TRUE))), + '#title' => t('Styles'), + '#default_value' => at_get_setting($menus_styles_setting), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), ); - } - $menus_charsets_setting = $setting_gwf . '_add_charsets'; - $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_charsets'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Character Sets'), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_charsets'][$menus_charsets_setting] = array( - '#type' => 'checkbox', - '#title' => t('Character Sets'), - '#default_value' => at_get_setting($menus_charsets_setting), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), - ); - foreach ($google_charsets as $charset_key => $charset_value) { - $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_charsets'][$menus_charsets_setting . '_' . $charset_key] = array( + foreach ($google_styles as $style_key => $style_value) { + $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_styles'][$menus_styles_setting . '_' . $style_key] = array( + '#type' => 'checkbox', + '#title' => t($style_value), + '#default_value' => at_get_setting($menus_styles_setting . '_' . $style_key), + '#states' => array('visible' => array(":input[name=$menus_styles_setting]" => array('checked' => TRUE))), + ); + } + $menus_charsets_setting = $setting_gwf . '_add_charsets'; + $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_charsets'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Character Sets'), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_charsets'][$menus_charsets_setting] = array( '#type' => 'checkbox', - '#title' => t($charset_value), - '#default_value' => at_get_setting($menus_charsets_setting . '_' . $charset_key), - '#states' => array('visible' => array(":input[name=$menus_charsets_setting]" => array('checked' => TRUE))), + '#title' => t('Character Sets'), + '#default_value' => at_get_setting($menus_charsets_setting), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'gwf'))), + ); + foreach ($google_charsets as $charset_key => $charset_value) { + $form['at']['font']['menus'][$setting_container][$setting_container . '_gwf_charsets'][$menus_charsets_setting . '_' . $charset_key] = array( + '#type' => 'checkbox', + '#title' => t($charset_value), + '#default_value' => at_get_setting($menus_charsets_setting . '_' . $charset_key), + '#states' => array('visible' => array(":input[name=$menus_charsets_setting]" => array('checked' => TRUE))), + ); + } + + // Custom font stacks + $form['at']['font']['menus'][$setting_container][$setting_cfs] = array( + '#type' => 'textfield', + '#title' => t('Font'), + '#default_value' => filter_xss_admin(at_get_setting($setting_cfs)), + '#description' => $custom_stack_description, + '#states' => array( + 'visible' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), + 'required' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), + ), ); - } - - // Custom font stacks - $form['at']['font']['menus'][$setting_container][$setting_cfs] = array( - '#type' => 'textfield', - '#title' => t('Font'), - '#default_value' => filter_xss_admin(at_get_setting($setting_cfs)), - '#description' => $custom_stack_description, - '#states' => array( - 'visible' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), - 'required' => array('select[name=' . $setting_type . ']' => array('value' => 'cfs')), - ), - ); - // Font your face - if ($font_your_face_enabled == TRUE) { - $form['at']['font']['menus'][$setting_container][$setting_yfy] = array( + // Font your face + if ($font_your_face_enabled == TRUE) { + $form['at']['font']['menus'][$setting_container][$setting_yfy] = array( + '#type' => 'select', + '#title' => t('Font'), + '#default_value' => at_get_setting($setting_yfy), + '#options' => font_list('fyf', $element), + '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'fyf'))), + ); + } + + // Size + $form['at']['font']['menus'][$setting_container][$setting_size] = array( '#type' => 'select', - '#title' => t('Font'), - '#default_value' => at_get_setting($setting_yfy), - '#options' => font_list('fyf', $element), - '#states' => array('visible' => array('select[name=' . $setting_type . ']' => array('value' => 'fyf'))), + '#title' => t('Size'), + '#options' => $font_sizes_em, + '#default_value' => at_get_setting($setting_size), + '#attributes' => array('class' => array('font-size-wrapper')), ); } + } - // Size - $form['at']['font']['menus'][$setting_container][$setting_size] = array( - '#type' => 'select', - '#title' => t('Size'), - '#options' => $font_sizes_em, - '#default_value' => at_get_setting($setting_size), - '#attributes' => array('class' => array('font-size-wrapper')), + // Custom CSS selectors + $form['at']['font']['css'] = array( + '#type' => 'fieldset', + '#title' => t('Custom Selectors'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $form['at']['font']['css']['selectors_font_type'] = array( + '#type' => 'select', + '#title' => t('Type'), + '#options' => $font_type_options, + '#default_value' => at_get_setting('selectors_font_type') + ); + $form['at']['font']['css']['selectors_font'] = array( + '#type' => 'select', + '#title' => t('Font'), + '#default_value' => at_get_setting('selectors_font'), + '#options' => font_list('wsf', 'css'), + '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => ''))), + ); + + // Google fonts + $form['at']['font']['css']['selectors_font_gwf'] = array( + '#type' => 'textfield', + '#title' => t('Google Font Name'), + '#default_value' => filter_xss_admin(at_get_setting('selectors_font_gwf')), + '#description' => $google_font_description, + '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), + ); + $css_styles_setting = 'selectors_font_add_styles'; + $form['at']['font']['css']['selectors_font_gwf_styles'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Styles'), + '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), + ); + $form['at']['font']['css']['selectors_font_gwf_styles'][$css_styles_setting] = array( + '#type' => 'checkbox', + '#title' => t('Styles'), + '#default_value' => at_get_setting($css_styles_setting), + '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), + ); + foreach ($google_styles as $style_key => $style_value) { + $form['at']['font']['css']['selectors_font_gwf_styles'][$css_styles_setting . '_' . $style_key] = array( + '#type' => 'checkbox', + '#title' => t($style_value), + '#default_value' => at_get_setting($css_styles_setting . '_' . $style_key), + '#states' => array('visible' => array(":input[name=$css_styles_setting]" => array('checked' => TRUE))), ); } -} - -// Custom CSS selectors -$form['at']['font']['css'] = array( - '#type' => 'fieldset', - '#title' => t('Custom Selectors'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, -); -$form['at']['font']['css']['selectors_font_type'] = array( - '#type' => 'select', - '#title' => t('Type'), - '#options' => $font_type_options, - '#default_value' => at_get_setting('selectors_font_type') -); -$form['at']['font']['css']['selectors_font'] = array( - '#type' => 'select', - '#title' => t('Font'), - '#default_value' => at_get_setting('selectors_font'), - '#options' => font_list('wsf', 'css'), - '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => ''))), -); - -// Google fonts -$form['at']['font']['css']['selectors_font_gwf'] = array( - '#type' => 'textfield', - '#title' => t('Google Font Name'), - '#default_value' => filter_xss_admin(at_get_setting('selectors_font_gwf')), - '#description' => $google_font_description, - '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), -); -$css_styles_setting = 'selectors_font_add_styles'; -$form['at']['font']['css']['selectors_font_gwf_styles'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Styles'), - '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), -); -$form['at']['font']['css']['selectors_font_gwf_styles'][$css_styles_setting] = array( - '#type' => 'checkbox', - '#title' => t('Styles'), - '#default_value' => at_get_setting($css_styles_setting), - '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), -); -foreach ($google_styles as $style_key => $style_value) { - $form['at']['font']['css']['selectors_font_gwf_styles'][$css_styles_setting . '_' . $style_key] = array( - '#type' => 'checkbox', - '#title' => t($style_value), - '#default_value' => at_get_setting($css_styles_setting . '_' . $style_key), - '#states' => array('visible' => array(":input[name=$css_styles_setting]" => array('checked' => TRUE))), + $css_charsets_setting = 'selectors_font_add_charsets'; + $form['at']['font']['css']['selectors_font_gwf_charsets'] = array( + '#type' => 'fieldset', + '#title' => t('Add Google Font Character Sets'), + '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), ); -} -$css_charsets_setting = 'selectors_font_add_charsets'; -$form['at']['font']['css']['selectors_font_gwf_charsets'] = array( - '#type' => 'fieldset', - '#title' => t('Add Google Font Character Sets'), - '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), -); -$form['at']['font']['css']['selectors_font_gwf_charsets'][$css_charsets_setting] = array( - '#type' => 'checkbox', - '#title' => t('Character Sets'), - '#default_value' => at_get_setting($css_charsets_setting), - '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), -); -foreach ($google_charsets as $charset_key => $charset_value) { - $form['at']['font']['css']['selectors_font_gwf_charsets'][$css_charsets_setting . '_' . $charset_key] = array( + $form['at']['font']['css']['selectors_font_gwf_charsets'][$css_charsets_setting] = array( '#type' => 'checkbox', - '#title' => t($charset_value), - '#default_value' => at_get_setting($css_charsets_setting . '_' . $charset_key), - '#states' => array('visible' => array(":input[name=$css_charsets_setting]" => array('checked' => TRUE))), + '#title' => t('Character Sets'), + '#default_value' => at_get_setting($css_charsets_setting), + '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'gwf'))), ); -} - -// Custom font stacks -$form['at']['font']['css']['selectors_font_cfs'] = array( - '#type' => 'textfield', - '#title' => t('Font'), - '#default_value' => filter_xss_admin(at_get_setting('selectors_font_cfs')), - '#description' => $custom_stack_description, - '#states' => array( - 'visible' => array('select[name="selectors_font_type"]' => array('value' => 'cfs')), - 'required' => array('select[name="selectors_font_type"]' => array('value' => 'cfs')), - ) -); - -// Font your face -if ($font_your_face_enabled == TRUE) { - $form['at']['font']['css']['selectors_font_fyf'] = array( - '#type' => 'select', + foreach ($google_charsets as $charset_key => $charset_value) { + $form['at']['font']['css']['selectors_font_gwf_charsets'][$css_charsets_setting . '_' . $charset_key] = array( + '#type' => 'checkbox', + '#title' => t($charset_value), + '#default_value' => at_get_setting($css_charsets_setting . '_' . $charset_key), + '#states' => array('visible' => array(":input[name=$css_charsets_setting]" => array('checked' => TRUE))), + ); + } + + // Custom font stacks + $form['at']['font']['css']['selectors_font_cfs'] = array( + '#type' => 'textfield', '#title' => t('Font'), - '#default_value' => at_get_setting('selectors_font_fyf'), - '#options' => font_list('fyf', 'css'), - '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'fyf'))), + '#default_value' => filter_xss_admin(at_get_setting('selectors_font_cfs')), + '#description' => $custom_stack_description, + '#states' => array( + 'visible' => array('select[name="selectors_font_type"]' => array('value' => 'cfs')), + 'required' => array('select[name="selectors_font_type"]' => array('value' => 'cfs')), + ) + ); + + // Font your face + if ($font_your_face_enabled == TRUE) { + $form['at']['font']['css']['selectors_font_fyf'] = array( + '#type' => 'select', + '#title' => t('Font'), + '#default_value' => at_get_setting('selectors_font_fyf'), + '#options' => font_list('fyf', 'css'), + '#states' => array('visible' => array('select[name="selectors_font_type"]' => array('value' => 'fyf'))), + ); + } + + // CSS selectors + $form['at']['font']['css']['selectors_css'] = array( + '#type' => 'textarea', + '#title' => t('CSS Selectors'), + '#rows' => 3, + '#default_value' => filter_xss_admin(at_get_setting('selectors_css')), + '#description' => t("Enter a comma seperated list of valid CSS selectors, with no trailing comma, such as .node-content, .block-content. Note that due to security reason you cannot use the greater than symbol (>) as a child combinator selector."), + '#states' => array('disabled' => array('select[name="selectors_font_type"]' => array('value' => ''))), ); -} - -// CSS selectors -$form['at']['font']['css']['selectors_css'] = array( - '#type' => 'textarea', - '#title' => t('CSS Selectors'), - '#rows' => 3, - '#default_value' => filter_xss_admin(at_get_setting('selectors_css')), - '#description' => t("Enter a comma seperated list of valid CSS selectors, with no trailing comma, such as .node-content, .block-content. Note that due to security reason you cannot use the greater than symbol (>) as a child combinator selector."), - '#states' => array('disabled' => array('select[name="selectors_font_type"]' => array('value' => ''))), -); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.global.inc b/at_core/inc/forms/settings.global.inc index ed56c3f..0e98a11 100755 --- a/at_core/inc/forms/settings.global.inc +++ b/at_core/inc/forms/settings.global.inc @@ -7,142 +7,144 @@ * TODO: review documentation and provide links to help pages. */ -// Set variable for mode, we want to show a message based on this -$mode = variable_get('preprocess_css', '') == 1 ? TRUE : FALSE; -$performance_settings_path = url('admin/config/development/performance'); -$file_settings_path = url('admin/config/media/file-system'); +function at_core_global_form(&$form, $theme_name) { + // Set variable for mode, we want to show a message based on this + $mode = variable_get('preprocess_css', '') == 1 ? TRUE : FALSE; + $performance_settings_path = url('admin/config/development/performance'); + $file_settings_path = url('admin/config/media/file-system'); -// Global Settings -$form['at-settings']['global-settings'] = array( - '#type' => 'fieldset', - '#title' => t('CSS'), - '#description' => t('

CSS Global Settings

These settings are primarly set during development - do not change these unless you are actively developing or modifying your theme. If you need to globally unset core CSS or other CSS files use the Unset CSS Files extension.

'), -); + // Global Settings + $form['at-settings']['global-settings'] = array( + '#type' => 'fieldset', + '#title' => t('CSS'), + '#description' => t('

CSS Global Settings

These settings are primarly set during development - do not change these unless you are actively developing or modifying your theme. If you need to globally unset core CSS or other CSS files use the Unset CSS Files extension.

'), + ); -// Set message depending on the mode -if ($mode == TRUE) { - $mode_message = t('

CSS aggregation is ON. Changes to your themes responsive CSS files will not show until you re-save the theme settings (click "Save configuration" at the bottom of this form).

This is required to re-write the production version of the responsive styles and is a performance optimization in Adaptivetheme, which saves your site at least 4 HTTP requests.

', array('!settings_path' => $performance_settings_path)); -} -elseif ($mode == FALSE) { - $mode_message = t('

CSS aggregation is OFF. Changes to your themes responsive CSS files will show automatically.

Note: when CSS aggregation is ON you need to re-save the theme settings if you make any changes to your themes responsive stylesheets. This is required to re-write the production version of the responsive styles and is a performance optimization in Adaptivetheme, which saves your site at least 4 HTTP requests.

', array('!settings_path' => $performance_settings_path)); -} + // Set message depending on the mode + if ($mode == TRUE) { + $mode_message = t('

CSS aggregation is ON. Changes to your themes responsive CSS files will not show until you re-save the theme settings (click "Save configuration" at the bottom of this form).

This is required to re-write the production version of the responsive styles and is a performance optimization in Adaptivetheme, which saves your site at least 4 HTTP requests.

', array('!settings_path' => $performance_settings_path)); + } + elseif ($mode == FALSE) { + $mode_message = t('

CSS aggregation is OFF. Changes to your themes responsive CSS files will show automatically.

Note: when CSS aggregation is ON you need to re-save the theme settings if you make any changes to your themes responsive stylesheets. This is required to re-write the production version of the responsive styles and is a performance optimization in Adaptivetheme, which saves your site at least 4 HTTP requests.

', array('!settings_path' => $performance_settings_path)); + } -// Mode -$form['at-settings']['global-settings']['mode'] = array( - '#type' => 'fieldset', - '#title' => t('CSS Mode'), - '#description' => t('

Mode

') . $mode_message, - '#states' => array( - 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); + // Mode + $form['at-settings']['global-settings']['mode'] = array( + '#type' => 'fieldset', + '#title' => t('CSS Mode'), + '#description' => t('

Mode

') . $mode_message, + '#states' => array( + 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); -// Custom media queries -$form['at-settings']['global-settings']['custom-mediaqueries'] = array( - '#type' => 'fieldset', - '#title' => t('Custom Media Queries'), - '#description' => t('

Custom Media Queries

'), - '#states' => array( - 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); -$form['at-settings']['global-settings']['custom-mediaqueries']['enable_custom_media_queries'] = array( - '#type' => 'checkbox', - '#title' => t('Enable the responsive.custom.css file'), - '#description' => t('Use this file if you need to use custom media queries, such as overlapped media queries. This file is located here: themeName/css/responsive.custom.css. Adaptivetheme will load this file automagically when this setting enabled.', array('!zomigi' => 'http://zomigi.com/blog/essential-considerations-for-crafting-quality-media-queries/#mq-overlap-stack')), - '#default_value' => at_get_setting('enable_custom_media_queries'), -); + // Custom media queries + $form['at-settings']['global-settings']['custom-mediaqueries'] = array( + '#type' => 'fieldset', + '#title' => t('Custom Media Queries'), + '#description' => t('

Custom Media Queries

'), + '#states' => array( + 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); + $form['at-settings']['global-settings']['custom-mediaqueries']['enable_custom_media_queries'] = array( + '#type' => 'checkbox', + '#title' => t('Enable the responsive.custom.css file'), + '#description' => t('Use this file if you need to use custom media queries, such as overlapped media queries. This file is located here: themeName/css/responsive.custom.css. Adaptivetheme will load this file automagically when this setting enabled.', array('!zomigi' => 'http://zomigi.com/blog/essential-considerations-for-crafting-quality-media-queries/#mq-overlap-stack')), + '#default_value' => at_get_setting('enable_custom_media_queries'), + ); -// Set default layout -$form['at-settings']['global-settings']['default-layout'] = array( - '#type' => 'fieldset', - '#title' => t('Mobile first or Mobile last'), - '#description' => t('

Mobile first or Desktop first

'), - '#states' => array( - 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); -$form['at-settings']['global-settings']['default-layout']['global_default_layout_toggle'] = array( - '#type' => 'checkbox', - '#title' => t('Change default layout method (checking this will expose new settings)'), - '#description' => t('Use with caution! If you are using a pre-styled sub-theme such as Pixture Reloaded, Sky, Corolla, AT Commerce or any of the commerical sub-themes you should NOT change this!'), - '#default_value' => at_get_setting('global_default_layout_toggle'), -); -$form['at-settings']['global-settings']['default-layout']['toggle'] = array( - '#type' => 'fieldset', - '#title' => t('Change default layout method'), - '#states' => array( - 'visible' => array('input[name="global_default_layout_toggle"]' => array('checked' => TRUE)), - ), -); -$form['at-settings']['global-settings']['default-layout']['toggle']['global_default_layout'] = array( - '#type' => 'radios', - '#description' => t('

Adaptivetheme supports both mobile first and desktop first design approaches. Please review the online documentation.

This setting fundementally alters what CSS is loaded and how it is loaded. At the most basic level if you select Mobile first the Smartphone portrait layout will load as the default, if you select Desktop first the Standard layout will load as the default. Many other changes take place regarding loading of CSS for Internet Explorer, Responsive Gpanels and Panels as well.

', array('!docs_link' => 'http://adaptivethemes.com/documentation/mobile-first-design-with-adaptivetheme')), - '#default_value' => at_get_setting('global_default_layout'), - '#options' => array( - 'smartphone-portrait' => t('Mobile first'), - 'standard-layout' => t('Desktop first'), - ), -); + // Set default layout + $form['at-settings']['global-settings']['default-layout'] = array( + '#type' => 'fieldset', + '#title' => t('Mobile first or Mobile last'), + '#description' => t('

Mobile first or Desktop first

'), + '#states' => array( + 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); + $form['at-settings']['global-settings']['default-layout']['global_default_layout_toggle'] = array( + '#type' => 'checkbox', + '#title' => t('Change default layout method (checking this will expose new settings)'), + '#description' => t('Use with caution! If you are using a pre-styled sub-theme such as Pixture Reloaded, Sky, Corolla, AT Commerce or any of the commerical sub-themes you should NOT change this!'), + '#default_value' => at_get_setting('global_default_layout_toggle'), + ); + $form['at-settings']['global-settings']['default-layout']['toggle'] = array( + '#type' => 'fieldset', + '#title' => t('Change default layout method'), + '#states' => array( + 'visible' => array('input[name="global_default_layout_toggle"]' => array('checked' => TRUE)), + ), + ); + $form['at-settings']['global-settings']['default-layout']['toggle']['global_default_layout'] = array( + '#type' => 'radios', + '#description' => t('

Adaptivetheme supports both mobile first and desktop first design approaches. Please review the online documentation.

This setting fundementally alters what CSS is loaded and how it is loaded. At the most basic level if you select Mobile first the Smartphone portrait layout will load as the default, if you select Desktop first the Standard layout will load as the default. Many other changes take place regarding loading of CSS for Internet Explorer, Responsive Gpanels and Panels as well.

', array('!docs_link' => 'http://adaptivethemes.com/documentation/mobile-first-design-with-adaptivetheme')), + '#default_value' => at_get_setting('global_default_layout'), + '#options' => array( + 'smartphone-portrait' => t('Mobile first'), + 'standard-layout' => t('Desktop first'), + ), + ); -// Path to Generated files -$public_files = variable_get('file_public_path', conf_path() . '/files') . '/adaptivetheme/' . $theme_name . '_files/'; -$theme_directory = drupal_get_path('theme', $theme_name) . '/generated_files/'; -$form['at-settings']['global-settings']['files-path'] = array( - '#type' => 'fieldset', - '#title' => t('Path to Generated Files'), - '#description' => t('

Path to Generated Files

'), -); -$form['at-settings']['global-settings']['files-path']['global_files_path'] = array( - '#type' => 'select', - '#title' => t('By default the generated files are saved in public files. You can change this to your theme directory or a custom directory. These files include all the generated CSS files, the info file backup and color scheme backups if you are using the Color module. For more information see the docs on the file generation system.', array('!file_settings_path' => $file_settings_path, '!file_generation_system' => 'http://adaptivethemes.com/documentation/file-generation-system')), - '#default_value' => at_get_setting('global_files_path'), - '#options' => array( - 'public_files' => t('Public files'), - 'theme_directory' => t('Theme directory'), - 'custom_path' => t('Custom path'), - ), -); -// Message for public files -$form['at-settings']['global-settings']['files-path']['public_files_path'] = array( - '#type' => 'fieldset', - '#states' => array( - 'visible' => array('select[name="global_files_path"]' => array('value' => 'public_files')), - ), -); -$form['at-settings']['global-settings']['files-path']['public_files_path']['message'] = array( - '#markup' => t('
Files will be saved to: @public_files
', array('@public_files' => $public_files)), -); -// message for theme dir -$form['at-settings']['global-settings']['files-path']['theme_directory_files_path'] = array( - '#type' => 'fieldset', - '#states' => array( - 'visible' => array('select[name="global_files_path"]' => array('value' => 'theme_directory')), - ), -); -$form['at-settings']['global-settings']['files-path']['theme_directory_files_path']['message'] = array( - '#markup' => t('
Files will be saved to: @theme_directory
', array('@theme_directory' => $theme_directory)), -); -// Text field for custom path -$form['at-settings']['global-settings']['files-path']['custom_files_path'] = array( - '#type' => 'textfield', - '#title' => t('Enter the custom path:'), - '#default_value' => at_get_setting('custom_files_path'), - '#description' => t('This directory must exist and be writable by Drupal. This directory must be relative to the Drupal installation directory and be accessible over the web. Do not try to use something like ../css, it will fail. Use someting like sites/default/css.'), - '#states' => array( - 'visible' => array('select[name="global_files_path"]' => array('value' => 'custom_path')), - ), -); + // Path to Generated files + $public_files = variable_get('file_public_path', conf_path() . '/files') . '/adaptivetheme/' . $theme_name . '_files/'; + $theme_directory = drupal_get_path('theme', $theme_name) . '/generated_files/'; + $form['at-settings']['global-settings']['files-path'] = array( + '#type' => 'fieldset', + '#title' => t('Path to Generated Files'), + '#description' => t('

Path to Generated Files

'), + ); + $form['at-settings']['global-settings']['files-path']['global_files_path'] = array( + '#type' => 'select', + '#title' => t('By default the generated files are saved in public files. You can change this to your theme directory or a custom directory. These files include all the generated CSS files, the info file backup and color scheme backups if you are using the Color module. For more information see the docs on the file generation system.', array('!file_settings_path' => $file_settings_path, '!file_generation_system' => 'http://adaptivethemes.com/documentation/file-generation-system')), + '#default_value' => at_get_setting('global_files_path'), + '#options' => array( + 'public_files' => t('Public files'), + 'theme_directory' => t('Theme directory'), + 'custom_path' => t('Custom path'), + ), + ); + // Message for public files + $form['at-settings']['global-settings']['files-path']['public_files_path'] = array( + '#type' => 'fieldset', + '#states' => array( + 'visible' => array('select[name="global_files_path"]' => array('value' => 'public_files')), + ), + ); + $form['at-settings']['global-settings']['files-path']['public_files_path']['message'] = array( + '#markup' => t('
Files will be saved to: @public_files
', array('@public_files' => $public_files)), + ); + // message for theme dir + $form['at-settings']['global-settings']['files-path']['theme_directory_files_path'] = array( + '#type' => 'fieldset', + '#states' => array( + 'visible' => array('select[name="global_files_path"]' => array('value' => 'theme_directory')), + ), + ); + $form['at-settings']['global-settings']['files-path']['theme_directory_files_path']['message'] = array( + '#markup' => t('
Files will be saved to: @theme_directory
', array('@theme_directory' => $theme_directory)), + ); + // Text field for custom path + $form['at-settings']['global-settings']['files-path']['custom_files_path'] = array( + '#type' => 'textfield', + '#title' => t('Enter the custom path:'), + '#default_value' => at_get_setting('custom_files_path'), + '#description' => t('This directory must exist and be writable by Drupal. This directory must be relative to the Drupal installation directory and be accessible over the web. Do not try to use something like ../css, it will fail. Use someting like sites/default/css.'), + '#states' => array( + 'visible' => array('select[name="global_files_path"]' => array('value' => 'custom_path')), + ), + ); -// Disable responsive layout -$form['at-settings']['global-settings']['disable-rs'] = array( - '#type' => 'fieldset', - '#title' => t('Disable Responsive CSS'), - '#description' => t('

Disable Responsive CSS

'), -); -$form['at-settings']['global-settings']['disable-rs']['disable_responsive_styles'] = array( - '#type' => 'checkbox', - '#title' => t('Disable responsive layout and styles'), - '#description' => t('By checking this setting the site will use only the Standard layout and the global styles. You can turn this back on at any time.'), - '#default_value' => at_get_setting('disable_responsive_styles'), -); + // Disable responsive layout + $form['at-settings']['global-settings']['disable-rs'] = array( + '#type' => 'fieldset', + '#title' => t('Disable Responsive CSS'), + '#description' => t('

Disable Responsive CSS

'), + ); + $form['at-settings']['global-settings']['disable-rs']['disable_responsive_styles'] = array( + '#type' => 'checkbox', + '#title' => t('Disable responsive layout and styles'), + '#description' => t('By checking this setting the site will use only the Standard layout and the global styles. You can turn this back on at any time.'), + '#default_value' => at_get_setting('disable_responsive_styles'), + ); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.headings.inc b/at_core/inc/forms/settings.headings.inc index b3e46d1..8e7255d 100755 --- a/at_core/inc/forms/settings.headings.inc +++ b/at_core/inc/forms/settings.headings.inc @@ -5,84 +5,88 @@ * Generate form elments for the Headings Styles settings. */ -// Title styles -$form['at']['titles'] = array( - '#type' => 'fieldset', - '#title' => t('Title Styles'), - '#description' => t('

Title Styles

Add extra styles to headings. Text shadows only work for CSS3 capable browsers such as Firefox, Safari, IE9 etc.

'), - '#weight' => -100, -); - -// Array of valid title types -$headings_valid_types = array( - 'site_name', - 'site_slogan', - 'page_title', - 'node_title', - 'block_title', - 'comment_title', -); - -// Get the fonts list -$form_elements = font_elements(); - -foreach ($form_elements as $key => $value) { - - $heading = $key; - - if (in_array($heading, $headings_valid_types)) { - - $element = $value['element']; // e.g. "ptf" (page_title_font), this is used to set array keys and eventually body classes - $setting = $heading; // use the key for these settings, it doesnt have "font" in it - $container = $value['setting']; // the theme setting used to retrieve the font values, e.g. "site_name_font" - - $setting_container = str_replace('_', '-', $container) . '-style'; // a nicer string for fielset classes - $title = str_replace('_', ' ', drupal_ucfirst($heading)); // use the key for titles, it doesnt have "font" in it - - // Set easy reusable variables - $setting_case = $setting . '_case'; - $setting_weight = $setting . '_weight'; - $setting_alignment = $setting . '_alignment'; - $setting_shadow = $setting . '_shadow'; - - // Fieldset wrapper for each title - $form['at']['titles']['' . $setting_container . ''] = array( - '#type' => 'fieldset', - '#title' => t($title), - '#description' => t("$title"), - '#attributes' => array('class' => array('headings-styles-wrapper')), - ); - - // Case - $form['at']['titles']['' . $setting_container . '']['' . $setting_case . ''] = array( - '#type' => 'select', - '#title' => t('Case'), - '#default_value' => at_get_setting($setting_case), - '#options' => font_style_options('case', $element), - ); - - // Weight - $form['at']['titles']['' . $setting_container . '']['' . $setting_weight . ''] = array( - '#type' => 'select', - '#title' => t('Weight'), - '#default_value' => at_get_setting($setting_weight), - '#options' => font_style_options('weight', $element), - ); - - // Alignment - $form['at']['titles']['' . $setting_container . '']['' . $setting_alignment . ''] = array( - '#type' => 'select', - '#title' => t('Alignment'), - '#default_value' => at_get_setting($setting_alignment), - '#options' => font_style_options('alignment', $element), - ); - - // Text shadow - $form['at']['titles']['' . $setting_container . '']['' . $setting_shadow . ''] = array( - '#type' => 'select', - '#title' => t('Shadow'), - '#default_value' => at_get_setting($setting_shadow), - '#options' => font_style_options('shadow', $element), - ); + +function at_core_headings_form(&$form) { + + // Title styles + $form['at']['titles'] = array( + '#type' => 'fieldset', + '#title' => t('Title Styles'), + '#description' => t('

Title Styles

Add extra styles to headings. Text shadows only work for CSS3 capable browsers such as Firefox, Safari, IE9 etc.

'), + '#weight' => -100, + ); + + // Array of valid title types + $headings_valid_types = array( + 'site_name', + 'site_slogan', + 'page_title', + 'node_title', + 'block_title', + 'comment_title', + ); + + // Get the fonts list + $form_elements = font_elements(); + + foreach ($form_elements as $key => $value) { + + $heading = $key; + + if (in_array($heading, $headings_valid_types)) { + + $element = $value['element']; // e.g. "ptf" (page_title_font), this is used to set array keys and eventually body classes + $setting = $heading; // use the key for these settings, it doesnt have "font" in it + $container = $value['setting']; // the theme setting used to retrieve the font values, e.g. "site_name_font" + + $setting_container = str_replace('_', '-', $container) . '-style'; // a nicer string for fielset classes + $title = str_replace('_', ' ', drupal_ucfirst($heading)); // use the key for titles, it doesnt have "font" in it + + // Set easy reusable variables + $setting_case = $setting . '_case'; + $setting_weight = $setting . '_weight'; + $setting_alignment = $setting . '_alignment'; + $setting_shadow = $setting . '_shadow'; + + // Fieldset wrapper for each title + $form['at']['titles']['' . $setting_container . ''] = array( + '#type' => 'fieldset', + '#title' => t($title), + '#description' => t("$title"), + '#attributes' => array('class' => array('headings-styles-wrapper')), + ); + + // Case + $form['at']['titles']['' . $setting_container . '']['' . $setting_case . ''] = array( + '#type' => 'select', + '#title' => t('Case'), + '#default_value' => at_get_setting($setting_case), + '#options' => font_style_options('case', $element), + ); + + // Weight + $form['at']['titles']['' . $setting_container . '']['' . $setting_weight . ''] = array( + '#type' => 'select', + '#title' => t('Weight'), + '#default_value' => at_get_setting($setting_weight), + '#options' => font_style_options('weight', $element), + ); + + // Alignment + $form['at']['titles']['' . $setting_container . '']['' . $setting_alignment . ''] = array( + '#type' => 'select', + '#title' => t('Alignment'), + '#default_value' => at_get_setting($setting_alignment), + '#options' => font_style_options('alignment', $element), + ); + + // Text shadow + $form['at']['titles']['' . $setting_container . '']['' . $setting_shadow . ''] = array( + '#type' => 'select', + '#title' => t('Shadow'), + '#default_value' => at_get_setting($setting_shadow), + '#options' => font_style_options('shadow', $element), + ); + } } -} +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.images.inc b/at_core/inc/forms/settings.images.inc index 75cab50..d530a39 100755 --- a/at_core/inc/forms/settings.images.inc +++ b/at_core/inc/forms/settings.images.inc @@ -5,73 +5,75 @@ * Generate form elments for the Image styles settings. */ -$form['at']['images'] = array( - '#type' => 'fieldset', - '#title' => t('Image Settings'), - '#description' => '

Image Settings

Set alignment for image-field images on full and teaser view, and enable captions.', - '#weight' => 0, -); +function at_images_form(&$form) { + $form['at']['images'] = array( + '#type' => 'fieldset', + '#title' => t('Image Settings'), + '#description' => '

Image Settings

Set alignment for image-field images on full and teaser view, and enable captions.', + '#weight' => 0, + ); -// Alignment -$form['at']['images']['alignment'] = array( - '#type' => 'fieldset', - '#title' => t('Image Alignment'), -); + // Alignment + $form['at']['images']['alignment'] = array( + '#type' => 'fieldset', + '#title' => t('Image Alignment'), + ); -// Full -$form['at']['images']['alignment']['image_alignment'] = array( - '#type' => 'radios', - '#title' => t('Alignment - full view'), - '#default_value' => at_get_setting('image_alignment'), - '#options' => array( - 'ia-n' => t('None'), - 'ia-l' => t('Left'), - 'ia-c' => t('Center'), - 'ia-r' => t('Right'), - ), -); + // Full + $form['at']['images']['alignment']['image_alignment'] = array( + '#type' => 'radios', + '#title' => t('Alignment - full view'), + '#default_value' => at_get_setting('image_alignment'), + '#options' => array( + 'ia-n' => t('None'), + 'ia-l' => t('Left'), + 'ia-c' => t('Center'), + 'ia-r' => t('Right'), + ), + ); -// Teaser -$form['at']['images']['alignment']['image_alignment_teaser'] = array( - '#type' => 'radios', - '#title' => t('Alignment - teaser view'), - '#default_value' => at_get_setting('image_alignment_teaser'), - '#description' => t('This will only affect images added using an image-field. If you use another method such as embedding images directly into text areas this will not affect those images.'), - '#options' => array( - 'iat-n' => t('None'), - 'iat-l' => t('Left'), - 'iat-c' => t('Center'), - 'iat-r' => t('Right'), - ), -); + // Teaser + $form['at']['images']['alignment']['image_alignment_teaser'] = array( + '#type' => 'radios', + '#title' => t('Alignment - teaser view'), + '#default_value' => at_get_setting('image_alignment_teaser'), + '#description' => t('This will only affect images added using an image-field. If you use another method such as embedding images directly into text areas this will not affect those images.'), + '#options' => array( + 'iat-n' => t('None'), + 'iat-l' => t('Left'), + 'iat-c' => t('Center'), + 'iat-r' => t('Right'), + ), + ); -// Captions -$form['at']['images']['captions'] = array( - '#type' => 'fieldset', - '#title' => t('Image Captions'), - '#description' => t('Display the image title as a caption'), -); -$form['at']['images']['captions']['image_caption_teaser'] = array( - '#type' => 'checkbox', - '#title' => t('Show captions on teaser view'), - '#default_value' => at_get_setting('image_caption_teaser'), -); -$form['at']['images']['captions']['image_caption_full'] = array( - '#type' => 'checkbox', - '#title' => t('Show captions on full view'), - '#description' => t('Captions use the title attribute text. You must enable tiles in the field management options for your image fields.'), - '#default_value' => at_get_setting('image_caption_full'), -); + // Captions + $form['at']['images']['captions'] = array( + '#type' => 'fieldset', + '#title' => t('Image Captions'), + '#description' => t('Display the image title as a caption'), + ); + $form['at']['images']['captions']['image_caption_teaser'] = array( + '#type' => 'checkbox', + '#title' => t('Show captions on teaser view'), + '#default_value' => at_get_setting('image_caption_teaser'), + ); + $form['at']['images']['captions']['image_caption_full'] = array( + '#type' => 'checkbox', + '#title' => t('Show captions on full view'), + '#description' => t('Captions use the title attribute text. You must enable tiles in the field management options for your image fields.'), + '#default_value' => at_get_setting('image_caption_full'), + ); -// Teaser -$form['at']['images']['teaser'] = array( - '#type' => 'fieldset', - '#title' => t('Teaser Image Fields'), - '#description' => t('Show only one image field image on teasers'), -); -$form['at']['images']['teaser']['image_teaser'] = array( - '#type' => 'checkbox', - '#title' => t('Show the first image only on teasers'), - '#description' => t('Useful for when you have a multivalue image field and you only want the first image to show on teasers.'), - '#default_value' => at_get_setting('image_teaser'), -); + // Teaser + $form['at']['images']['teaser'] = array( + '#type' => 'fieldset', + '#title' => t('Teaser Image Fields'), + '#description' => t('Show only one image field image on teasers'), + ); + $form['at']['images']['teaser']['image_teaser'] = array( + '#type' => 'checkbox', + '#title' => t('Show the first image only on teasers'), + '#description' => t('Useful for when you have a multivalue image field and you only want the first image to show on teasers.'), + '#default_value' => at_get_setting('image_teaser'), + ); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.metatags.inc b/at_core/inc/forms/settings.metatags.inc index 26ea545..386ce2c 100755 --- a/at_core/inc/forms/settings.metatags.inc +++ b/at_core/inc/forms/settings.metatags.inc @@ -5,66 +5,68 @@ * Generate form elments for the Metatags for Mobile settings. */ -$form['at-settings']['meta'] = array( - '#type' => 'fieldset', - '#title' => t('Metatags'), - '#description' => t('

Mobile Metatags

Configure metatags for mobile devices. To omit a metatag leave it empty.'), -); -$form['at-settings']['meta']['mobile'] = array( - '#type' => 'fieldset', - '#title' => t('Mobile Metatags'), -); +function at_core_metatags_form(&$form) { + $form['at-settings']['meta'] = array( + '#type' => 'fieldset', + '#title' => t('Metatags'), + '#description' => t('

Mobile Metatags

Configure metatags for mobile devices. To omit a metatag leave it empty.'), + ); + $form['at-settings']['meta']['mobile'] = array( + '#type' => 'fieldset', + '#title' => t('Mobile Metatags'), + ); -// Viewport -$form['at-settings']['meta']['mobile']['adaptivetheme_meta_viewport'] = array( - '#type' => 'textfield', - '#title' => t('viewport'), - '#default_value' => check_plain(at_get_setting('adaptivetheme_meta_viewport')), - '#states' => array( - 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); + // Viewport + $form['at-settings']['meta']['mobile']['adaptivetheme_meta_viewport'] = array( + '#type' => 'textfield', + '#title' => t('viewport'), + '#default_value' => check_plain(at_get_setting('adaptivetheme_meta_viewport')), + '#states' => array( + 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); -// MobileOptimized -$form['at-settings']['meta']['mobile']['adaptivetheme_meta_mobileoptimized'] = array( - '#type' => 'textfield', - '#title' => t('MobileOptimized'), - '#default_value' => check_plain(at_get_setting('adaptivetheme_meta_mobileoptimized')), - '#states' => array( - 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); + // MobileOptimized + $form['at-settings']['meta']['mobile']['adaptivetheme_meta_mobileoptimized'] = array( + '#type' => 'textfield', + '#title' => t('MobileOptimized'), + '#default_value' => check_plain(at_get_setting('adaptivetheme_meta_mobileoptimized')), + '#states' => array( + 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); -// HandheldFriendly -$form['at-settings']['meta']['mobile']['adaptivetheme_meta_handheldfriendly'] = array( - '#type' => 'textfield', - '#title' => t('HandheldFriendly'), - '#default_value' => check_plain(at_get_setting('adaptivetheme_meta_handheldfriendly')), - '#states' => array( - 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); + // HandheldFriendly + $form['at-settings']['meta']['mobile']['adaptivetheme_meta_handheldfriendly'] = array( + '#type' => 'textfield', + '#title' => t('HandheldFriendly'), + '#default_value' => check_plain(at_get_setting('adaptivetheme_meta_handheldfriendly')), + '#states' => array( + 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); -// apple-mobile-web-app-capable -$form['at-settings']['meta']['mobile']['adaptivetheme_meta_apple_mobile_web_app_capable'] = array( - '#type' => 'textfield', - '#title' => t('apple-mobile-web-app-capable'), - '#default_value' => check_plain(at_get_setting('adaptivetheme_meta_apple_mobile_web_app_capable')), - '#states' => array( - 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); + // apple-mobile-web-app-capable + $form['at-settings']['meta']['mobile']['adaptivetheme_meta_apple_mobile_web_app_capable'] = array( + '#type' => 'textfield', + '#title' => t('apple-mobile-web-app-capable'), + '#default_value' => check_plain(at_get_setting('adaptivetheme_meta_apple_mobile_web_app_capable')), + '#states' => array( + 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); -// Chrome Edge -$form['at-settings']['meta']['mobile']['chrome_edge'] = array( - '#type' => 'checkbox', - '#title' => t('Enable Chrome Edge support for IE'), - '#default_value' => at_get_setting('chrome_edge'), -); + // Chrome Edge + $form['at-settings']['meta']['mobile']['chrome_edge'] = array( + '#type' => 'checkbox', + '#title' => t('Enable Chrome Edge support for IE'), + '#default_value' => at_get_setting('chrome_edge'), + ); -// Clear type -$form['at-settings']['meta']['mobile']['clear_type'] = array( - '#type' => 'checkbox', - '#title' => t('Enable Cleartype in IE Mobile devices'), - '#default_value' => at_get_setting('clear_type'), -); + // Clear type + $form['at-settings']['meta']['mobile']['clear_type'] = array( + '#type' => 'checkbox', + '#title' => t('Enable Cleartype in IE Mobile devices'), + '#default_value' => at_get_setting('clear_type'), + ); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.modifyoutput.inc b/at_core/inc/forms/settings.modifyoutput.inc index 7ddd8c9..50eba19 100755 --- a/at_core/inc/forms/settings.modifyoutput.inc +++ b/at_core/inc/forms/settings.modifyoutput.inc @@ -5,259 +5,261 @@ * Generate form elments for the Modify Output settings. */ -$form['at']['modify-output'] = array( - '#type' => 'fieldset', - '#title' => t('Markup Overrides'), - '#weight' => 40, -); - -// Design -$form['at']['modify-output']['design'] = array( - '#type' => 'fieldset', - '#title' => t('Design'), - '#description' => t('

Design

'), -); -// Adjust gutter width -$form['at']['modify-output']['design']['global_gutter_width'] = array( - '#type' => 'textfield', - '#title' => t('Set gutter width:'), - '#size' => 2, - '#maxlength' => 2, - '#field_suffix' => 'px', - '#description' => t('Gutters are set using margin-left and margin-right. This will override the default 10px margins set in global.page.css.'), - '#default_value' => check_plain(at_get_setting('global_gutter_width')), -); -// Use the page full width wrappers template -$form['at']['modify-output']['design']['page_full_width_wrappers'] = array( - '#type' => 'checkbox', - '#title' => t('Use page--full-width-wrappers.tpl.php by default'), - '#description' => t('This setting will load a page template will full width DIV wrappers - perfect for designs with 100% width sections, header or footer. Note that if you choose to use other page template suggestions you should use copies of page--full-width-wrappers.tpl.php, you will find this in adaptivetheme/at-core/templates.'), - '#default_value' => at_get_setting('page_full_width_wrappers'), -); -// Add page-[content-type] suggestions, all suggestions carry a performance -// overhead, so allow the user to choose this rather than doing to by default -$form['at']['modify-output']['design']['page_content_type_suggestions'] = array( - '#type' => 'checkbox', - '#title' => t('Enable page--[content-type].tpl.php suggestions'), - '#description' => t('If the node type is "blog" the template suggestion will be "page--blog.tpl.php". The content type suggestions are weak and can be overridden by single page--node.tpl.php template or standard page--node-[nid] templates.'), - '#default_value' => at_get_setting('page_content_type_suggestions'), -); -// Add spans to theme_links -$form['at']['modify-output']['design']['menu_item_span_elements'] = array( - '#type' => 'checkbox', - '#title' => t('Wrap menu item text in SPAN tags - useful for certain theme or design related techniques'), - '#description' => t('Note: this does not work for Superfish menus, which includes its own feature for doing this.', array('!link' => 'http://drupal.org/project/superfish')), - '#default_value' => at_get_setting('menu_item_span_elements'), -); +function at_core_modify_output_form(&$form) { + $form['at']['modify-output'] = array( + '#type' => 'fieldset', + '#title' => t('Markup Overrides'), + '#weight' => 40, + ); -// Breadcrumb settings -$form['at']['modify-output']['breadcrumb'] = array( - '#type' => 'fieldset', - '#title' => t('Breadcrumbs'), - '#description' => t('

Breadcrumb Settings

'), -); -$form['at']['modify-output']['breadcrumb']['wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Breadcrumbs'), -); -// Display? -$form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_display'] = array( - '#type' => 'checkbox', - '#title' => t('Show breadcrumbs'), - '#default_value' => at_get_setting('breadcrumb_display'), -); -// Home link? -$form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_home'] = array( - '#type' => 'checkbox', - '#title' => t('Show the homepage link'), - '#default_value' => at_get_setting('breadcrumb_home'), - '#states' => array( - 'visible' => array('input[name="breadcrumb_display"]' => array('checked' => TRUE)), - ), -); -// Label? -$form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_label'] = array( - '#type' => 'checkbox', - '#title' => t('Show the "You are here" label'), - '#default_value' => at_get_setting('breadcrumb_label'), - '#states' => array( - 'visible' => array('input[name="breadcrumb_display"]' => array('checked' => TRUE)), - ), -); -// Page title? -$form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_title'] = array( - '#type' => 'checkbox', - '#title' => t('Append the page title to the breadcrumb trail'), - '#default_value' => at_get_setting('breadcrumb_title'), - '#states' => array( - 'visible' => array('input[name="breadcrumb_display"]' => array('checked' => TRUE)), - ), -); -// Seperator -$form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_separator'] = array( - '#type' => 'textfield', - '#title' => t('Separator'), - '#description' => t('Text, basic markup and html entities only. Dont forget to include spaces.'), - '#default_value' => filter_xss_admin(at_get_setting('breadcrumb_separator')), - '#size' => 25, - '#maxlength' => 60, - '#states' => array( - 'visible' => array('input[name="breadcrumb_display"]' => array('checked' => TRUE)), - ), -); + // Design + $form['at']['modify-output']['design'] = array( + '#type' => 'fieldset', + '#title' => t('Design'), + '#description' => t('

Design

'), + ); + // Adjust gutter width + $form['at']['modify-output']['design']['global_gutter_width'] = array( + '#type' => 'textfield', + '#title' => t('Set gutter width:'), + '#size' => 2, + '#maxlength' => 2, + '#field_suffix' => 'px', + '#description' => t('Gutters are set using margin-left and margin-right. This will override the default 10px margins set in global.page.css.'), + '#default_value' => check_plain(at_get_setting('global_gutter_width')), + ); + // Use the page full width wrappers template + $form['at']['modify-output']['design']['page_full_width_wrappers'] = array( + '#type' => 'checkbox', + '#title' => t('Use page--full-width-wrappers.tpl.php by default'), + '#description' => t('This setting will load a page template will full width DIV wrappers - perfect for designs with 100% width sections, header or footer. Note that if you choose to use other page template suggestions you should use copies of page--full-width-wrappers.tpl.php, you will find this in adaptivetheme/at-core/templates.'), + '#default_value' => at_get_setting('page_full_width_wrappers'), + ); + // Add page-[content-type] suggestions, all suggestions carry a performance + // overhead, so allow the user to choose this rather than doing to by default + $form['at']['modify-output']['design']['page_content_type_suggestions'] = array( + '#type' => 'checkbox', + '#title' => t('Enable page--[content-type].tpl.php suggestions'), + '#description' => t('If the node type is "blog" the template suggestion will be "page--blog.tpl.php". The content type suggestions are weak and can be overridden by single page--node.tpl.php template or standard page--node-[nid] templates.'), + '#default_value' => at_get_setting('page_content_type_suggestions'), + ); + // Add spans to theme_links + $form['at']['modify-output']['design']['menu_item_span_elements'] = array( + '#type' => 'checkbox', + '#title' => t('Wrap menu item text in SPAN tags - useful for certain theme or design related techniques'), + '#description' => t('Note: this does not work for Superfish menus, which includes its own feature for doing this.', array('!link' => 'http://drupal.org/project/superfish')), + '#default_value' => at_get_setting('menu_item_span_elements'), + ); -// Login block options. There is also a slide-down block option, but I have never added it. -if (at_get_setting('horizontal_login_block_enable') === 'on') { - $form['at']['modify-output']['login-block'] = array( + // Breadcrumb settings + $form['at']['modify-output']['breadcrumb'] = array( + '#type' => 'fieldset', + '#title' => t('Breadcrumbs'), + '#description' => t('

Breadcrumb Settings

'), + ); + $form['at']['modify-output']['breadcrumb']['wrapper'] = array( '#type' => 'fieldset', - '#title' => t('Login Block'), - '#description' => t('

Login Block Options

'), + '#title' => t('Breadcrumbs'), ); - // Login block links - $form['at']['modify-output']['login-block']['login_block_remove_links'] = array( + // Display? + $form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_display'] = array( '#type' => 'checkbox', - '#title' => t('Remove links'), - '#default_value' => at_get_setting('login_block_remove_links'), - '#description' => t('Remove the Create new account and Request new password links from the login block.'), + '#title' => t('Show breadcrumbs'), + '#default_value' => at_get_setting('breadcrumb_display'), ); - // Login block OpenID - $form['at']['modify-output']['login-block']['login_block_remove_openid'] = array( + // Home link? + $form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_home'] = array( '#type' => 'checkbox', - '#title' => t('Remove OpenID elements'), - '#default_value' => at_get_setting('login_block_remove_openid'), - '#description' => t('Remove the OpenID links and form elements from the login block.'), + '#title' => t('Show the homepage link'), + '#default_value' => at_get_setting('breadcrumb_home'), + '#states' => array( + 'visible' => array('input[name="breadcrumb_display"]' => array('checked' => TRUE)), + ), ); - // Horizontal login block - $form['at']['modify-output']['login-block']['horizontal_login_block'] = array( + // Label? + $form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_label'] = array( '#type' => 'checkbox', - '#title' => t('Horizontal login block'), - '#default_value' => at_get_setting('horizontal_login_block'), - '#description' => t('Enable a horizontal style login block (all elements on one line). This does not work so well with OpenID and you should probably check the setting to remove OpendID elements.'), + '#title' => t('Show the "You are here" label'), + '#default_value' => at_get_setting('breadcrumb_label'), + '#states' => array( + 'visible' => array('input[name="breadcrumb_display"]' => array('checked' => TRUE)), + ), + ); + // Page title? + $form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_title'] = array( + '#type' => 'checkbox', + '#title' => t('Append the page title to the breadcrumb trail'), + '#default_value' => at_get_setting('breadcrumb_title'), + '#states' => array( + 'visible' => array('input[name="breadcrumb_display"]' => array('checked' => TRUE)), + ), + ); + // Seperator + $form['at']['modify-output']['breadcrumb']['wrapper']['breadcrumb_separator'] = array( + '#type' => 'textfield', + '#title' => t('Separator'), + '#description' => t('Text, basic markup and html entities only. Dont forget to include spaces.'), + '#default_value' => filter_xss_admin(at_get_setting('breadcrumb_separator')), + '#size' => 25, + '#maxlength' => 60, + '#states' => array( + 'visible' => array('input[name="breadcrumb_display"]' => array('checked' => TRUE)), + ), ); -} -// Hide or Remove -$form['at']['modify-output']['hide-remove'] = array( - '#type' => 'fieldset', - '#title' => t('Hide or Remove'), - '#description' => t('

Hide or Remove

'), -); -// Hide front page title -$form['at']['modify-output']['hide-remove']['frontpage_remove_title'] = array( - '#type' => 'checkbox', - '#title' => t('Remove the frontpage title'), - '#default_value' => at_get_setting('frontpage_remove_title'), - '#description' => t('Checking this setting will remove the page title from the front page, for example if you set a node to be the front page content you may want to hide the title.'), -); -// Unset block system main front -$form['at']['modify-output']['hide-remove']['unset_block_system_main_front'] = array( - '#type' => 'checkbox', - '#title' => t('Do not display the Main content block on the front page'), - '#default_value' => at_get_setting('unset_block_system_main_front'), - '#description' => t('Checking this setting will remove the Main content block from the front page only - useful for removing the welcome message and allowing use of another block.'), -); -// Hide RSS icons -$form['at']['modify-output']['hide-remove']['feed_icons_hide'] = array( - '#type' => 'checkbox', - '#title' => t('Remove RSS feed icons'), - '#default_value' => at_get_setting('feed_icons_hide'), - '#description' => t('Checking this setting will remove RSS feed icons. This will not affect the Syndicate block icon.'), -); -// Hide comment title -$form['at']['modify-output']['hide-remove']['comments_hide_title'] = array( - '#type' => 'checkbox', - '#title' => t('Hide comment titles'), - '#default_value' => at_get_setting('comments_hide_title'), - '#description' => t('Checking this setting will hide comment titles using element-invisible. Hiding rather than removing titles maintains accessibility and semantic structure while not showing titles to sighted users.'), -); -// Remove menu link titles -$form['at']['modify-output']['hide-remove']['unset_menu_titles'] = array( - '#type' => 'checkbox', - '#title' => t('Remove menu link titles'), - '#default_value' => at_get_setting('unset_menu_titles'), - '#description' => t('Checking this setting will remove all menu link titles (tool tips). This only works for menu blocks.'), -); + // Login block options. There is also a slide-down block option, but I have never added it. + if (at_get_setting('horizontal_login_block_enable') === 'on') { + $form['at']['modify-output']['login-block'] = array( + '#type' => 'fieldset', + '#title' => t('Login Block'), + '#description' => t('

Login Block Options

'), + ); + // Login block links + $form['at']['modify-output']['login-block']['login_block_remove_links'] = array( + '#type' => 'checkbox', + '#title' => t('Remove links'), + '#default_value' => at_get_setting('login_block_remove_links'), + '#description' => t('Remove the Create new account and Request new password links from the login block.'), + ); + // Login block OpenID + $form['at']['modify-output']['login-block']['login_block_remove_openid'] = array( + '#type' => 'checkbox', + '#title' => t('Remove OpenID elements'), + '#default_value' => at_get_setting('login_block_remove_openid'), + '#description' => t('Remove the OpenID links and form elements from the login block.'), + ); + // Horizontal login block + $form['at']['modify-output']['login-block']['horizontal_login_block'] = array( + '#type' => 'checkbox', + '#title' => t('Horizontal login block'), + '#default_value' => at_get_setting('horizontal_login_block'), + '#description' => t('Enable a horizontal style login block (all elements on one line). This does not work so well with OpenID and you should probably check the setting to remove OpendID elements.'), + ); + } -// Accessibility -$form['at']['modify-output']['a11y'] = array( - '#type' => 'fieldset', - '#title' => t('Accessibility'), - '#description' => t('

Accessibility

'), -); -// Use extra fieldsets in advanced serach form -$form['at']['modify-output']['a11y']['adv_search_extra_fieldsets'] = array( - '#type' => 'checkbox', - '#title' => t('Use extra fieldset wrappers in the advanced search form'), - '#default_value' => at_get_setting('adv_search_extra_fieldsets'), - '#description' => t('The problem with Drupals standard Advanced search form is that each criterion group is wrapped in a DIV, whereas it should use fieldsets. Turning this on may cause issues with modules that modify the search form such as Search Config.'), -); -// Skip link target -$form['at']['modify-output']['a11y']['skip_link_target'] = array( - '#type' => 'textfield', - '#title' => t('Skip to navigation target ID'), - '#description' => t('If your main content is not in the Main Content region you can change the skip link target ID to match.'), - '#default_value' => check_plain(at_get_setting('skip_link_target')), -); + // Hide or Remove + $form['at']['modify-output']['hide-remove'] = array( + '#type' => 'fieldset', + '#title' => t('Hide or Remove'), + '#description' => t('

Hide or Remove

'), + ); + // Hide front page title + $form['at']['modify-output']['hide-remove']['frontpage_remove_title'] = array( + '#type' => 'checkbox', + '#title' => t('Remove the frontpage title'), + '#default_value' => at_get_setting('frontpage_remove_title'), + '#description' => t('Checking this setting will remove the page title from the front page, for example if you set a node to be the front page content you may want to hide the title.'), + ); + // Unset block system main front + $form['at']['modify-output']['hide-remove']['unset_block_system_main_front'] = array( + '#type' => 'checkbox', + '#title' => t('Do not display the Main content block on the front page'), + '#default_value' => at_get_setting('unset_block_system_main_front'), + '#description' => t('Checking this setting will remove the Main content block from the front page only - useful for removing the welcome message and allowing use of another block.'), + ); + // Hide RSS icons + $form['at']['modify-output']['hide-remove']['feed_icons_hide'] = array( + '#type' => 'checkbox', + '#title' => t('Remove RSS feed icons'), + '#default_value' => at_get_setting('feed_icons_hide'), + '#description' => t('Checking this setting will remove RSS feed icons. This will not affect the Syndicate block icon.'), + ); + // Hide comment title + $form['at']['modify-output']['hide-remove']['comments_hide_title'] = array( + '#type' => 'checkbox', + '#title' => t('Hide comment titles'), + '#default_value' => at_get_setting('comments_hide_title'), + '#description' => t('Checking this setting will hide comment titles using element-invisible. Hiding rather than removing titles maintains accessibility and semantic structure while not showing titles to sighted users.'), + ); + // Remove menu link titles + $form['at']['modify-output']['hide-remove']['unset_menu_titles'] = array( + '#type' => 'checkbox', + '#title' => t('Remove menu link titles'), + '#default_value' => at_get_setting('unset_menu_titles'), + '#description' => t('Checking this setting will remove all menu link titles (tool tips). This only works for menu blocks.'), + ); -// SEO/Authorship -$form['at']['modify-output']['seo'] = array( - '#type' => 'fieldset', - '#title' => t('SEO'), - '#description' => t('

SEO

'), -); -// Use extra fieldsets in advanced serach form -$form['at']['modify-output']['seo']['rel_author'] = array( - '#type' => 'checkbox', - '#title' => t('Add rel=author to user names.'), - '#default_value' => at_get_setting('rel_author'), - '#description' => t('Add rel author to user names to support Googles Authorship feature.', array('!authorhship' => 'http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1408986')), -); + // Accessibility + $form['at']['modify-output']['a11y'] = array( + '#type' => 'fieldset', + '#title' => t('Accessibility'), + '#description' => t('

Accessibility

'), + ); + // Use extra fieldsets in advanced serach form + $form['at']['modify-output']['a11y']['adv_search_extra_fieldsets'] = array( + '#type' => 'checkbox', + '#title' => t('Use extra fieldset wrappers in the advanced search form'), + '#default_value' => at_get_setting('adv_search_extra_fieldsets'), + '#description' => t('The problem with Drupals standard Advanced search form is that each criterion group is wrapped in a DIV, whereas it should use fieldsets. Turning this on may cause issues with modules that modify the search form such as Search Config.'), + ); + // Skip link target + $form['at']['modify-output']['a11y']['skip_link_target'] = array( + '#type' => 'textfield', + '#title' => t('Skip to navigation target ID'), + '#description' => t('If your main content is not in the Main Content region you can change the skip link target ID to match.'), + '#default_value' => check_plain(at_get_setting('skip_link_target')), + ); -// Extra CSS Classes -$form['at']['modify-output']['extra-classes'] = array( - '#type' => 'fieldset', - '#title' => t('Extra Classes'), - '#description' => t('

Extra CSS Classes

'), -); -// Page -$form['at']['modify-output']['extra-classes']['extra_page_classes'] = array( - '#type' => 'checkbox', - '#title' => t('Page classes'), - '#description' => t('page-path, add/edit/delete (for workflow states), content type classes, section classes, site name class (useful for multisites) and a language class (i18n)'), - '#default_value' => at_get_setting('extra_page_classes'), -); -// Node -$form['at']['modify-output']['extra-classes']['extra_article_classes'] = array( - '#type' => 'checkbox', - '#title' => t('Node classes'), - '#description' => t('promoted, sticky, preview, language, odd/even classes, user picture handling, and build mode classes'), - '#default_value' => at_get_setting('extra_article_classes'), -); -// Comment -$form['at']['modify-output']['extra-classes']['extra_comment_classes'] = array( - '#type' => 'checkbox', - '#title' => t('Comment classes'), - '#description' => t('anonymous, author, viewer, new, odd/even classes and classes for hidden titles, user picture and signature handling'), - '#default_value' => at_get_setting('extra_comment_classes'), -); -// Block -$form['at']['modify-output']['extra-classes']['extra_block_classes'] = array( - '#type' => 'checkbox', - '#title' => t('Blocks classes'), - '#description' => t('odd/even (zebra classes), block region, delta and block count classes'), - '#default_value' => at_get_setting('extra_block_classes'), -); -// Menu -$form['at']['modify-output']['extra-classes']['extra_menu_classes'] = array( - '#type' => 'checkbox', - '#title' => t('Menus classes'), - '#description' => t('menu link ID (mlid) and menu level (depth)'), - '#default_value' => at_get_setting('extra_menu_classes'), -); -// Item lists -$form['at']['modify-output']['extra-classes']['extra_item_list_classes'] = array( - '#type' => 'checkbox', - '#title' => t('Item-lists classes'), - '#description' => t('first, last and odd/even (zebra classes)'), - '#default_value' => at_get_setting('extra_item_list_classes'), -); + // SEO/Authorship + $form['at']['modify-output']['seo'] = array( + '#type' => 'fieldset', + '#title' => t('SEO'), + '#description' => t('

SEO

'), + ); + // Use extra fieldsets in advanced serach form + $form['at']['modify-output']['seo']['rel_author'] = array( + '#type' => 'checkbox', + '#title' => t('Add rel=author to user names.'), + '#default_value' => at_get_setting('rel_author'), + '#description' => t('Add rel author to user names to support Googles Authorship feature.', array('!authorhship' => 'http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1408986')), + ); + + // Extra CSS Classes + $form['at']['modify-output']['extra-classes'] = array( + '#type' => 'fieldset', + '#title' => t('Extra Classes'), + '#description' => t('

Extra CSS Classes

'), + ); + // Page + $form['at']['modify-output']['extra-classes']['extra_page_classes'] = array( + '#type' => 'checkbox', + '#title' => t('Page classes'), + '#description' => t('page-path, add/edit/delete (for workflow states), content type classes, section classes, site name class (useful for multisites) and a language class (i18n)'), + '#default_value' => at_get_setting('extra_page_classes'), + ); + // Node + $form['at']['modify-output']['extra-classes']['extra_article_classes'] = array( + '#type' => 'checkbox', + '#title' => t('Node classes'), + '#description' => t('promoted, sticky, preview, language, odd/even classes, user picture handling, and build mode classes'), + '#default_value' => at_get_setting('extra_article_classes'), + ); + // Comment + $form['at']['modify-output']['extra-classes']['extra_comment_classes'] = array( + '#type' => 'checkbox', + '#title' => t('Comment classes'), + '#description' => t('anonymous, author, viewer, new, odd/even classes and classes for hidden titles, user picture and signature handling'), + '#default_value' => at_get_setting('extra_comment_classes'), + ); + // Block + $form['at']['modify-output']['extra-classes']['extra_block_classes'] = array( + '#type' => 'checkbox', + '#title' => t('Blocks classes'), + '#description' => t('odd/even (zebra classes), block region, delta and block count classes'), + '#default_value' => at_get_setting('extra_block_classes'), + ); + // Menu + $form['at']['modify-output']['extra-classes']['extra_menu_classes'] = array( + '#type' => 'checkbox', + '#title' => t('Menus classes'), + '#description' => t('menu link ID (mlid) and menu level (depth)'), + '#default_value' => at_get_setting('extra_menu_classes'), + ); + // Item lists + $form['at']['modify-output']['extra-classes']['extra_item_list_classes'] = array( + '#type' => 'checkbox', + '#title' => t('Item-lists classes'), + '#description' => t('first, last and odd/even (zebra classes)'), + '#default_value' => at_get_setting('extra_item_list_classes'), + ); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.pagelayout.inc b/at_core/inc/forms/settings.pagelayout.inc index db30761..ab90ceb 100755 --- a/at_core/inc/forms/settings.pagelayout.inc +++ b/at_core/inc/forms/settings.pagelayout.inc @@ -5,691 +5,693 @@ * Generate form elments for the Page Layout settings. */ -// Get an array of device groups with option values -$device_group_options = responsive_page_layouts_device_group_options($theme_name); - -// Assign $options for each device group -foreach ($device_group_options as $device_group => $options) { - - // About here we need to call a custom sort function, this is what we got for now - sort($options, SORT_STRING); - - foreach ($options as $option) { - if ($device_group === 'bigscreen') { - $bigscreen_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); // human readable option names for accessibility +function at_core_page_layout_form(&$form, $theme_name) { + // Get an array of device groups with option values + $device_group_options = responsive_page_layouts_device_group_options($theme_name); + + // Assign $options for each device group + foreach ($device_group_options as $device_group => $options) { + + // About here we need to call a custom sort function, this is what we got for now + sort($options, SORT_STRING); + + foreach ($options as $option) { + if ($device_group === 'bigscreen') { + $bigscreen_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); // human readable option names for accessibility + } + if ($device_group === 'tablet_landscape') { + $tablet_landscape_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); + } + if ($device_group === 'tablet_portrait') { + $tablet_portrait_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); + } + if ($device_group === 'smartphone_landscape') { + $smartphone_landscape_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); + } } - if ($device_group === 'tablet_landscape') { - $tablet_landscape_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); - } - if ($device_group === 'tablet_portrait') { - $tablet_portrait_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); - } - if ($device_group === 'smartphone_landscape') { - $smartphone_landscape_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); + } + + // CSS for page layout icons + $page_layout_css_files = responsive_plugins_admin_css($theme_name, $plugin_type = 'page_layout'); + foreach ($page_layout_css_files as $filepath) { + if (file_exists($filepath)) { + $page_layout_css['css'][] = array('type' => 'file', 'data' => $filepath, 'weight' => 100); } } -} -// CSS for page layout icons -$page_layout_css_files = responsive_plugins_admin_css($theme_name, $plugin_type = 'page_layout'); -foreach ($page_layout_css_files as $filepath) { - if (file_exists($filepath)) { - $page_layout_css['css'][] = array('type' => 'file', 'data' => $filepath, 'weight' => 100); + // Unit options + $unit_options = array('%' => '%', 'px' => 'px', 'em' => 'em'); + + // Set a message for when responsive layout is turned off + $disable_message = t('

The responsive layout is disabled, only the Standard layout is now used.

To re-enable uncheck the "Disable responsive layout and styles" checkbox under the "Settings" tab.

'); + + + /***************************************************************************** + * + * Bigscreen (standard-layout) + * + ****************************************************************************/ + + $form['at-settings']['bigscreen'] = array( + '#type' => 'fieldset', + '#title' => t('Standard Layout'), + '#description' => t('

Standard Layout

The standard layout is for desktops, laptops and other large screen devices.'), + '#attached' => $page_layout_css, + '#attributes' => array( + 'class' => array('at-layout-form'), + ), + ); + + // Bigscreen Layout + $form['at-settings']['bigscreen']['bigscreen-layout-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Choose sidebar layout'), + ); + + // Options + $form['at-settings']['bigscreen']['bigscreen-layout-wrapper']['bigscreen_layout'] = array( + '#type' => 'radios', + '#title' => t('Choose sidebar positions'), + '#default_value' => str_replace('-', '_', at_get_setting('bigscreen_layout')), // avoid "illigal choice" errors in 7.x-2.x sub-themes. + '#options' => $bigscreen_options, + ); + + // Sidebars + $form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Set sidebar widths'), + '#description' => t('Set the width of each sidebar'), + ); + + // Units + $form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_unit'] = array( + '#type' => 'select', + '#title' => t('Unit'), + '#default_value' => at_get_setting('bigscreen_sidebar_unit'), + '#options' => $unit_options, + ); + + // Sidebar first + $form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_first'] = array( + '#type' => 'textfield', + '#title' => t('First sidebar'), + '#default_value' => check_plain(at_get_setting('bigscreen_sidebar_first')), + '#size' => 4, + '#maxlenght' => 4, + '#states' => array( + 'required' => array( + array('input[name="bigscreen_layout"]' => array('value' => 'three_col_grail')), + array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_left')), + array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_right')), + ), + ), + ); + + // Sidebar second + $form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_second'] = array( + '#type' => 'textfield', + '#title' => t('Second sidebar'), + '#default_value' => check_plain(at_get_setting('bigscreen_sidebar_second')), + '#size' => 4, + '#maxlenght' => 4, + '#states' => array( + 'required' => array( + array('input[name="bigscreen_layout"]' => array('value' => 'three_col_grail')), + array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_left')), + array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_right')), + ), + ), + ); + + // Page width + $form['at-settings']['bigscreen']['bigscreen-width-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Set the page width'), + '#description' => t('Set the page width'), + ); + + // Unit + $form['at-settings']['bigscreen']['bigscreen-width-wrapper']['bigscreen_page_unit'] = array( + '#type' => 'select', + '#title' => t('Unit'), + '#default_value' => at_get_setting('bigscreen_page_unit'), + '#options' => $unit_options, + ); + + // Width + $form['at-settings']['bigscreen']['bigscreen-width-wrapper']['bigscreen_page_width'] = array( + '#type' => 'textfield', + '#title' => t('Page width'), + '#default_value' => check_plain(at_get_setting('bigscreen_page_width')), + '#size' => 4, + '#maxlenght' => 4, + '#required' => TRUE, + ); + + // Max width + $form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Set a max width'), + '#states' => array( + 'visible' => array('select[name="bigscreen_page_unit"]' => array('value' => '%')), + ), + ); + + // Max width checkbox + $form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_set_max_width'] = array( + '#type' => 'checkbox', + '#title' => t('Set a max width'), + '#default_value' => at_get_setting('bigscreen_set_max_width'), + ); + + // Max width unit + $form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_max_width_unit'] = array( + '#type' => 'select', + '#title' => t('Unit'), + '#default_value' => at_get_setting('bigscreen_max_width_unit'), + '#options' => array('px' => 'px', 'em' => 'em'), + '#states' => array( + 'visible' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)), + ), + ); + + // Max width value + $form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_max_width'] = array( + '#type' => 'textfield', + '#title' => t('Max width'), + '#default_value' => check_plain(at_get_setting('bigscreen_max_width')), + '#size' => 4, + '#maxlenght' => 4, + '#states' => array( + 'visible' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)), + 'required' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)), + ), + ); + + // Media queries + $form['at-settings']['bigscreen']['media-queries-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Standard Screen Media Queries'), + '#weight' => 1, + '#attributes' => array( + 'class' => array('at-media-queries'), + ), + ); + + // Media query + $form['at-settings']['bigscreen']['media-queries-wrapper']['bigscreen_media_query'] = array( + '#type' => 'textfield', + '#title' => t('Media query for this layout'), + '#default_value' => check_plain(at_get_setting('bigscreen_media_query')), + '#description' => t('Do not include @media, it\'s included automatically.'), + '#size' => 100, + '#required' => TRUE, + ); + + + /***************************************************************************** + * + * Tablet + * + ****************************************************************************/ + + $form['at-settings']['tablet'] = array( + '#type' => 'fieldset', + '#title' => t('Tablet Layout'), + '#description' => t('

Tablet Layout

Tablet devices such as iPad have two orientations - landscape and portrait. You can configure a different layout for each orientation.

'), + '#attributes' => array( + 'class' => array('at-layout-form'), + ), + ); + + // Disabled message + if(at_get_setting('disable_responsive_styles') === 1) { + $form['at-settings']['tablet']['disabled'] = array( + '#markup' => '
' . $disable_message . '
', + ); } -} - -// Unit options -$unit_options = array('%' => '%', 'px' => 'px', 'em' => 'em'); - -// Set a message for when responsive layout is turned off -$disable_message = t('

The responsive layout is disabled, only the Standard layout is now used.

To re-enable uncheck the "Disable responsive layout and styles" checkbox under the "Settings" tab.

'); - - -/***************************************************************************** - * - * Bigscreen (standard-layout) - * - ****************************************************************************/ - -$form['at-settings']['bigscreen'] = array( - '#type' => 'fieldset', - '#title' => t('Standard Layout'), - '#description' => t('

Standard Layout

The standard layout is for desktops, laptops and other large screen devices.'), - '#attached' => $page_layout_css, - '#attributes' => array( - 'class' => array('at-layout-form'), - ), -); - -// Bigscreen Layout -$form['at-settings']['bigscreen']['bigscreen-layout-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Choose sidebar layout'), -); - -// Options -$form['at-settings']['bigscreen']['bigscreen-layout-wrapper']['bigscreen_layout'] = array( - '#type' => 'radios', - '#title' => t('Choose sidebar positions'), - '#default_value' => str_replace('-', '_', at_get_setting('bigscreen_layout')), // avoid "illigal choice" errors in 7.x-2.x sub-themes. - '#options' => $bigscreen_options, -); - -// Sidebars -$form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Set sidebar widths'), - '#description' => t('Set the width of each sidebar'), -); - -// Units -$form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_unit'] = array( - '#type' => 'select', - '#title' => t('Unit'), - '#default_value' => at_get_setting('bigscreen_sidebar_unit'), - '#options' => $unit_options, -); - -// Sidebar first -$form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_first'] = array( - '#type' => 'textfield', - '#title' => t('First sidebar'), - '#default_value' => check_plain(at_get_setting('bigscreen_sidebar_first')), - '#size' => 4, - '#maxlenght' => 4, - '#states' => array( - 'required' => array( - array('input[name="bigscreen_layout"]' => array('value' => 'three_col_grail')), - array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_left')), - array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_right')), + + + /******************* + * Tablet landscape + ******************/ + + $form['at-settings']['tablet']['landscape'] = array( + '#type' => 'fieldset', + '#title' => t('Landscape'), + '#description' => t('

Landscape tablet

'), + '#states' => array( + 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); + + // Tablet landscape Layout options + $form['at-settings']['tablet']['landscape']['tablet-landscape-layout-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Choose sidebar layout'), + ); + + // Options + $form['at-settings']['tablet']['landscape']['tablet-landscape-layout-wrapper']['tablet_landscape_layout'] = array( + '#type' => 'radios', + '#title' => t('Choose sidebar positions'), + '#default_value' => str_replace('-', '_', at_get_setting('tablet_landscape_layout')), + '#options' => $tablet_landscape_options, + ); + + // Sidebars + $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Set sidebar widths'), + '#description' => t('Set the width of each sidebar'), + ); + + // Units + $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_unit'] = array( + '#type' => 'select', + '#title' => t('Unit'), + '#default_value' => at_get_setting('tablet_landscape_sidebar_unit'), + '#options' => $unit_options, + ); + + // Sidebar first + $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_first'] = array( + '#type' => 'textfield', + '#title' => t('First sidebar'), + '#default_value' => check_plain(at_get_setting('tablet_landscape_sidebar_first')), + '#size' => 4, + '#maxlenght' => 4, + '#states' => array( + 'required' => array( + array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')), + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')), + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left_stack')), + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')), + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right_stack')), + ), + ), + ); + + // Sidebar second + $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_second'] = array( + '#type' => 'textfield', + '#title' => t('Second sidebar'), + '#default_value' => check_plain(at_get_setting('tablet_landscape_sidebar_second')), + '#size' => 4, + '#maxlenght' => 4, + '#states' => array( + 'invisible' => array( + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left_stack')), + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right_stack')), + ), + 'required' => array( + array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')), + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')), + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')), + ), + ), + ); + + // Conditional messages for sidebar layouts + $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet-landscape-sidebar-message-wrapper'] = array( + '#type' => 'fieldset', + '#states' => array( + 'invisible' => array( + array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')), + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')), + array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')), + ), + ), + ); + $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet-landscape-sidebar-message-wrapper']['message'] = array( + '#markup' => t('
In this layout Second sidebar wraps below.
'), + ); + + // Page width + $form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Set the page width'), + '#description' => t('Set the page width'), + ); + + // Unit + $form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper']['tablet_landscape_page_unit'] = array( + '#type' => 'select', + '#title' => t('Unit'), + '#default_value' => at_get_setting('tablet_landscape_page_unit'), + '#options' => $unit_options, + ); + + // Width + $form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper']['tablet_landscape_page_width'] = array( + '#type' => 'textfield', + '#title' => t('Page width'), + '#default_value' => check_plain(at_get_setting('tablet_landscape_page_width')), + '#size' => 4, + '#maxlenght' => 4, + '#required' => TRUE, + ); + + // Media Queries + $form['at-settings']['tablet']['landscape']['tablet-landscape-media-queries-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Tablet Landscape Media Queries'), + '#weight' => 1, + '#attributes' => array( + 'class' => array( + 'at-media-queries', + ), ), - ), -); - -// Sidebar second -$form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_second'] = array( - '#type' => 'textfield', - '#title' => t('Second sidebar'), - '#default_value' => check_plain(at_get_setting('bigscreen_sidebar_second')), - '#size' => 4, - '#maxlenght' => 4, - '#states' => array( - 'required' => array( - array('input[name="bigscreen_layout"]' => array('value' => 'three_col_grail')), - array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_left')), - array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_right')), + ); + + // Media query + $form['at-settings']['tablet']['landscape']['tablet-landscape-media-queries-wrapper']['tablet_landscape_media_query'] = array( + '#type' => 'textfield', + '#title' => t('Media query for this layout'), + '#default_value' => check_plain(at_get_setting('tablet_landscape_media_query')), + '#description' => t('Do not include @media, it\'s included automatically.'), + '#size' => 100, + '#required' => TRUE, + ); + + + /****************** + * Tablet portrait + *****************/ + + $form['at-settings']['tablet']['portrait'] = array( + '#type' => 'fieldset', + '#title' => t('Portrait'), + '#description' => t('

Portrait tablet

'), + '#states' => array( + 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), ), - ), -); - -// Page width -$form['at-settings']['bigscreen']['bigscreen-width-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Set the page width'), - '#description' => t('Set the page width'), -); - -// Unit -$form['at-settings']['bigscreen']['bigscreen-width-wrapper']['bigscreen_page_unit'] = array( - '#type' => 'select', - '#title' => t('Unit'), - '#default_value' => at_get_setting('bigscreen_page_unit'), - '#options' => $unit_options, -); - -// Width -$form['at-settings']['bigscreen']['bigscreen-width-wrapper']['bigscreen_page_width'] = array( - '#type' => 'textfield', - '#title' => t('Page width'), - '#default_value' => check_plain(at_get_setting('bigscreen_page_width')), - '#size' => 4, - '#maxlenght' => 4, - '#required' => TRUE, -); - -// Max width -$form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Set a max width'), - '#states' => array( - 'visible' => array('select[name="bigscreen_page_unit"]' => array('value' => '%')), - ), -); - -// Max width checkbox -$form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_set_max_width'] = array( - '#type' => 'checkbox', - '#title' => t('Set a max width'), - '#default_value' => at_get_setting('bigscreen_set_max_width'), -); - -// Max width unit -$form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_max_width_unit'] = array( - '#type' => 'select', - '#title' => t('Unit'), - '#default_value' => at_get_setting('bigscreen_max_width_unit'), - '#options' => array('px' => 'px', 'em' => 'em'), - '#states' => array( - 'visible' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)), - ), -); - -// Max width value -$form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_max_width'] = array( - '#type' => 'textfield', - '#title' => t('Max width'), - '#default_value' => check_plain(at_get_setting('bigscreen_max_width')), - '#size' => 4, - '#maxlenght' => 4, - '#states' => array( - 'visible' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)), - 'required' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)), - ), -); - -// Media queries -$form['at-settings']['bigscreen']['media-queries-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Standard Screen Media Queries'), - '#weight' => 1, - '#attributes' => array( - 'class' => array('at-media-queries'), - ), -); - -// Media query -$form['at-settings']['bigscreen']['media-queries-wrapper']['bigscreen_media_query'] = array( - '#type' => 'textfield', - '#title' => t('Media query for this layout'), - '#default_value' => check_plain(at_get_setting('bigscreen_media_query')), - '#description' => t('Do not include @media, it\'s included automatically.'), - '#size' => 100, - '#required' => TRUE, -); - - -/***************************************************************************** - * - * Tablet - * - ****************************************************************************/ - -$form['at-settings']['tablet'] = array( - '#type' => 'fieldset', - '#title' => t('Tablet Layout'), - '#description' => t('

Tablet Layout

Tablet devices such as iPad have two orientations - landscape and portrait. You can configure a different layout for each orientation.

'), - '#attributes' => array( - 'class' => array('at-layout-form'), - ), -); - -// Disabled message -if(at_get_setting('disable_responsive_styles') === 1) { - $form['at-settings']['tablet']['disabled'] = array( - '#markup' => '
' . $disable_message . '
', - ); -} - - -/******************* - * Tablet landscape - ******************/ - -$form['at-settings']['tablet']['landscape'] = array( - '#type' => 'fieldset', - '#title' => t('Landscape'), - '#description' => t('

Landscape tablet

'), - '#states' => array( - 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); - -// Tablet landscape Layout options -$form['at-settings']['tablet']['landscape']['tablet-landscape-layout-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Choose sidebar layout'), -); - -// Options -$form['at-settings']['tablet']['landscape']['tablet-landscape-layout-wrapper']['tablet_landscape_layout'] = array( - '#type' => 'radios', - '#title' => t('Choose sidebar positions'), - '#default_value' => str_replace('-', '_', at_get_setting('tablet_landscape_layout')), - '#options' => $tablet_landscape_options, -); - -// Sidebars -$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Set sidebar widths'), - '#description' => t('Set the width of each sidebar'), -); - -// Units -$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_unit'] = array( - '#type' => 'select', - '#title' => t('Unit'), - '#default_value' => at_get_setting('tablet_landscape_sidebar_unit'), - '#options' => $unit_options, -); - -// Sidebar first -$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_first'] = array( - '#type' => 'textfield', - '#title' => t('First sidebar'), - '#default_value' => check_plain(at_get_setting('tablet_landscape_sidebar_first')), - '#size' => 4, - '#maxlenght' => 4, - '#states' => array( - 'required' => array( - array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')), - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')), - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left_stack')), - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')), - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right_stack')), + ); + + // Tablet portrait Layout options + $form['at-settings']['tablet']['portrait']['tablet-portrait-layout-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Choose sidebar layout'), + ); + + // Options + $form['at-settings']['tablet']['portrait']['tablet-portrait-layout-wrapper']['tablet_portrait_layout'] = array( + '#type' => 'radios', + '#title' => t('Choose sidebar positions'), + '#default_value' => str_replace('-', '_', at_get_setting('tablet_portrait_layout')), + '#options' => $tablet_portrait_options, + ); + + // Tablet portrait Sidebars + $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Set sidebar widths'), + '#description' => t('Set the width of each sidebar'), + '#states' => array( + 'invisible' => array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')), ), - ), -); - -// Sidebar second -$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_second'] = array( - '#type' => 'textfield', - '#title' => t('Second sidebar'), - '#default_value' => check_plain(at_get_setting('tablet_landscape_sidebar_second')), - '#size' => 4, - '#maxlenght' => 4, - '#states' => array( - 'invisible' => array( - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left_stack')), - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right_stack')), + ); + + // Units + $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_unit'] = array( + '#type' => 'select', + '#title' => t('Unit'), + '#default_value' => at_get_setting('tablet_portrait_sidebar_unit'), + '#options' => $unit_options, + ); + + // Sidebar first + $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_first'] = array( + '#type' => 'textfield', + '#title' => t('First sidebar'), + '#default_value' => check_plain(at_get_setting('tablet_portrait_sidebar_first')), + '#size' => 4, + '#maxlenght' => 4, + '#states' => array( + 'invisible' => array( + array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')), + ), + 'required' => array( + array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')), + array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_left_stack')), + array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_right_stack')), + ), ), - 'required' => array( - array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')), - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')), - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')), + ); + + // Sidebar second + $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_second'] = array( + '#type' => 'textfield', + '#title' => t('Second sidebar'), + '#default_value' => check_plain(at_get_setting('tablet_portrait_sidebar_second')), + '#size' => 4, + '#maxlenght' => 4, + '#states' => array( + 'invisible' => array( + array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')), + array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_left_stack')), + array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_right_stack')), + ), + 'required' => array( + array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')), + ), ), - ), -); - -// Conditional messages for sidebar layouts -$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet-landscape-sidebar-message-wrapper'] = array( - '#type' => 'fieldset', - '#states' => array( - 'invisible' => array( - array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')), - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')), - array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')), + ); + + // Conditional messages for sidebar layouts + $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet-portrait-sidebar-message-wrapper'] = array( + '#type' => 'fieldset', + '#states' => array( + 'invisible' => array( + array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')), + array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')), + ), ), - ), -); -$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet-landscape-sidebar-message-wrapper']['message'] = array( - '#markup' => t('
In this layout Second sidebar wraps below.
'), -); - -// Page width -$form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Set the page width'), - '#description' => t('Set the page width'), -); - -// Unit -$form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper']['tablet_landscape_page_unit'] = array( - '#type' => 'select', - '#title' => t('Unit'), - '#default_value' => at_get_setting('tablet_landscape_page_unit'), - '#options' => $unit_options, -); - -// Width -$form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper']['tablet_landscape_page_width'] = array( - '#type' => 'textfield', - '#title' => t('Page width'), - '#default_value' => check_plain(at_get_setting('tablet_landscape_page_width')), - '#size' => 4, - '#maxlenght' => 4, - '#required' => TRUE, -); - -// Media Queries -$form['at-settings']['tablet']['landscape']['tablet-landscape-media-queries-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Tablet Landscape Media Queries'), - '#weight' => 1, - '#attributes' => array( - 'class' => array( - 'at-media-queries', + ); + $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet-portrait-sidebar-message-wrapper']['message'] = array( + '#markup' => t('
In this layout Second sidebar wraps below.
'), + ); + + // Tablet portrait Page width + $form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Set the page width'), + '#description' => t('Set the page width'), + ); + + // Unit + $form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper']['tablet_portrait_page_unit'] = array( + '#type' => 'select', + '#title' => t('Unit'), + '#default_value' => at_get_setting('tablet_portrait_page_unit'), + '#options' => $unit_options, + ); + + // Width + $form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper']['tablet_portrait_page_width'] = array( + '#type' => 'textfield', + '#title' => t('Page width'), + '#default_value' => check_plain(at_get_setting('tablet_portrait_page_width')), + '#size' => 4, + '#maxlenght' => 4, + '#required' => TRUE, + ); + + + // Tablet portrait Media queries + $form['at-settings']['tablet']['portrait']['tablet-portrait-media-queries-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Tablet Portrait Media Queries'), + '#weight' => 1, + '#attributes' => array( + 'class' => array('at-media-queries'), ), - ), -); - -// Media query -$form['at-settings']['tablet']['landscape']['tablet-landscape-media-queries-wrapper']['tablet_landscape_media_query'] = array( - '#type' => 'textfield', - '#title' => t('Media query for this layout'), - '#default_value' => check_plain(at_get_setting('tablet_landscape_media_query')), - '#description' => t('Do not include @media, it\'s included automatically.'), - '#size' => 100, - '#required' => TRUE, -); - - -/****************** - * Tablet portrait - *****************/ - -$form['at-settings']['tablet']['portrait'] = array( - '#type' => 'fieldset', - '#title' => t('Portrait'), - '#description' => t('

Portrait tablet

'), - '#states' => array( - 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); - -// Tablet portrait Layout options -$form['at-settings']['tablet']['portrait']['tablet-portrait-layout-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Choose sidebar layout'), -); - -// Options -$form['at-settings']['tablet']['portrait']['tablet-portrait-layout-wrapper']['tablet_portrait_layout'] = array( - '#type' => 'radios', - '#title' => t('Choose sidebar positions'), - '#default_value' => str_replace('-', '_', at_get_setting('tablet_portrait_layout')), - '#options' => $tablet_portrait_options, -); - -// Tablet portrait Sidebars -$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Set sidebar widths'), - '#description' => t('Set the width of each sidebar'), - '#states' => array( - 'invisible' => array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')), - ), -); - -// Units -$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_unit'] = array( - '#type' => 'select', - '#title' => t('Unit'), - '#default_value' => at_get_setting('tablet_portrait_sidebar_unit'), - '#options' => $unit_options, -); - -// Sidebar first -$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_first'] = array( - '#type' => 'textfield', - '#title' => t('First sidebar'), - '#default_value' => check_plain(at_get_setting('tablet_portrait_sidebar_first')), - '#size' => 4, - '#maxlenght' => 4, - '#states' => array( - 'invisible' => array( - array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')), + ); + + // Media query + $form['at-settings']['tablet']['portrait']['tablet-portrait-media-queries-wrapper']['tablet_portrait_media_query'] = array( + '#type' => 'textfield', + '#title' => t('Media query for this layout'), + '#default_value' => check_plain(at_get_setting('tablet_portrait_media_query')), + '#description' => t('Do not include @media, it\'s included automatically.'), + '#size' => 100, + '#required' => TRUE, + ); + + + /***************************************************************************** + * + * Smartphone + * + ****************************************************************************/ + + $form['at-settings']['smartphone'] = array( + '#type' => 'fieldset', + '#title' => t('Smartphone Layout'), + '#description' => t('

Smartphone Layout

Smartphone devices such as iPhone, Android and Windows phones have two orientations - landscape and portrait. You can configure a layout for landscape orientation only - portrait orientation always displays in one column with sidebars stacked below the main content.

'), + '#attributes' => array( + 'class' => array('at-layout-form'), ), - 'required' => array( - array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')), - array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_left_stack')), - array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_right_stack')), + ); + + // Disabled message + if(at_get_setting('disable_responsive_styles') === 1) { + $form['at-settings']['smartphone']['disabled'] = array( + '#markup' => '
' . $disable_message . '
', + ); + } + + + /*********************** + * Smartphone landscape + **********************/ + + $form['at-settings']['smartphone']['landscape'] = array( + '#type' => 'fieldset', + '#title' => t('Landscape'), + '#description' => t('

Landscape smartphone

'), + '#states' => array( + 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), ), - ), -); - -// Sidebar second -$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_second'] = array( - '#type' => 'textfield', - '#title' => t('Second sidebar'), - '#default_value' => check_plain(at_get_setting('tablet_portrait_sidebar_second')), - '#size' => 4, - '#maxlenght' => 4, - '#states' => array( - 'invisible' => array( - array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')), - array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_left_stack')), - array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_right_stack')), + ); + + $form['at-settings']['smartphone']['landscape']['smartphone-landscape-layout-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Choose sidebar layout'), + ); + + $form['at-settings']['smartphone']['landscape']['smartphone-landscape-layout-wrapper']['smartphone_landscape_layout'] = array( + '#type' => 'radios', + '#title' => t('Choose sidebar positions'), + '#default_value' => str_replace('-', '_', at_get_setting('smartphone_landscape_layout')), + '#options' => $smartphone_landscape_options, + ); + + $form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Set sidebar widths'), + '#description' => t('Set the width of each sidebar'), + '#states' => array( + '!visible' => array('input[name="smartphone_landscape_layout"]' => array('value' => 'one_col_stack')), ), - 'required' => array( - array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')), + ); + + $form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper']['smartphone_landscape_sidebar_unit'] = array( + '#type' => 'select', + '#title' => t('Unit'), + '#default_value' => at_get_setting('smartphone_landscape_sidebar_unit'), + '#options' => $unit_options, + ); + + $form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper']['smartphone_landscape_sidebar_first'] = array( + '#type' => 'textfield', + '#title' => t('First sidebar'), + '#default_value' => check_plain(at_get_setting('smartphone_landscape_sidebar_first')), + '#size' => 4, + '#maxlenght' => 4, + '#states' => array( + 'required' => array('input[name="smartphone_landscape_layout"]' => array('value' => 'one_col_vert')), + ), + ); + + $form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper']['smartphone_landscape_sidebar_second'] = array( + '#type' => 'textfield', + '#title' => t('Second sidebar'), + '#default_value' => check_plain(at_get_setting('smartphone_landscape_sidebar_second')), + '#size' => 4, + '#maxlenght' => 4, + '#states' => array( + 'required' => array('input[name="smartphone_landscape_layout"]' => array('value' => 'one_col_vert')), + ), + ); + + $form['at-settings']['smartphone']['landscape']['smartphone-landscape-media-queries-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Smartphone Landscape Media Queries'), + '#weight' => 1, + '#attributes' => array( + 'class' => array('at-media-queries'), + ), + ); + + $form['at-settings']['smartphone']['landscape']['smartphone-landscape-media-queries-wrapper']['smartphone_landscape_media_query'] = array( + '#type' => 'textfield', + '#title' => t('Media query for this layout'), + '#default_value' => check_plain(at_get_setting('smartphone_landscape_media_query')), + '#description' => t('Do not include @media, it\'s included automatically.'), + '#size' => 100, + '#required' => TRUE, + ); + + // Pass hidden values to the sumbit function, these values are required but the user can't change them via the UI + $form['at-settings']['smartphone']['landscape']['hidden']['smartphone_landscape_page_width'] = array( + '#type' => 'hidden', + '#default_value' => check_plain(at_get_setting('smartphone_landscape_page_width')), + ); + $form['at-settings']['smartphone']['landscape']['hidden']['smartphone_landscape_page_unit'] = array( + '#type' => 'hidden', + '#default_value' => at_get_setting('smartphone_landscape_page_unit'), + ); + + + /********************** + * Smartphone portrait + *********************/ + + $form['at-settings']['smartphone']['portrait'] = array( + '#type' => 'fieldset', + '#title' => t('Portrait'), + '#description' => t('

Portrait smartphone

One column

The smartphone portrait layout always displays in one column with sidebars stacked horizontally below the main content. All widths are always 100%.

'), + '#states' => array( + 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), ), - ), -); - -// Conditional messages for sidebar layouts -$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet-portrait-sidebar-message-wrapper'] = array( - '#type' => 'fieldset', - '#states' => array( - 'invisible' => array( - array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')), - array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')), + ); + + $form['at-settings']['smartphone']['portrait']['smartphone-portrait-media-queries-wrapper'] = array( + '#type' => 'fieldset', + '#title' => t('Smartphone Portrait Media Queries'), + '#weight' => 1, + '#attributes' => array( + 'class' => array('at-media-queries'), ), - ), -); -$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet-portrait-sidebar-message-wrapper']['message'] = array( - '#markup' => t('
In this layout Second sidebar wraps below.
'), -); - -// Tablet portrait Page width -$form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Set the page width'), - '#description' => t('Set the page width'), -); - -// Unit -$form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper']['tablet_portrait_page_unit'] = array( - '#type' => 'select', - '#title' => t('Unit'), - '#default_value' => at_get_setting('tablet_portrait_page_unit'), - '#options' => $unit_options, -); - -// Width -$form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper']['tablet_portrait_page_width'] = array( - '#type' => 'textfield', - '#title' => t('Page width'), - '#default_value' => check_plain(at_get_setting('tablet_portrait_page_width')), - '#size' => 4, - '#maxlenght' => 4, - '#required' => TRUE, -); - - -// Tablet portrait Media queries -$form['at-settings']['tablet']['portrait']['tablet-portrait-media-queries-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Tablet Portrait Media Queries'), - '#weight' => 1, - '#attributes' => array( - 'class' => array('at-media-queries'), - ), -); - -// Media query -$form['at-settings']['tablet']['portrait']['tablet-portrait-media-queries-wrapper']['tablet_portrait_media_query'] = array( - '#type' => 'textfield', - '#title' => t('Media query for this layout'), - '#default_value' => check_plain(at_get_setting('tablet_portrait_media_query')), - '#description' => t('Do not include @media, it\'s included automatically.'), - '#size' => 100, - '#required' => TRUE, -); - - -/***************************************************************************** - * - * Smartphone - * - ****************************************************************************/ - -$form['at-settings']['smartphone'] = array( - '#type' => 'fieldset', - '#title' => t('Smartphone Layout'), - '#description' => t('

Smartphone Layout

Smartphone devices such as iPhone, Android and Windows phones have two orientations - landscape and portrait. You can configure a layout for landscape orientation only - portrait orientation always displays in one column with sidebars stacked below the main content.

'), - '#attributes' => array( - 'class' => array('at-layout-form'), - ), -); - -// Disabled message -if(at_get_setting('disable_responsive_styles') === 1) { - $form['at-settings']['smartphone']['disabled'] = array( - '#markup' => '
' . $disable_message . '
', - ); -} - - -/*********************** - * Smartphone landscape - **********************/ - -$form['at-settings']['smartphone']['landscape'] = array( - '#type' => 'fieldset', - '#title' => t('Landscape'), - '#description' => t('

Landscape smartphone

'), - '#states' => array( - 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); - -$form['at-settings']['smartphone']['landscape']['smartphone-landscape-layout-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Choose sidebar layout'), -); - -$form['at-settings']['smartphone']['landscape']['smartphone-landscape-layout-wrapper']['smartphone_landscape_layout'] = array( - '#type' => 'radios', - '#title' => t('Choose sidebar positions'), - '#default_value' => str_replace('-', '_', at_get_setting('smartphone_landscape_layout')), - '#options' => $smartphone_landscape_options, -); - -$form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Set sidebar widths'), - '#description' => t('Set the width of each sidebar'), - '#states' => array( - '!visible' => array('input[name="smartphone_landscape_layout"]' => array('value' => 'one_col_stack')), - ), -); - -$form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper']['smartphone_landscape_sidebar_unit'] = array( - '#type' => 'select', - '#title' => t('Unit'), - '#default_value' => at_get_setting('smartphone_landscape_sidebar_unit'), - '#options' => $unit_options, -); - -$form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper']['smartphone_landscape_sidebar_first'] = array( - '#type' => 'textfield', - '#title' => t('First sidebar'), - '#default_value' => check_plain(at_get_setting('smartphone_landscape_sidebar_first')), - '#size' => 4, - '#maxlenght' => 4, - '#states' => array( - 'required' => array('input[name="smartphone_landscape_layout"]' => array('value' => 'one_col_vert')), - ), -); - -$form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper']['smartphone_landscape_sidebar_second'] = array( - '#type' => 'textfield', - '#title' => t('Second sidebar'), - '#default_value' => check_plain(at_get_setting('smartphone_landscape_sidebar_second')), - '#size' => 4, - '#maxlenght' => 4, - '#states' => array( - 'required' => array('input[name="smartphone_landscape_layout"]' => array('value' => 'one_col_vert')), - ), -); - -$form['at-settings']['smartphone']['landscape']['smartphone-landscape-media-queries-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Smartphone Landscape Media Queries'), - '#weight' => 1, - '#attributes' => array( - 'class' => array('at-media-queries'), - ), -); - -$form['at-settings']['smartphone']['landscape']['smartphone-landscape-media-queries-wrapper']['smartphone_landscape_media_query'] = array( - '#type' => 'textfield', - '#title' => t('Media query for this layout'), - '#default_value' => check_plain(at_get_setting('smartphone_landscape_media_query')), - '#description' => t('Do not include @media, it\'s included automatically.'), - '#size' => 100, - '#required' => TRUE, -); - -// Pass hidden values to the sumbit function, these values are required but the user can't change them via the UI -$form['at-settings']['smartphone']['landscape']['hidden']['smartphone_landscape_page_width'] = array( - '#type' => 'hidden', - '#default_value' => check_plain(at_get_setting('smartphone_landscape_page_width')), -); -$form['at-settings']['smartphone']['landscape']['hidden']['smartphone_landscape_page_unit'] = array( - '#type' => 'hidden', - '#default_value' => at_get_setting('smartphone_landscape_page_unit'), -); - - -/********************** - * Smartphone portrait - *********************/ - -$form['at-settings']['smartphone']['portrait'] = array( - '#type' => 'fieldset', - '#title' => t('Portrait'), - '#description' => t('

Portrait smartphone

One column

The smartphone portrait layout always displays in one column with sidebars stacked horizontally below the main content. All widths are always 100%.

'), - '#states' => array( - 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); - -$form['at-settings']['smartphone']['portrait']['smartphone-portrait-media-queries-wrapper'] = array( - '#type' => 'fieldset', - '#title' => t('Smartphone Portrait Media Queries'), - '#weight' => 1, - '#attributes' => array( - 'class' => array('at-media-queries'), - ), -); - -$form['at-settings']['smartphone']['portrait']['smartphone-portrait-media-queries-wrapper']['smartphone_portrait_media_query'] = array( - '#type' => 'textfield', - '#title' => t('Media query for this layout'), - '#default_value' => check_plain(at_get_setting('smartphone_portrait_media_query')), - '#description' => t('Do not include @media, it\'s included automatically.'), - '#size' => 100, -); - -// Pass hidden values to the sumbit function, these values are required but the user can't change them via the UI -$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_page_width'] = array( - '#type' => 'hidden', - '#default_value' => check_plain(at_get_setting('smartphone_portrait_page_width')), -); - -$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_page_unit'] = array( - '#type' => 'hidden', - '#default_value' => at_get_setting('smartphone_portrait_page_unit'), -); - -$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_sidebar_first'] = array( - '#type' => 'hidden', - '#default_value' => check_plain(at_get_setting('smartphone_portrait_sidebar_first')), -); - -$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_sidebar_second'] = array( - '#type' => 'hidden', - '#default_value' => check_plain(at_get_setting('smartphone_portrait_sidebar_second')), -); - -$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_sidebar_unit'] = array( - '#type' => 'hidden', - '#default_value' => check_plain(at_get_setting('smartphone_portrait_sidebar_unit')), -); - -$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_layout'] = array( - '#type' => 'hidden', - '#default_value' => str_replace('-', '_', at_get_setting('smartphone_portrait_layout')), -); + ); + + $form['at-settings']['smartphone']['portrait']['smartphone-portrait-media-queries-wrapper']['smartphone_portrait_media_query'] = array( + '#type' => 'textfield', + '#title' => t('Media query for this layout'), + '#default_value' => check_plain(at_get_setting('smartphone_portrait_media_query')), + '#description' => t('Do not include @media, it\'s included automatically.'), + '#size' => 100, + ); + + // Pass hidden values to the sumbit function, these values are required but the user can't change them via the UI + $form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_page_width'] = array( + '#type' => 'hidden', + '#default_value' => check_plain(at_get_setting('smartphone_portrait_page_width')), + ); + + $form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_page_unit'] = array( + '#type' => 'hidden', + '#default_value' => at_get_setting('smartphone_portrait_page_unit'), + ); + + $form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_sidebar_first'] = array( + '#type' => 'hidden', + '#default_value' => check_plain(at_get_setting('smartphone_portrait_sidebar_first')), + ); + + $form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_sidebar_second'] = array( + '#type' => 'hidden', + '#default_value' => check_plain(at_get_setting('smartphone_portrait_sidebar_second')), + ); + + $form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_sidebar_unit'] = array( + '#type' => 'hidden', + '#default_value' => check_plain(at_get_setting('smartphone_portrait_sidebar_unit')), + ); + + $form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_layout'] = array( + '#type' => 'hidden', + '#default_value' => str_replace('-', '_', at_get_setting('smartphone_portrait_layout')), + ); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.polyfills.inc b/at_core/inc/forms/settings.polyfills.inc index d95f191..f066fba 100755 --- a/at_core/inc/forms/settings.polyfills.inc +++ b/at_core/inc/forms/settings.polyfills.inc @@ -7,60 +7,62 @@ * TODO: review documentation and provide links to help pages. */ -$form['at-settings']['polyfills'] = array( - '#type' => 'fieldset', - '#title' => t('Polyfills'), - '#description' => t('

Polyfills

Here you can enable commonly used Polyfills supplied with the core theme. Adaptivetheme also supports loading scripts and CSS for Internet Explorer using your sub-themes info file.', array('!docspage' => 'http://adaptivethemes.com/documentation/ie-styles-and-scripts')), -); +function at_core_polyfills_form(&$form, $theme_name) { + $form['at-settings']['polyfills'] = array( + '#type' => 'fieldset', + '#title' => t('Polyfills'), + '#description' => t('

Polyfills

Here you can enable commonly used Polyfills supplied with the core theme. Adaptivetheme also supports loading scripts and CSS for Internet Explorer using your sub-themes info file.', array('!docspage' => 'http://adaptivethemes.com/documentation/ie-styles-and-scripts')), + ); -$form['at-settings']['polyfills']['fills'] = array( - '#type' => 'fieldset', - '#title' => t('Polyfills'), -); + $form['at-settings']['polyfills']['fills'] = array( + '#type' => 'fieldset', + '#title' => t('Polyfills'), + ); -// HTML5 shiv -$form['at-settings']['polyfills']['fills']['load_html5js'] = array( - '#type' => 'checkbox', - '#title' => t('HTML5 support in IE'), - '#description' => t('By checking this setting the site will load the html5shiv. Turning this off will be bad news for IE6-8.', array('!html5shiv_link' => '//github.com/aFarkas/html5shiv')), - '#default_value' => at_get_setting('load_html5js'), -); + // HTML5 shiv + $form['at-settings']['polyfills']['fills']['load_html5js'] = array( + '#type' => 'checkbox', + '#title' => t('HTML5 support in IE'), + '#description' => t('By checking this setting the site will load the html5shiv. Turning this off will be bad news for IE6-8.', array('!html5shiv_link' => '//github.com/aFarkas/html5shiv')), + '#default_value' => at_get_setting('load_html5js'), + ); -// OnMediaQuery.js -$script_filepath = '/' . $theme_name . '/scripts/media_queries.js'; -$form['at-settings']['polyfills']['fills']['load_onmediaqueryjs'] = array( - '#type' => 'checkbox', - '#title' => t('Responsive JavaScript beta'), - '#description' => t('Load the JS Media Queries plugin to enable responsive JavaScript. See @script_filepath for instructions on how to use. This is an alternative to using matchMedia and hard coding breakpoints in JavaScript. This is bleeding edge and must be considered beta, but its wickedly cool, and useful.', array('!onmediaquery_link' => '//github.com/JoshBarr/js-media-queries', '@script_filepath' => $script_filepath)), - '#default_value' => at_get_setting('load_onmediaqueryjs'), -); + // OnMediaQuery.js + $script_filepath = '/' . $theme_name . '/scripts/media_queries.js'; + $form['at-settings']['polyfills']['fills']['load_onmediaqueryjs'] = array( + '#type' => 'checkbox', + '#title' => t('Responsive JavaScript beta'), + '#description' => t('Load the JS Media Queries plugin to enable responsive JavaScript. See @script_filepath for instructions on how to use. This is an alternative to using matchMedia and hard coding breakpoints in JavaScript. This is bleeding edge and must be considered beta, but its wickedly cool, and useful.', array('!onmediaquery_link' => '//github.com/JoshBarr/js-media-queries', '@script_filepath' => $script_filepath)), + '#default_value' => at_get_setting('load_onmediaqueryjs'), + ); -// Rounding error fix (CSS) -$form['at-settings']['polyfills']['fills']['load_ltie8css'] = array( - '#type' => 'checkbox', - '#title' => t('Fix CSS rounding errors in IE6-7'), - '#description' => t('Load a stylesheet that fixes percentage rounding errors in IE6-7. You need this if you are using Gpanels or Panels layouts.'), - '#default_value' => at_get_setting('load_ltie8css'), -); + // Rounding error fix (CSS) + $form['at-settings']['polyfills']['fills']['load_ltie8css'] = array( + '#type' => 'checkbox', + '#title' => t('Fix CSS rounding errors in IE6-7'), + '#description' => t('Load a stylesheet that fixes percentage rounding errors in IE6-7. You need this if you are using Gpanels or Panels layouts.'), + '#default_value' => at_get_setting('load_ltie8css'), + ); -// Respond.js -$form['at-settings']['polyfills']['fills']['load_respondjs'] = array( - '#type' => 'checkbox', - '#title' => t('Media query support for IE6-8'), - '#description' => t('By checking this setting IE6, 7 and 8 will rely on respond.js to set the layout.', array('!respondjs_link' => '//github.com/scottjehl/Respond')), - '#default_value' => at_get_setting('load_respondjs'), - '#states' => array( - 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); + // Respond.js + $form['at-settings']['polyfills']['fills']['load_respondjs'] = array( + '#type' => 'checkbox', + '#title' => t('Media query support for IE6-8'), + '#description' => t('By checking this setting IE6, 7 and 8 will rely on respond.js to set the layout.', array('!respondjs_link' => '//github.com/scottjehl/Respond')), + '#default_value' => at_get_setting('load_respondjs'), + '#states' => array( + 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); -// Scalefix -$form['at-settings']['polyfills']['fills']['load_scalefixjs'] = array( - '#type' => 'checkbox', - '#title' => t('Scalefix for iOS'), - '#description' => t('Fixes the iOS Orientationchange zoom bug.'), - '#default_value' => at_get_setting('load_scalefixjs'), - '#states' => array( - 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); + // Scalefix + $form['at-settings']['polyfills']['fills']['load_scalefixjs'] = array( + '#type' => 'checkbox', + '#title' => t('Scalefix for iOS'), + '#description' => t('Fixes the iOS Orientationchange zoom bug.'), + '#default_value' => at_get_setting('load_scalefixjs'), + '#states' => array( + 'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), + ); +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.responsivepanels.inc b/at_core/inc/forms/settings.responsivepanels.inc index e41a565..19d5e4d 100755 --- a/at_core/inc/forms/settings.responsivepanels.inc +++ b/at_core/inc/forms/settings.responsivepanels.inc @@ -5,151 +5,153 @@ * Generate form elments for the Panel and Gpanel Reponsive Layout settings. */ -// Supported devices -$devices = array( - 'bigscreen', - 'tablet_landscape', - 'tablet_portrait', - 'smartphone_landscape', -); - -// Get the configuration array for panel layouts -$rpl = responsive_panels_data_structure(); - -// Check if panels exists -$panels = module_exists('panels') ? TRUE : FALSE; - -// Set variables here for active Gpanels, we need to test on this later -$active_gpanels = array(); -$active_gpanels_arrays = array(); - -// Get the active themes info array -$info_array = at_get_info($theme_name); - -// Build a keyed array of the regions, we need to reset the keys for -// array_intersect() to figure out which Gpanels are being used -foreach ($info_array['regions'] as $key => $value) { - $theme_regions[] = $key; -} - -// Get the standard Gpanel regions list -$gpanel_regions = gpanel_regions(); - -// Figure out which gpanels are actually being used in the theme -$active_gpanels = array(); -foreach ($gpanel_regions as $gpanel => $gpanel_array) { - if (array_intersect($theme_regions, $gpanel_array['regions'])) { - $active_gpanels[] = $gpanel; - $active_gpanels_arrays[] = $gpanel_array; +function at_core_responsive_panels_form(&$form, $theme_name) { + // Supported devices + $devices = array( + 'bigscreen', + 'tablet_landscape', + 'tablet_portrait', + 'smartphone_landscape', + ); + + // Get the configuration array for panel layouts + $rpl = responsive_panels_data_structure(); + + // Check if panels exists + $panels = module_exists('panels') ? TRUE : FALSE; + + // Set variables here for active Gpanels, we need to test on this later + $active_gpanels = array(); + $active_gpanels_arrays = array(); + + // Get the active themes info array + $info_array = at_get_info($theme_name); + + // Build a keyed array of the regions, we need to reset the keys for + // array_intersect() to figure out which Gpanels are being used + foreach ($info_array['regions'] as $key => $value) { + $theme_regions[] = $key; + } + + // Get the standard Gpanel regions list + $gpanel_regions = gpanel_regions(); + + // Figure out which gpanels are actually being used in the theme + $active_gpanels = array(); + foreach ($gpanel_regions as $gpanel => $gpanel_array) { + if (array_intersect($theme_regions, $gpanel_array['regions'])) { + $active_gpanels[] = $gpanel; + $active_gpanels_arrays[] = $gpanel_array; + } } -} -// Make certain we only list each Gpanel once -array_unique($active_gpanels); + // Make certain we only list each Gpanel once + array_unique($active_gpanels); -// Make a list of all active Gpanel titles, if any -$used_gpanels = ''; -if (!empty($active_gpanels)) { - foreach ($active_gpanels_arrays as $active_gpanel) { - $gpanels_titles[] = $active_gpanel['title']; + // Make a list of all active Gpanel titles, if any + $used_gpanels = ''; + if (!empty($active_gpanels)) { + foreach ($active_gpanels_arrays as $active_gpanel) { + $gpanels_titles[] = $active_gpanel['title']; + } + $used_gpanels = t('

Your theme currently uses these Gpanels:

!used_gpanels', array('!used_gpanels' => theme('item_list', array('items' => $gpanels_titles)))); } - $used_gpanels = t('

Your theme currently uses these Gpanels:

!used_gpanels', array('!used_gpanels' => theme('item_list', array('items' => $gpanels_titles)))); -} - -// Get all standard Plugin layout names -foreach ($rpl as $rpl_key => $values) { - foreach ($values as $value) { - foreach ($value as $k => $v) { - $active_rpl[] = $v['theme']; - $active_types[] = $v['type']; + + // Get all standard Plugin layout names + foreach ($rpl as $rpl_key => $values) { + foreach ($values as $value) { + foreach ($value as $k => $v) { + $active_rpl[] = $v['theme']; + $active_types[] = $v['type']; + } } } -} - -// This is will not be sustaintable, what I need is a function that sorts the -// layouts properly, alphabetical is no good, it needs to be in a very precise -// order to make sense in the UI. -if (isset($rpl['one'])) { - unset($rpl['one']); -} -if (isset($rpl['six'])) { - $six = $rpl['six']; unset($rpl['six']); $rpl['six'] = $six; -} -if (isset($rpl['inset'])) { - $inset = $rpl['inset']; unset($rpl['inset']); $rpl['inset'] = $inset; -} - -// Get the admin css files for each plugin -$panels_admin_css_files = responsive_plugins_admin_css($theme_name, $plugin_type = 'panels'); -foreach ($panels_admin_css_files as $filepath) { - if (file_exists($filepath)) { - $panels_css_files['css'][] = array('type' => 'file', 'data' => $filepath, 'weight' => 100); + + // This is will not be sustaintable, what I need is a function that sorts the + // layouts properly, alphabetical is no good, it needs to be in a very precise + // order to make sense in the UI. + if (isset($rpl['one'])) { + unset($rpl['one']); } -} - -// Set title and message -$panels_title = t('Panels & Gpanels'); -$panels_message = t('

!panels_title

Adaptivetheme supports responsive Panels and Gpanel layouts. To use this capability you can use the Panels module, Display Suite (with Panels) or Adaptivethemes native Gpanels layouts. To views all layouts on one page and test your settings you can enable the panels test, see the Debuggers tab.

Usage: select options for each device range and layout type.

!gpanels_message', array('!panels_title' => $panels_title, '!panels_link' => 'http://drupal.org/project/panels', '!gpanels_link' => 'http://adaptivethemes.com/documentation/using-gpanels', '!ds_link' => 'http://drupal.org/project/ds', '!gpanels_message' => $used_gpanels)); - -// Gpanels and Panels top level wrapper -$form['at-settings']['panels'] = array( - '#type' => 'fieldset', - '#title' => $panels_title, - '#description' => $panels_message, - '#attached' => $panels_css_files, -); - -// Disabled message -$panels_disable_message = t('

The responsive layout is disabled, only the default layout for each Gpanel and Panel layout will be used.

To re-enable uncheck the "Disable responsive layout and styles" checkbox under the "Settings" tab.

'); - -if(at_get_setting('disable_responsive_styles') === 1) { - $form['at-settings']['panels']['disabled'] = array( - '#markup' => '
' . $panels_disable_message . '
', + if (isset($rpl['six'])) { + $six = $rpl['six']; unset($rpl['six']); $rpl['six'] = $six; + } + if (isset($rpl['inset'])) { + $inset = $rpl['inset']; unset($rpl['inset']); $rpl['inset'] = $inset; + } + + // Get the admin css files for each plugin + $panels_admin_css_files = responsive_plugins_admin_css($theme_name, $plugin_type = 'panels'); + foreach ($panels_admin_css_files as $filepath) { + if (file_exists($filepath)) { + $panels_css_files['css'][] = array('type' => 'file', 'data' => $filepath, 'weight' => 100); + } + } + + // Set title and message + $panels_title = t('Panels & Gpanels'); + $panels_message = t('

!panels_title

Adaptivetheme supports responsive Panels and Gpanel layouts. To use this capability you can use the Panels module, Display Suite (with Panels) or Adaptivethemes native Gpanels layouts. To views all layouts on one page and test your settings you can enable the panels test, see the Debuggers tab.

Usage: select options for each device range and layout type.

!gpanels_message', array('!panels_title' => $panels_title, '!panels_link' => 'http://drupal.org/project/panels', '!gpanels_link' => 'http://adaptivethemes.com/documentation/using-gpanels', '!ds_link' => 'http://drupal.org/project/ds', '!gpanels_message' => $used_gpanels)); + + // Gpanels and Panels top level wrapper + $form['at-settings']['panels'] = array( + '#type' => 'fieldset', + '#title' => $panels_title, + '#description' => $panels_message, + '#attached' => $panels_css_files, ); -} - -$form['at-settings']['panels']['panels-wrapper'] = array( - '#type' => 'fieldset', - '#attributes' => array('class' => array('panel-option-lists')), - '#states' => array( - 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), - ), -); - -foreach ($devices as $device) { - $title = str_replace('_', ' ', drupal_ucfirst($device)); - if ($device == 'bigscreen') { - $title = 'Standard layout'; + + // Disabled message + $panels_disable_message = t('

The responsive layout is disabled, only the default layout for each Gpanel and Panel layout will be used.

To re-enable uncheck the "Disable responsive layout and styles" checkbox under the "Settings" tab.

'); + + if(at_get_setting('disable_responsive_styles') === 1) { + $form['at-settings']['panels']['disabled'] = array( + '#markup' => '
' . $panels_disable_message . '
', + ); } - $form['at-settings']['panels']['panels-wrapper'][$device] = array( + + $form['at-settings']['panels']['panels-wrapper'] = array( '#type' => 'fieldset', - '#title' => t($title), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#description' => t('Select the layouts you want to use when the site is being viewed in !device.', array('!device' => strtolower($title))), + '#attributes' => array('class' => array('panel-option-lists')), + '#states' => array( + 'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)), + ), ); - if (isset($rpl)) { - foreach ($rpl as $group => $layouts) { - if (!empty($layouts)) { - $form['at-settings']['panels']['panels-wrapper'][$device][$group] = array( - '#type' => 'fieldset', - '#title' => t($group), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ); - foreach ($layouts as $layout) { - foreach ($layout as $key => $value) { - if (isset($value['theme'])) { - $form['at-settings']['panels']['panels-wrapper'][$device][$group][$device . '_' . $value['theme']] = array( - '#type' => 'radios', - '#title' => t($value['title']), - '#default_value' => at_get_setting($device . '_' . $value['theme']), - '#options' => $value['options'], - ); + + foreach ($devices as $device) { + $title = str_replace('_', ' ', drupal_ucfirst($device)); + if ($device == 'bigscreen') { + $title = 'Standard layout'; + } + $form['at-settings']['panels']['panels-wrapper'][$device] = array( + '#type' => 'fieldset', + '#title' => t($title), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#description' => t('Select the layouts you want to use when the site is being viewed in !device.', array('!device' => strtolower($title))), + ); + if (isset($rpl)) { + foreach ($rpl as $group => $layouts) { + if (!empty($layouts)) { + $form['at-settings']['panels']['panels-wrapper'][$device][$group] = array( + '#type' => 'fieldset', + '#title' => t($group), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + foreach ($layouts as $layout) { + foreach ($layout as $key => $value) { + if (isset($value['theme'])) { + $form['at-settings']['panels']['panels-wrapper'][$device][$group][$device . '_' . $value['theme']] = array( + '#type' => 'radios', + '#title' => t($value['title']), + '#default_value' => at_get_setting($device . '_' . $value['theme']), + '#options' => $value['options'], + ); + } } } } } } } -} +} \ No newline at end of file diff --git a/at_core/inc/forms/settings.touchicons.inc b/at_core/inc/forms/settings.touchicons.inc index e4ddb00..288dd5b 100755 --- a/at_core/inc/forms/settings.touchicons.inc +++ b/at_core/inc/forms/settings.touchicons.inc @@ -1,47 +1,50 @@ 'fieldset', - '#title' => t('Touch Icons'), - '#description' => t('

Touch Icons

Different devices can support different sized touch icons:

  • 57x57 - non-retina iPhone, iPod Touch, Nokia and Android 2.1+ devices
  • 72x72 - first gen iPad
  • 114x114 - iPhone 4 with high-res retina display

Enter the path to each touch icon. Paths must be relative to your theme folder.

'), - '#weight' => 10, -); -$form['at']['ati']['icon-paths'] = array( - '#type' => 'fieldset', - '#title' => t('Touch Icons'), -); + /** + * @file + * Generate form elments for the Apple touch icons settings. + */ -// Low -$form['at']['ati']['icon-paths']['apple_touch_icon_path_l'] = array( - '#type' => 'textfield', - '#title' => t('57x57'), - '#description' => t('If you only enter a path for this size it will be used by all devices.'), - '#field_prefix' => $theme_name . '/', - '#default_value' => check_plain(at_get_setting('apple_touch_icon_path_l')), - '#states' => array( - 'required' => array('input[name="enable_apple_touch_icons"]' => array('checked' => TRUE)), - ), -); + $form['at']['ati'] = array( + '#type' => 'fieldset', + '#title' => t('Touch Icons'), + '#description' => t('

Touch Icons

Different devices can support different sized touch icons:

  • 57x57 - non-retina iPhone, iPod Touch, Nokia and Android 2.1+ devices
  • 72x72 - first gen iPad
  • 114x114 - iPhone 4 with high-res retina display

Enter the path to each touch icon. Paths must be relative to your theme folder.

'), + '#weight' => 10, + ); + $form['at']['ati']['icon-paths'] = array( + '#type' => 'fieldset', + '#title' => t('Touch Icons'), + ); -// Medium -$form['at']['ati']['icon-paths']['apple_touch_icon_path_m'] = array( - '#type' => 'textfield', - '#title' => t('72x72'), - '#description' => t('Apple touch icon for old iPads.'), - '#field_prefix' => $theme_name . '/', - '#default_value' => check_plain(at_get_setting('apple_touch_icon_path_m')), -); + // Low + $form['at']['ati']['icon-paths']['apple_touch_icon_path_l'] = array( + '#type' => 'textfield', + '#title' => t('57x57'), + '#description' => t('If you only enter a path for this size it will be used by all devices.'), + '#field_prefix' => $theme_name . '/', + '#default_value' => check_plain(at_get_setting('apple_touch_icon_path_l')), + '#states' => array( + 'required' => array('input[name="enable_apple_touch_icons"]' => array('checked' => TRUE)), + ), + ); -// High -$form['at']['ati']['icon-paths']['apple_touch_icon_path_h'] = array( - '#type' => 'textfield', - '#title' => t('114x114'), - '#description' => t('Apple touch icon for iPhone 4 with high-res retina display.'), - '#field_prefix' => $theme_name . '/', - '#default_value' => check_plain(at_get_setting('apple_touch_icon_path_h')), -); + // Medium + $form['at']['ati']['icon-paths']['apple_touch_icon_path_m'] = array( + '#type' => 'textfield', + '#title' => t('72x72'), + '#description' => t('Apple touch icon for old iPads.'), + '#field_prefix' => $theme_name . '/', + '#default_value' => check_plain(at_get_setting('apple_touch_icon_path_m')), + ); + + // High + $form['at']['ati']['icon-paths']['apple_touch_icon_path_h'] = array( + '#type' => 'textfield', + '#title' => t('114x114'), + '#description' => t('Apple touch icon for iPhone 4 with high-res retina display.'), + '#field_prefix' => $theme_name . '/', + '#default_value' => check_plain(at_get_setting('apple_touch_icon_path_h')), + ); +} \ No newline at end of file diff --git a/at_core/theme-settings.php b/at_core/theme-settings.php index 5cda217..356a727 100755 --- a/at_core/theme-settings.php +++ b/at_core/theme-settings.php @@ -77,14 +77,20 @@ function adaptivetheme_form_system_theme_settings_alter(&$form, &$form_state, $f ); // Include all the default settings forms. - require_once($path_to_at_core . '/inc/forms/settings.pagelayout.inc'); - require_once($path_to_at_core . '/inc/forms/settings.responsivepanels.inc'); - require_once($path_to_at_core . '/inc/forms/settings.global.inc'); - require_once($path_to_at_core . '/inc/forms/settings.polyfills.inc'); - require_once($path_to_at_core . '/inc/forms/settings.metatags.inc'); - require_once($path_to_at_core . '/inc/forms/settings.debug.inc'); - require_once($path_to_at_core . '/inc/forms/settings.extensions.inc'); - + require($path_to_at_core . '/inc/forms/settings.pagelayout.inc'); + at_core_page_layout_form($form, $theme_name); + require($path_to_at_core . '/inc/forms/settings.responsivepanels.inc'); + at_core_responsive_panels_form($form, $theme_name); + require($path_to_at_core . '/inc/forms/settings.global.inc'); + at_core_global_form($form, $theme_name); + require($path_to_at_core . '/inc/forms/settings.polyfills.inc'); + at_core_polyfills_form($form, $theme_name); + require($path_to_at_core . '/inc/forms/settings.metatags.inc'); + at_core_metatags_form($form); + require($path_to_at_core . '/inc/forms/settings.debug.inc'); + at_core_debug_form($form); + require($path_to_at_core . '/inc/forms/settings.extensions.inc'); + at_core_extensions_form($form); // EXTENSIONS $enable_extensions = isset($form_state['values']['enable_extensions']); if (($enable_extensions && $form_state['values']['enable_extensions'] == 1) || (!$enable_extensions && $form['at-settings']['extend']['enable_extensions']['#default_value'] == 1)) { @@ -132,7 +138,8 @@ function adaptivetheme_form_system_theme_settings_alter(&$form, &$form_state, $f // Touch icons $enable_apple_touch_icons = isset($form_state['values']['enable_apple_touch_icons']); if (($enable_apple_touch_icons && $form_state['values']['enable_apple_touch_icons'] == 1) || (!$enable_apple_touch_icons && $form['at-settings']['extend']['enable']['enable_apple_touch_icons']['#default_value'] == 1)) { - require_once($path_to_at_core . '/inc/forms/settings.touchicons.inc'); + include($path_to_at_core . '/inc/forms/settings.touchicons.inc'); + at_core_touch_icons($form, $theme_name); } // Custom CSS @@ -150,7 +157,8 @@ function adaptivetheme_form_system_theme_settings_alter(&$form, &$form_state, $f // Float Region blocks $enable_float_region_blocks = isset($form_state['values']['enable_float_region_blocks']); if (($enable_float_region_blocks && $form_state['values']['enable_float_region_blocks'] == 1) || (!$enable_float_region_blocks && $form['at-settings']['extend']['enable']['enable_float_region_blocks']['#default_value'] == 1)) { - require_once($path_to_at_core . '/inc/forms/settings.floatregionblocks.inc'); + include($path_to_at_core . '/inc/forms/settings.floatregionblocks.inc'); + at_core_float_regions_blocks_form($form, $info_array); } // Modify output @@ -210,12 +218,12 @@ function adaptivetheme_form_system_theme_settings_alter(&$form, &$form_state, $f $form_settings($form, $form_state); } } + // Include custom form validation and submit functions + include(drupal_get_path('theme', 'adaptivetheme') . '/inc/forms/at_core.validate.inc'); + include(drupal_get_path('theme', 'adaptivetheme') . '/inc/forms/at_core.submit.inc'); // Custom validate and submit functions $form['#validate'][] = 'at_core_settings_validate'; $form['#submit'][] = 'at_core_settings_submit'; } -// Include custom form validation and submit functions -require_once(drupal_get_path('theme', 'adaptivetheme') . '/inc/forms/at_core.validate.inc'); -require_once(drupal_get_path('theme', 'adaptivetheme') . '/inc/forms/at_core.submit.inc');