123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- <?php
- /**
- * @file
- * General theme settings elements.
- */
- /**
- * @todo
- */
- function alpha_theme_settings_general(&$form, &$form_state) {
- $theme = alpha_get_theme();
- $scales = alpha_scale_options(1, 10, 0.5);
- $optional = alpha_css_options($theme->css);
- $libraries = alpha_library_options($theme->libraries);
- $exclude = alpha_exclude_options($theme->theme);
- $toggle = alpha_toggle();
-
- $form['alpha_settings']['layout'] = array(
- '#type' => 'fieldset',
- '#weight' => -10,
- '#title' => t('Grid settings'),
- );
- $form['alpha_settings']['layout']['alpha_grid'] = array(
- '#type' => 'select',
- '#description' => t('Select the grid system that you want to use for this layout.'),
- '#title' => t('Grid system'),
- '#default_value' => $theme->settings['grid'],
- '#options' => alpha_grid_options($theme->grids),
- );
-
- $form['alpha_settings']['layout']['responsive_settings'] = array(
- '#type' => 'fieldset',
- '#title' => t('Responsive settings'),
- );
-
- $form['alpha_settings']['layout']['responsive_settings']['alpha_responsive'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable the responsive grid'),
- '#description' => t('Enabling this will unleash the responsive layout features that come with Alpha & Omega. It also helps you to clean your appartment and wash your dishes.'),
- '#default_value' => $theme->settings['responsive'],
- );
-
- $form['alpha_settings']['layout']['responsive_settings']['alpha_viewport'] = array(
- '#type' => 'checkbox',
- '#title' => t('Allow customizing viewport meta properties on iOS and Android devices'),
- '#description' => t('By default, most mobile browsers choose their own way to handle page rendering by using the viewport meta tag. iOS and Android are "capable" of displaying full size websites by simply scaling down the view. However, when using a truly mobile version of your theme, you will / may want to customize these settings. You can find more information about this in the <a href="http://drupal.org/node/819164">Omega documentation</a>.'),
- '#default_value' => $theme->settings['viewport']['enabled'],
- '#states' => array(
- 'visible' => array(
- ':input[name="alpha_responsive"]' => array('checked' => TRUE),
- ),
- ),
- );
-
- $form['alpha_settings']['layout']['responsive_settings']['viewport_settings'] = array(
- '#type' => 'fieldset',
- '#title' => t('Viewport settings'),
- '#states' => array(
- 'visible' => array(
- ':input[name="alpha_viewport"]' => array('checked' => TRUE),
- ':input[name="alpha_responsive"]' => array('checked' => TRUE),
- ),
- ),
- );
-
- $form['alpha_settings']['layout']['responsive_settings']['viewport_settings']['alpha_viewport_initial_scale'] = array(
- '#type' => 'select',
- '#title' => t('Initial scale'),
- '#default_value' => $theme->settings['viewport']['initial'],
- '#options' => $scales,
- '#description' => t('The initial scaling of the page. This should almost always be set to 1.0.'),
- );
- $form['alpha_settings']['layout']['responsive_settings']['viewport_settings']['alpha_viewport_min_scale'] = array(
- '#type' => 'select',
- '#title' => t('Minimum scale'),
- '#default_value' => $theme->settings['viewport']['min'],
- '#options' => $scales,
- '#description' => t('The minimum scaling of the site. This should usually be the same as your <em>Initial scale</em> setting.'),
- );
- $form['alpha_settings']['layout']['responsive_settings']['viewport_settings']['alpha_viewport_max_scale'] = array(
- '#type' => 'select',
- '#title' => t('Maximum scale'),
- '#default_value' => $theme->settings['viewport']['max'],
- '#options' => $scales,
- '#description' => t('The maximum scaling of the site. This can be any value between 1 and 10, but should not be too big if you want to preserve your mobile look and feel.'),
- );
- $form['alpha_settings']['layout']['responsive_settings']['viewport_settings']['alpha_viewport_user_scaleable'] = array(
- '#type' => 'checkbox',
- '#title' => t('Scalable by user'),
- '#description' => t('<p>Determine if a user can resize the screen. This is usually accomplished via multi-touch gestures on iOS and Android devices. If your mobile theme is very customized and presented with good typography and graphics for a reduced mobile size, it is recommended to leave this setting unchecked. If it is left unchecked, the min-scale and max-scale properties will be ignored.</p><p class="marker">HTC Android devices do NOT (currently) respect the viewport meta tag for <em>user-scalable</em>. It will render at the appropriate <em>initial-scale</em> set above, but a user can still zoom in/out.</p>'),
- '#default_value' => $theme->settings['viewport']['user'],
- );
-
- foreach ($theme->grids as $grid => $info) {
- $form['alpha_settings']['layout']['grid_layouts'][$grid] = array(
- '#type' => 'fieldset',
- '#title' => t('@grid layout settings', array('@grid' => $info['name'])),
- '#states' => array(
- 'visible' => array(
- ':input[name="alpha_grid"]' => array('value' => $grid),
- ),
- ),
- );
-
- $form['alpha_settings']['layout']['grid_layouts'][$grid]['alpha_primary_' . $grid] = array(
- '#type' => 'select',
- '#title' => t('Primary layout'),
- '#default_value' => $info['primary'],
- '#options' => alpha_grid_layouts_options($theme->grids[$grid]),
- '#description' => t('The primary layout will be used in case you disable the "responsive grid" option aswell as for older versions of Internet Explorer.'),
- );
-
- foreach ($info['layouts'] as $layout => $data) {
- $form['alpha_settings']['layout']['grid_layouts'][$grid][$layout] = array(
- '#type' => 'fieldset',
- '#title' => t('@layout layout', array('@layout' => $data['name'])),
- '#states' => array(
- 'visible' => array(
- ':input[name="alpha_responsive"]' => array('checked' => TRUE),
- ),
- ),
- );
- $form['alpha_settings']['layout']['grid_layouts'][$grid][$layout]['alpha_layouts_' . $grid . '_' . $layout . '_responsive'] = array(
- '#type' => 'checkbox',
- '#title' => t('Use this layout with the responsive grid'),
- '#default_value' => $data['enabled'],
- );
-
- $form['alpha_settings']['layout']['grid_layouts'][$grid][$layout]['alpha_layouts_' . $grid . '_' . $layout . '_weight'] = array(
- '#type' => 'weight',
- '#title' => t('Weight'),
- '#description' => t('The weight of this layout.'),
- '#default_value' => $data['weight'],
- '#states' => array(
- 'visible' => array(
- ':input[name="alpha_layouts_' . $grid . '_' . $layout . '_responsive"]' => array('checked' => TRUE),
- ),
- ),
- );
-
- $form['alpha_settings']['layout']['grid_layouts'][$grid][$layout]['alpha_layouts_' . $grid . '_' . $layout . '_media'] = array(
- '#type' => 'textfield',
- '#title' => t('Media query'),
- '#description' => t('The @media query that the @layout layout should respond to.', array('@layout' => $data['name'])),
- '#default_value' => $data['media'],
- '#maxlength' => 255,
- '#size' => 140,
- '#states' => array(
- 'visible' => array(
- ':input[name="alpha_layouts_' . $grid . '_' . $layout . '_responsive"]' => array('checked' => TRUE),
- ),
- ),
- );
- }
- }
-
- if (!empty($libraries)) {
- $form['alpha_settings']['alpha_libraries'] = array(
- '#type' => 'fieldset',
- '#title' => t('Toggle libraries'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- );
-
- $form['alpha_settings']['alpha_libraries']['alpha_libraries'] = array(
- '#title' => t('Enable optional libraries'),
- '#description' => t('You can choose from this list to enable optional libraries.'),
- '#type' => 'checkboxes',
- '#options' => $libraries,
- '#default_value' => $theme->settings['libraries'],
- );
- }
-
- $form['alpha_settings']['alpha_styles'] = array(
- '#type' => 'fieldset',
- '#title' => t('Toggle styles'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- );
-
- if (!empty($optional)) {
- $form['alpha_settings']['alpha_styles']['alpha_css'] = array(
- '#title' => t('Enable optional stylesheets'),
- '#description' => t('You can choose from this list to enable optional stylesheets.'),
- '#type' => 'checkboxes',
- '#options' => $optional,
- '#default_value' => $theme->settings['css'],
- );
- }
-
- if (!empty($exclude)) {
- $form['alpha_settings']['alpha_styles']['alpha_exclude'] = array(
- '#title' => t('Disable module and theme stylesheets'),
- '#description' => t('Alpha will remove the selected stylesheets from your pages.'),
- '#type' => 'checkboxes',
- '#options' => $exclude,
- '#default_value' => $theme->settings['exclude'],
- );
- }
-
- $form['alpha_settings']['alpha_debug'] = array(
- '#type' => 'fieldset',
- '#weight' => -6,
- '#title' => t('Debugging'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- );
- $form['alpha_settings']['alpha_debug']['alpha_debug_block_toggle'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable the debugging (placeholder) blocks for the selected roles.'),
- '#default_value' => $theme->settings['debug']['block'],
- );
- $form['alpha_settings']['alpha_debug']['alpha_debug_block_active'] = array(
- '#type' => 'checkbox',
- '#title' => t('Show the debugging blocks by default.'),
- '#description' => t('This will show the debugging blocks on page load.'),
- '#default_value' => $theme->settings['debug']['block_active'],
- '#states' => array(
- 'visible' => array(
- ':input[name="alpha_debug_block_toggle"]' => array('checked' => TRUE),
- ),
- ),
- );
- $form['alpha_settings']['alpha_debug']['alpha_debug_grid_toggle'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable the grid overlay for the selected roles.'),
- '#default_value' => $theme->settings['debug']['grid'],
- );
- $form['alpha_settings']['alpha_debug']['alpha_debug_grid_active'] = array(
- '#type' => 'checkbox',
- '#title' => t('Show the grid overlay by default.'),
- '#description' => t('This will show the grid overlay on page load.'),
- '#default_value' => $theme->settings['debug']['grid_active'],
- '#states' => array(
- 'visible' => array(
- ':input[name="alpha_debug_grid_toggle"]' => array('checked' => TRUE),
- ),
- ),
- );
- $form['alpha_settings']['alpha_debug']['alpha_debug_grid_roles'] = array(
- '#type' => 'checkboxes',
- '#title' => t('Roles that may use the grid overlay and debugging blocks.'),
- '#default_value' => $theme->settings['debug']['roles'],
- '#options' => array_map('check_plain', user_roles()),
- );
-
- $form['alpha_settings']['alpha_toggle'] = array(
- '#type' => 'fieldset',
- '#title' => t('Toggle advanced elements'),
- '#description' => t('Enable or disable the display of certain page elements.'),
- );
-
- foreach ($toggle as $item => $title) {
- $form['alpha_settings']['alpha_toggle']['alpha_toggle_' . $item] = array(
- '#type' => 'checkbox',
- '#title' => $title,
- '#default_value' => $theme->settings['toggle'][$item],
- );
- }
- $form['alpha_settings']['alpha_toggle']['alpha_hidden'] = array(
- '#type' => 'item',
- '#title' => t('Choose from the elements below to hide them via CSS'),
- '#description' => t('This will make the element invisible to normal users while not removing it from the HTML (e.g. for screenreaders).'),
- );
-
- foreach (alpha_visibility() as $item => $title) {
- $form['alpha_settings']['alpha_toggle']['alpha_hidden']['alpha_hidden_' . $item] = array(
- '#type' => 'checkbox',
- '#title' => $title,
- '#default_value' => $theme->settings['hidden'][$item],
- );
- }
- }
|