You are here

function mobile_switch_block_form_mobile_switch_advanced_settings_form_alter in Mobile Switch Block 7

Same name and namespace in other branches
  1. 6 mobile_switch_block.module \mobile_switch_block_form_mobile_switch_advanced_settings_form_alter()
  2. 7.2 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 93
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) {
  global $conf;
  if ($conf['mobile_switch_theme_mobile'] !== 'none') {
    $form['switch_block'] = array(
      '#type' => 'fieldset',
      '#title' => t('Switch block'),
      '#description' => t('Take a look at the !readme.', array(
        '!readme' => l('README.txt', 'http://drupalcode.org/project/mobile_switch_block.git/blob_plain/refs/heads/master:/README.txt'),
      )),
      '#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'),
      ),
    );
    $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',
      ),
    );
  }
}