function _touch_icons_themesettings_radio in Touch Icons 6
Helper function for touch icons theme settings form elements.
Integration with themesettings_ui_extras.module Provides radio buttons for touch icon theme settings.
See also
touch_icons_form_alter()
themesettings_ui_extras_form_alter()
1 call to _touch_icons_themesettings_radio()
- touch_icons_form_system_theme_settings_alter in ./
touch_icons.module - Implementation of hook_form_FORM_ID_alter(). Implementation of hook_form_system_theme_settings_alter().
File
- ./
touch_icons.module, line 193 - Adds a fieldset to theme settings form which allows site administrators to specify Apple Touch icons for Drupal websites. The Touch icon settings behave in a similar manner to the Site Logo and Favicon settings provided by Drupal core.
Code
function _touch_icons_themesettings_radio(&$form, &$form_state, &$settings) {
// javascript behaviour to show/hide custom path and file upload elements
drupal_add_js(drupal_get_path('module', 'touch_icons') . '/touch_icons_themesettings_ui_extras.js');
// deduce which plain touch icon radio-button to pre-select
if ($settings['toggle_touch_icon_plain'] == '0') {
$touch_icon_plain_display_value = 'none';
}
elseif ($settings['toggle_touch_icon_plain'] == 1 && $settings['default_touch_icon_plain'] == 1) {
$touch_icon_plain_display_value = 'default';
}
elseif ($settings['toggle_touch_icon_plain'] == 1 && $settings['default_touch_icon_plain'] == 0) {
$touch_icon_plain_display_value = 'custom';
}
// plain touch icon radio-buttons
$form['touch_icons']['plain']['touch_icon_plain_display'] = array(
'#type' => 'radios',
'#title' => t('Display touch icon'),
'#description' => t('Whether a touch icon should be displayed.'),
'#options' => array(
'none' => 'No touch icon',
'default' => 'Default touch icon',
'custom' => 'Custom touch icon',
),
'#default_value' => $touch_icon_plain_display_value,
'#element_validate' => array(
'_touch_icons_plain_radio_validate',
),
);
// deduce which precomposed touch icon radio-button to pre-select
if ($settings['toggle_touch_icon_precomp'] == '0') {
$touch_icon_precomp_display_value = 'none';
}
elseif ($settings['toggle_touch_icon_precomp'] == 1 && $settings['default_touch_icon_precomp'] == 1) {
$touch_icon_precomp_display_value = 'default';
}
elseif ($settings['toggle_touch_icon_precomp'] == 1 && $settings['default_touch_icon_precomp'] == 0) {
$touch_icon_precomp_display_value = 'custom';
}
// precomposed touch icon radio-buttons
$form['touch_icons']['precomp']['touch_icon_precomp_display'] = array(
'#type' => 'radios',
'#title' => t('Display precomposed touch icon'),
'#description' => t('Whether a precomposed touch icon should be displayed.'),
'#options' => array(
'none' => 'No precomposed touch icon',
'default' => 'Default precomposed touch icon',
'custom' => 'Custom precomposed touch icon',
),
'#default_value' => $touch_icon_precomp_display_value,
'#element_validate' => array(
'_touch_icons_precomp_radio_validate',
),
);
// integrate with themsettings_verticaltabs.module
if (module_exists('themesettings_verticaltabs')) {
$form['touch_icons']['#attached'] = array(
'js' => array(
'vertical-tabs' => drupal_get_path('module', 'touch_icons') . '/touch_icons_verticaltabs_radios.js',
),
);
}
}