function mobile_switch_block_form_mobile_switch_advanced_settings_form_alter in Mobile Switch Block 7.2
Same name and namespace in other branches
- 6 mobile_switch_block.module \mobile_switch_block_form_mobile_switch_advanced_settings_form_alter()
- 7 mobile_switch_block.module \mobile_switch_block_form_mobile_switch_advanced_settings_form_alter()
Implements hook_form_FORM_ID_alter().
File
- ./
mobile_switch_block.module, line 106 - Extends the Mobile Switch module with an theme switch block.
Code
function mobile_switch_block_form_mobile_switch_advanced_settings_form_alter(&$form, &$form_state, $form_id) {
$mode = mobile_switch_get_operating_mode();
if ($mode === 'none' || $mode === 'detectonly') {
return;
}
$readme_link = 'README.txt';
if (module_exists('help')) {
$readme_link = l('README.txt', 'admin/help/mobile_switch_block');
}
$form['switch_block'] = array(
'#type' => 'fieldset',
'#title' => t('Switch block'),
'#description' => t('Take a look at the !readme.', array(
'!readme' => $readme_link,
)),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['switch_block']['mobile_switch_block_content'] = array(
'#type' => 'select',
'#title' => t('Block content'),
'#default_value' => variable_get('mobile_switch_block_content', 'link'),
'#options' => _mobile_switch_block_content_options(),
);
$form['switch_block']['mobile_switch_block_desktop_device_name'] = array(
'#type' => 'select',
'#title' => t('Desktop device designation'),
'#description' => t('Select the designation for the desktop device. Example output: Standard view, Default view, Desktop view'),
'#default_value' => variable_get('mobile_switch_block_desktop_device_name', 'standard'),
'#options' => array(
'standard' => t('standard'),
'default' => t('default'),
'desktop' => t('desktop'),
),
);
$form['switch_block']['mobile_switch_block_switch_link_text'] = array(
'#type' => 'select',
'#title' => t('Switch link text'),
'#description' => t('Select the second part of the switch link text. Example output: Mobile view, Mobile site, Mobile variant, Mobile version'),
'#default_value' => variable_get('mobile_switch_block_switch_link_text', 'view'),
'#options' => array(
'view' => t('view'),
'site' => t('site'),
'variant' => t('variant'),
'version' => t('version'),
),
);
// Cookie expire time.
$form['switch_block']['mobile_switch_block_cookie_expire'] = array(
'#type' => 'textfield',
'#title' => t('Cookie lifetime'),
'#description' => t('The time after the <em>Mobile Switch</em> theme cookie expires, in seconds.'),
'#default_value' => variable_get('mobile_switch_block_cookie_expire', 31536000),
'#size' => 20,
'#maxlength' => 12,
'#required' => TRUE,
'#element_validate' => array(
'_mobile_switch_block_cookie_expire_validate',
),
);
// Link target.
$form['switch_block']['mobile_switch_block_link_target'] = array(
'#type' => 'checkbox',
'#title' => t('Link to front page'),
'#description' => t('This is relevant for the building of the link URL. Checked: Always linked to the <em>Base URL</em>. Unchecked: Linked to a URL corresponding to the current URL.'),
'#default_value' => variable_get('mobile_switch_block_link_target', 1),
);
// Non-tablet usage.
$form['switch_block']['mobile_switch_block_no_tablet_usage'] = array(
'#type' => 'checkbox',
'#title' => t('Non-tablet usage'),
'#description' => t('Use the block on mobile devices when a non-tablet device is detected.'),
'#default_value' => variable_get('mobile_switch_block_no_tablet_usage', 0),
);
}