first import
This commit is contained in:
1086
sites/all/themes/omega/alpha/includes/alpha.inc
Normal file
1086
sites/all/themes/omega/alpha/includes/alpha.inc
Normal file
File diff suppressed because it is too large
Load Diff
266
sites/all/themes/omega/alpha/includes/base.inc
Normal file
266
sites/all/themes/omega/alpha/includes/base.inc
Normal file
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Container class for theme configuration.
|
||||
*/
|
||||
|
||||
class alpha_theme_container {
|
||||
var $theme;
|
||||
var $settings;
|
||||
var $css;
|
||||
var $grid;
|
||||
var $grids;
|
||||
var $libraries;
|
||||
var $sections;
|
||||
var $zones;
|
||||
var $regions;
|
||||
var $page;
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function __construct($theme, $delta = NULL) {
|
||||
$this->theme = $theme;
|
||||
$this->delta = $delta;
|
||||
|
||||
if ($cache = alpha_cache_get($theme, $delta)) {
|
||||
foreach ($cache->data as $key => $item) {
|
||||
$this->$key = $item;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->cacheable() as $item => $required) {
|
||||
if ($required && !isset($this->$item)) {
|
||||
$this->init();
|
||||
|
||||
alpha_alter('alpha_pre_cache', $this, $theme, $delta);
|
||||
alpha_cache_set($this);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
alpha_alter('alpha', $this, $theme, $delta);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function init() {
|
||||
$this->settings();
|
||||
$this->sections();
|
||||
$this->zones();
|
||||
$this->regions();
|
||||
$this->grids();
|
||||
$this->grid();
|
||||
$this->css();
|
||||
$this->libraries();
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function settings() {
|
||||
if (!isset($this->settings)) {
|
||||
$this->settings = array(
|
||||
'grid' => alpha_theme_get_setting('alpha_grid', 'default', $this->theme),
|
||||
'css' => alpha_theme_get_setting('alpha_css', array(), $this->theme),
|
||||
'libraries' => alpha_theme_get_setting('alpha_libraries', array(), $this->theme),
|
||||
'exclude' => alpha_theme_get_setting('alpha_exclude', array(), $this->theme),
|
||||
'responsive' => alpha_theme_get_setting('alpha_responsive', FALSE, $this->theme),
|
||||
'toggle' => array(),
|
||||
'hidden' => array(),
|
||||
'viewport' => array(
|
||||
'enabled' => alpha_theme_get_setting('alpha_viewport', FALSE, $this->theme),
|
||||
'initial' => alpha_theme_get_setting('alpha_viewport_initial_scale', 1, $this->theme),
|
||||
'min' => alpha_theme_get_setting('alpha_viewport_min_scale', 1, $this->theme),
|
||||
'max' => alpha_theme_get_setting('alpha_viewport_max_scale', 1, $this->theme),
|
||||
'user' => alpha_theme_get_setting('alpha_viewport_user_scaleable', TRUE, $this->theme),
|
||||
),
|
||||
'debug' => array(
|
||||
'block' => alpha_theme_get_setting('alpha_debug_block_toggle', FALSE, $this->theme),
|
||||
'block_active' => alpha_theme_get_setting('alpha_debug_block_active', FALSE, $this->theme),
|
||||
'grid' => alpha_theme_get_setting('alpha_debug_grid_toggle', FALSE, $this->theme),
|
||||
'grid_active' => alpha_theme_get_setting('alpha_debug_grid_active', FALSE, $this->theme),
|
||||
'roles' => array_keys(array_filter(alpha_theme_get_setting('alpha_debug_grid_roles', array(), $this->theme))),
|
||||
),
|
||||
);
|
||||
|
||||
foreach (alpha_toggle() as $item => $title) {
|
||||
$this->settings['toggle'][$item] = alpha_theme_get_setting('alpha_toggle_' . $item, TRUE, $this->theme);
|
||||
}
|
||||
|
||||
foreach (alpha_visibility() as $item => $title) {
|
||||
$this->settings['hidden'][$item] = alpha_theme_get_setting('alpha_hidden_' . $item, FALSE, $this->theme);
|
||||
}
|
||||
|
||||
alpha_alter('alpha_settings', $this->settings, $this->theme);
|
||||
}
|
||||
|
||||
return $this->settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function grids() {
|
||||
if (!isset($this->grids)) {
|
||||
$this->settings();
|
||||
$this->grids = alpha_retrieve_grids($this->theme);
|
||||
}
|
||||
|
||||
return $this->grids;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function grid() {
|
||||
if (!isset($this->grid)) {
|
||||
$this->grids();
|
||||
|
||||
if (isset($this->grids[$this->settings['grid']])) {
|
||||
$this->grid = alpha_grid_css($this->theme, $this->grids[$this->settings['grid']], $this->settings['responsive']);
|
||||
}
|
||||
else {
|
||||
$this->grid = array();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->grid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function css() {
|
||||
if (!isset($this->css)) {
|
||||
$this->css = alpha_retrieve_css($this->theme);
|
||||
}
|
||||
|
||||
return $this->css;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function libraries() {
|
||||
if (!isset($this->libraries)) {
|
||||
$this->libraries = alpha_retrieve_libraries($this->theme);
|
||||
}
|
||||
|
||||
return $this->libraries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function sections() {
|
||||
if (!isset($this->sections)) {
|
||||
$this->sections = array(
|
||||
'header' => t('Header'),
|
||||
'content' => t('Content'),
|
||||
'footer' => t('Footer'),
|
||||
);
|
||||
}
|
||||
|
||||
return $this->sections;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function zones() {
|
||||
if (!isset($this->zones)) {
|
||||
$this->sections();
|
||||
$this->zones = array();
|
||||
|
||||
if ($zones = alpha_info('zones', $this->theme)) {
|
||||
foreach ($zones as $zone => $title) {
|
||||
$section = alpha_zone_get_setting('section', $zone, NULL, $this->theme);
|
||||
$section = isset($this->sections[$section]) ? $section : NULL;
|
||||
|
||||
$this->zones[$zone] = array(
|
||||
'zone' => $zone,
|
||||
'name' => $title,
|
||||
'enabled' => isset($this->sections[$section]),
|
||||
'force' => alpha_zone_get_setting('force', $zone, FALSE, $this->theme),
|
||||
'columns' => alpha_zone_get_setting('columns', $zone, 0, $this->theme),
|
||||
'section' => $section,
|
||||
'weight' => alpha_zone_get_setting('weight', $zone, 0, $this->theme),
|
||||
'wrapper' => alpha_zone_get_setting('wrapper', $zone, FALSE, $this->theme),
|
||||
'wrapper_css' => alpha_zone_get_setting('wrapper_css', $zone, NULL, $this->theme),
|
||||
'primary' => alpha_zone_get_setting('primary', $zone, NULL, $this->theme),
|
||||
'order' => alpha_zone_get_setting('order', $zone, FALSE, $this->theme),
|
||||
'css' => alpha_zone_get_setting('css', $zone, NULL, $this->theme),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
uasort($this->zones, 'drupal_sort_weight');
|
||||
alpha_alter('alpha_zones', $this->zones, $this->theme);
|
||||
}
|
||||
|
||||
return $this->zones;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function regions() {
|
||||
if (!isset($this->regions)) {
|
||||
$this->zones();
|
||||
$this->sections();
|
||||
$this->regions = array();
|
||||
$exclude = alpha_regions_exclude();
|
||||
|
||||
foreach (system_region_list($this->theme) as $region => $title) {
|
||||
if (!in_array($region, $exclude)) {
|
||||
$zone = alpha_region_get_setting('zone', $region, NULL, $this->theme);
|
||||
$prefix = alpha_region_get_setting('prefix', $region, 0, $this->theme);
|
||||
$columns = alpha_region_get_setting('columns', $region, 1, $this->theme);
|
||||
$suffix = alpha_region_get_setting('suffix', $region, 0, $this->theme);
|
||||
|
||||
$zone = isset($zone) && isset($this->zones[$zone]) ? $zone : NULL;
|
||||
$section = isset($zone) && isset($this->zones[$zone]['section']) ? $this->zones[$zone]['section'] : NULL;
|
||||
|
||||
$this->regions[$region] = array(
|
||||
'region' => $region,
|
||||
'name' => $title,
|
||||
'zone' => $zone,
|
||||
'section' => $section,
|
||||
'enabled' => isset($zone),
|
||||
'force' => alpha_region_get_setting('force', $region, FALSE, $this->theme),
|
||||
'prefix' => $prefix,
|
||||
'columns' => $columns,
|
||||
'suffix' => $suffix,
|
||||
'width' => $prefix + $columns + $suffix,
|
||||
'push' => 0,
|
||||
'pull' => 0,
|
||||
'wrapper_css' => alpha_region_get_setting('css', $region, NULL, $this->theme),
|
||||
'weight' => alpha_region_get_setting('weight', $region, 0, $this->theme),
|
||||
'position' => alpha_region_get_setting('position', $region, 0, $this->theme),
|
||||
'primary' => isset($zone) && $this->zones[$zone]['primary'] == $region,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
uasort($this->regions, 'drupal_sort_weight');
|
||||
alpha_alter('alpha_regions', $this->regions, $this->theme);
|
||||
}
|
||||
|
||||
return $this->regions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function cacheable() {
|
||||
$cacheable = array_fill_keys(array('settings', 'libraries', 'css', 'grids', 'grid', 'regions', 'zones', 'sections'), TRUE);
|
||||
|
||||
alpha_alter('alpha_cacheable', $cacheable, $this->theme);
|
||||
|
||||
return $cacheable;
|
||||
}
|
||||
}
|
285
sites/all/themes/omega/alpha/includes/theme-settings-general.inc
Normal file
285
sites/all/themes/omega/alpha/includes/theme-settings-general.inc
Normal file
@@ -0,0 +1,285 @@
|
||||
<?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],
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Theme settings for regions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function alpha_theme_settings_structure(&$form, &$form_state) {
|
||||
$theme = alpha_get_theme();
|
||||
$containers = isset($theme->grids[$theme->settings['grid']]) ? alpha_container_options($theme->grids[$theme->settings['grid']]) : array();
|
||||
$options = alpha_zone_options($theme->zones);
|
||||
$columns = $spacing = !empty($containers) ? alpha_column_options(max(array_keys($containers))) : array();
|
||||
|
||||
unset($columns[0]);
|
||||
array_pop($spacing);
|
||||
|
||||
$form['alpha_settings']['structure'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Zone and region configuration'),
|
||||
'#weight' => -8,
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure']['__unassigned__'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Unassigned zones'),
|
||||
'#description' => t('There are no unassigned zones.'),
|
||||
'#weight' => 100,
|
||||
'#attributes' => array(
|
||||
'class' => array('alpha-unassigned'),
|
||||
),
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure']['__unassigned__']['__unassigned__']['regions'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Unassigned regions'),
|
||||
'#description' => t('There are no unassigned regions.'),
|
||||
'#weight' => 100,
|
||||
'#attributes' => array(
|
||||
'class' => array('alpha-unassigned'),
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($theme->sections as $section => $name) {
|
||||
$form['alpha_settings']['structure'][$section] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => $name . ' ' . t('Section'),
|
||||
'#description' => t('This section is empty.'),
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($theme->zones as $zone => $item) {
|
||||
$section = $item['enabled'] ? $item['section'] : '__unassigned__';
|
||||
|
||||
unset($form['alpha_settings']['structure'][$section]['#description']);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => $item['name'] . ' ' . t('Zone'),
|
||||
'#weight' => $item['weight'],
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Configuration'),
|
||||
'#weight' => -999,
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
'#attributes' => array(
|
||||
'class' => array('alpha-inline'),
|
||||
),
|
||||
);
|
||||
|
||||
// Provide a full width wrapper around the zone (allowing for design elements outside the grid)
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone']['alpha_zone_' . $zone . '_wrapper'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Provide full width wrapper around this zone'),
|
||||
'#description' => t('Enabling this feature will give a <div> wrapper around the zone itself, allowing you to theme in elements that appear outside the 960 pixel container zone.'),
|
||||
'#default_value' => $item['wrapper'],
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone']['alpha_zone_' . $zone . '_force'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Force this zone to be rendered'),
|
||||
'#description' => t('Enabling this will always render this zone, even if it is empty.'),
|
||||
'#default_value' => $item['force'],
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone']['alpha_zone_' . $zone . '_order'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Customize the region positioning'),
|
||||
'#description' => t('This allows you to manipulate the placing of the regions in this zone.'),
|
||||
'#default_value' => $item['order'],
|
||||
'#element_validate' => array('alpha_theme_settings_validate_order'),
|
||||
'#zone' => $zone,
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone']['alpha_zone_' . $zone . '_section'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Section'),
|
||||
'#default_value' => $item['section'],
|
||||
'#element_validate' => array('alpha_theme_settings_validate_not_empty'),
|
||||
'#options' => array('_none' => '- None -') + $theme->sections,
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone']['alpha_zone_' . $zone . '_weight'] = array(
|
||||
'#type' => 'weight',
|
||||
'#title' => t('Weight'),
|
||||
'#default_value' => $item['weight'],
|
||||
);
|
||||
|
||||
// Create a container width selection menu for EACH zone
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone']['alpha_zone_' . $zone . '_columns'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Column count'),
|
||||
'#default_value' => $item['columns'],
|
||||
'#options' => $containers,
|
||||
);
|
||||
|
||||
// Decide which region is the primary item.
|
||||
// The primary region is the one that will absorb the size of empty regions that are related in the same zone.
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone']['alpha_zone_' . $zone . '_primary'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Primary Region'),
|
||||
'#default_value' => $item['primary'],
|
||||
'#options' => array('_none' => t('- None -')) + alpha_zone_regions($zone, $theme->regions),
|
||||
'#element_validate' => array('alpha_theme_settings_validate_not_empty', 'alpha_theme_settings_validate_primary'),
|
||||
'#zone' => $zone,
|
||||
);
|
||||
|
||||
// Allow for zone classes
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone']['alpha_zone_' . $zone . '_css'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Additional zone classes'),
|
||||
'#size' => 60,
|
||||
'#default_value' => $item['css'],
|
||||
);
|
||||
|
||||
// Allow for zone wrapper classes
|
||||
$form['alpha_settings']['structure'][$section][$zone]['zone']['alpha_zone_' . $zone . '_wrapper_css'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Additional wrapper classes'),
|
||||
'#size' => 60,
|
||||
'#default_value' => $item['wrapper_css'],
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
':input[name="alpha_zone_' . $zone . '_wrapper"]' => array('checked' => TRUE),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Regions'),
|
||||
'#description' => t('This zone is empty.'),
|
||||
'#weight' => $item['weight'],
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
}
|
||||
|
||||
foreach($theme->regions as $region => $item) {
|
||||
$zone = $item['enabled'] ? $item['zone'] : '__unassigned__';
|
||||
$section = $item['enabled'] && $theme->zones[$item['zone']]['enabled'] ? $item['section'] : '__unassigned__';
|
||||
|
||||
unset($form['alpha_settings']['structure'][$section][$zone]['regions']['#description']);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'][$region] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => $item['name'],
|
||||
'#weight' => $item['weight'],
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
'#attributes' => array(
|
||||
'class' => array('alpha-inline'),
|
||||
),
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'][$region]['alpha_region_' . $region . '_force'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Force this region to be rendered'),
|
||||
'#description' => t('Enabling this will always render this region, even if it is empty.'),
|
||||
'#default_value' => $item['force'],
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'][$region]['alpha_region_' . $region . '_zone'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Zone'),
|
||||
'#default_value' => !empty($item['zone']) ? $item['zone'] : array('_none'),
|
||||
'#element_validate' => array('alpha_theme_settings_validate_not_empty'),
|
||||
'#options' => array('_none' => '- None -') + $options,
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'][$region]['alpha_region_' . $region . '_prefix'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Prefix'),
|
||||
'#default_value' => $item['prefix'],
|
||||
'#options' => $spacing,
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'][$region]['alpha_region_' . $region . '_columns'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Width'),
|
||||
'#default_value' => $item['columns'],
|
||||
'#options' => $columns,
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'][$region]['alpha_region_' . $region . '_suffix'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Suffix'),
|
||||
'#default_value' => $item['suffix'],
|
||||
'#options' => $spacing,
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'][$region]['alpha_region_' . $region . '_weight'] = array(
|
||||
'#type' => 'weight',
|
||||
'#delta' => 50,
|
||||
'#title' => t('Weight'),
|
||||
'#default_value' => $item['weight'],
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'][$region]['alpha_region_' . $region . '_position'] = array(
|
||||
'#type' => 'weight',
|
||||
'#delta' => 50,
|
||||
'#title' => t('Position'),
|
||||
'#default_value' => $item['position'],
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
':input[name="alpha_zone_' . $zone . '_order"]' => array('checked' => TRUE),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$form['alpha_settings']['structure'][$section][$zone]['regions'][$region]['alpha_region_' . $region . '_css'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Additional region classes'),
|
||||
'#size' => 50,
|
||||
'#default_value' => $item['wrapper_css'],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user