You are here

function textsize_admin_settings in Text Size 6

Same name and namespace in other branches
  1. 5 includes/textsize.admin.inc \textsize_admin_settings()
  2. 7 includes/textsize.admin.inc \textsize_admin_settings()

Builds and returns the textsize settings form.

See also

textsize_admin_settings_validate()

1 string reference to 'textsize_admin_settings'
textsize_menu in ./textsize.module
Implement hook_menu().

File

includes/textsize.admin.inc, line 138
Provides the Text Size administrative interface.

Code

function textsize_admin_settings() {
  $abbr_php = '<abbr title="' . t('PHP: Hypertext Preprocessor') . '">PHP</abbr>';
  $abbr_xhtml = '<abbr title="' . t('Extensible Hypertext Markup Language') . '">XHTML</abbr>';
  $abbr_css = '<abbr title="' . t('Cascading Style Sheets') . '">CSS</abbr>';
  $abbr_wcag = '<abbr title="' . t('Web Content Accessibility Guidelines') . '">WCAG</abbr>';
  $abbr_bitv = '<abbr lang="de" xml:lang="de" title="Barrierefreie Informationstechnik-Verordnung">BITV</abbr>';
  $abbr_id = '<abbr title="' . t('Identification') . '">ID</abbr>';
  $link_ts_important = l(t('Overwrite text size in templates'), 'admin/settings/textsize', array(
    'attributes' => array(
      'title' => t('Overwrite text size in templates'),
    ),
    'fragment' => 'edit-textsize-important',
  ));
  $link_footnote_1 = l('1', 'admin/settings/textsize', array(
    'attributes' => array(
      'title' => t('Footnote') . ' 1',
    ),
    'fragment' => 'footnote-1',
  ));
  $link_footnote_2 = l('2', 'admin/settings/textsize', array(
    'attributes' => array(
      'title' => t('Footnote') . ' 2',
    ),
    'fragment' => 'footnote-2',
  ));
  $link_footnote_3 = l('3', 'admin/settings/textsize', array(
    'attributes' => array(
      'title' => t('Footnote') . ' 3',
    ),
    'fragment' => 'footnote-3',
  ));
  $link_footnote_4 = l('4', 'admin/settings/textsize', array(
    'attributes' => array(
      'title' => t('Footnote') . ' 4',
    ),
    'fragment' => 'footnote-4',
  ));
  $link_footnote_5 = l('5', 'admin/settings/textsize', array(
    'attributes' => array(
      'title' => t('Footnote') . ' 5',
    ),
    'fragment' => 'footnote-5',
  ));
  $link_footnote_6 = l('6', 'admin/settings/textsize', array(
    'attributes' => array(
      'title' => t('Footnote') . ' 6',
    ),
    'fragment' => 'footnote-6',
  ));
  $form['textsize'] = array(
    '#type' => 'fieldset',
    '#title' => t('Global settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['textsize']['textsize_block_title'] = array(
    '#type' => 'radios',
    '#title' => t('Block title'),
    '#options' => array(
      'text_size' => t('Text Size'),
      'zoom' => t('Zoom'),
    ),
    '#default_value' => variable_get('textsize_block_title', 'text_size'),
    '#description' => t('Select the block title.') . ' ' . t('Default') . ': "' . t('Text Size') . '".',
  );
  $form['textsize']['textsize_block_type'] = array(
    '#type' => 'radios',
    '#title' => t('Block type'),
    '#options' => array(
      'text' => t('Text links') . ' [' . $link_footnote_1 . ']',
      'image' => t('Image links') . ' [' . $link_footnote_2 . ']',
      'select' => t('Select menu'),
    ),
    '#default_value' => variable_get('textsize_block_type', 'text'),
    '#description' => t('Select the type of block.') . ' ' . t('Default') . ': "' . t('Text links') . '".&#160;<br /><span id="footnote-1">[1] ' . t('Images are showed with !abbr_css.', array(
      '!abbr_css' => $abbr_css,
    )) . ' <span class="ts_ok">' . t('Ideal for Web Accessibility.') . '</span></span><br /><span id="footnote-2">[2] ' . t('Images in the !abbr_xhtml source code.', array(
      '!abbr_xhtml' => $abbr_xhtml,
    )) . ' <span class="warning">' . t('Warning') . ': ' . t('Not for: !abbr_wcag/!abbr_bitv 3.1! No hover action if !javascript is not activated!', array(
      '!abbr_wcag' => $abbr_wcag,
      '!abbr_bitv' => $abbr_bitv,
      '!javascript' => '<em lang="en">JavaScript</em>',
    )) . '</span></span>',
  );
  $form['textsize']['textsize_link_type'] = array(
    '#type' => 'radios',
    '#title' => t('Type of links'),
    '#options' => array(
      'variable' => t('Variable'),
      'fix' => t('Fixed') . ' [' . $link_footnote_3 . ']',
    ),
    '#default_value' => variable_get('textsize_link_type', 'variable'),
    '#description' => t('Select the type of links.') . ' ' . t('Default') . ': "' . t('Variable') . '".<br /><span id="footnote-3">[3] ' . t('Fixed links shows only 3 options for changing the text size (Increase, decrease and normal).') . '</span>',
  );
  $form['textsize_adv'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['textsize_adv']['textsize_element'] = array(
    '#type' => 'select',
    '#title' => t('!abbr_xhtml element', array(
      '!abbr_xhtml' => $abbr_xhtml,
    )),
    '#options' => array(
      'body' => 'body',
      'div' => 'div',
      'p' => 'p',
      'span' => 'span',
      'table' => 'table',
      'tr' => 'tr',
      'th' => 'th',
      'td' => 'td',
    ),
    '#default_value' => variable_get('textsize_element', 'body'),
    '#description' => t('Select the !abbr_xhtml element for the resize process.', array(
      '!abbr_xhtml' => $abbr_xhtml,
    )) . ' ' . t('Default') . ': "<em lang="en">body</em>". ' . t('The !body element is for the whole page.', array(
      '!body' => '<em lang="en">body</em>',
    )),
  );
  $form['textsize_adv']['textsize_element_class'] = array(
    '#type' => 'textfield',
    '#title' => t('!abbr_xhtml element !abbr_id/class', array(
      '!abbr_xhtml' => $abbr_xhtml,
      '!abbr_id' => $abbr_id,
    )),
    '#size' => 80,
    '#maxlength' => 80,
    '#default_value' => variable_get('textsize_element_class', ''),
    '#description' => t('Define one or more !abbr_id\'s ("#myid" or "#myid, div#myid-2") [!footnote_4] or one or more classes (".myclass" or ".myclass, div.myclass-2") for the !abbr_xhtml element.', array(
      '!abbr_xhtml' => $abbr_xhtml,
      '!abbr_id' => $abbr_id,
      '!footnote_4' => $link_footnote_4,
    )) . ' ' . t('Default') . ': ' . t('Empty, for the !body element.', array(
      '!body' => '<em lang="en">body</em>',
    )) . '<br/> <span id="footnote-4">[4]  <span class="warning">' . t('Warning') . ': ' . t('If you use !abbr_id\'s, uncheck: "!link_ts_important".', array(
      '!abbr_id' => $abbr_id,
      '!link_ts_important' => $link_ts_important,
    )) . '</span></span>',
  );
  $form['textsize_adv']['textsize_increment'] = array(
    '#type' => 'textfield',
    '#title' => t('Increases/decreases step'),
    '#default_value' => variable_get('textsize_increment', 5),
    '#size' => 5,
    '#maxlength' => 5,
    '#field_suffix' => '&#037;',
    '#required' => TRUE,
    '#description' => t("Percentage for the next increases or decreases step.") . ' ' . t('Default') . ': "6&#037;". ' . t('Allowed values') . ': 0.01-999.99&#037;',
  );
  $form['textsize_adv']['textsize_minimum'] = array(
    '#type' => 'textfield',
    '#title' => t('Minimum Text Size'),
    '#default_value' => variable_get('textsize_minimum', 50),
    '#size' => 6,
    '#maxlength' => 6,
    '#field_suffix' => '&#037;',
    '#required' => TRUE,
    '#description' => t('Default') . ': "50&#037;". ' . t('Allowed values') . ': 0.01-999.98&#037;',
  );
  $form['textsize_adv']['textsize_normal'] = array(
    '#type' => 'textfield',
    '#title' => t('Normal Text Size'),
    '#default_value' => variable_get('textsize_normal', 75),
    '#size' => 6,
    '#maxlength' => 6,
    '#field_suffix' => '&#037;',
    '#required' => TRUE,
    '#description' => t('Default') . ': "75&#037;". ' . t('Allowed values') . ': 0.02-999.99&#037;',
  );
  $form['textsize_adv']['textsize_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display normal text size as 100&#037;.'),
    '#default_value' => variable_get('textsize_display', 1),
    '#description' => t('Default') . ': ' . t('Checked.'),
  );
  $form['textsize_adv']['textsize_reset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset to normal size after maximum or minimum reached.'),
    '#default_value' => variable_get('textsize_reset', 0),
    '#description' => t('Default') . ': ' . t('Not checked.'),
  );
  $form['textsize_adv']['textsize_maximum'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum Text Size'),
    '#default_value' => variable_get('textsize_maximum', 150),
    '#size' => 7,
    '#maxlength' => 7,
    '#field_suffix' => '&#037;',
    '#required' => TRUE,
    '#description' => t('Default') . ': "150&#037;". ' . t('Allowed values') . ': 0.03-1000&#037;',
  );
  $form['textsize_adv']['textsize_javascript'] = array(
    '#type' => 'radios',
    '#title' => t('Scripting languages'),
    '#options' => array(
      0 => 'PHP',
      1 => 'PHP + JavaScript',
      2 => 'PHP + JavaScript + ' . t('Optimized for performance.'),
    ),
    '#default_value' => variable_get('textsize_javascript', 1),
    '#description' => t('Support !javascript (!jquery) or only !abbr_php.', array(
      '!abbr_php' => $abbr_php,
      '!javascript' => '<em lang="en">JavaScript</em>',
      '!jquery' => '<em lang="en">jQuery</em>',
    )) . ' ' . t('Default') . ': PHP + JavaScript.',
  );
  $form['textsize_adv']['textsize_animate'] = array(
    '#type' => 'checkbox',
    '#title' => t('Animation'),
    '#default_value' => variable_get('textsize_animate', 0),
    '#description' => t('!javascript (!jquery) animation for teaxt size change.', array(
      '!javascript' => '<em lang="en">JavaScript</em>',
      '!jquery' => '<em lang="en">jQuery</em>',
    )) . ' ' . t('Default') . ': ' . t('Not checked.') . ' <span class="warning">' . t('Warning') . ': ' . t('If you use animation, uncheck: "!link_ts_important"!', array(
      '!abbr_id' => $abbr_id,
      '!link_ts_important' => $link_ts_important,
    )) . '</span>',
  );
  $form['textsize_adv']['textsize_animate_duration'] = array(
    '#type' => 'select',
    '#title' => t('Animation duration'),
    '#options' => array(
      200 => '0.2 ' . t('seconds') . ' (' . t('Fast') . ')',
      400 => '0.4 ' . t('seconds') . ' (' . t('Normal') . ')',
      600 => '0.8 ' . t('seconds') . ' (' . t('Slow') . ')',
      1000 => '1 ' . t('second'),
      2000 => '2 ' . t('seconds'),
      4000 => '4 ' . t('seconds'),
      6000 => '6 ' . t('seconds'),
      8000 => '8 ' . t('seconds'),
      10000 => '10 ' . t('seconds'),
    ),
    '#default_value' => variable_get('textsize_animate_duration', 1000),
    '#description' => t('Duration of animation in seconds.') . ' ' . t('Default') . ': "1 ' . t('second') . '".',
  );
  $form['textsize_adv']['textsize_important'] = array(
    '#type' => 'checkbox',
    '#title' => t('Overwrite text size in templates') . ' [' . $link_footnote_5 . ']',
    '#default_value' => variable_get('textsize_important', 1),
    '#description' => t('Overwrite the font-size value of the current theme (with "!important"). Note: The !abbr_xhtml element for the resize process can not have the value "!important" in the !abbr_css style "font-size".', array(
      '!abbr_xhtml' => $abbr_xhtml,
      '!abbr_css' => $abbr_css,
    )) . ' ' . t('Default') . ': ' . t('Checked.') . ' <br/><span id="footnote-5">[5] ' . t('Not checked, for less code.') . ' <span class="warning">' . t('Warning') . ': ' . t('If you use the !abbr_xhtml element "body":', array(
      '!abbr_xhtml' => $abbr_xhtml,
    )) . ' ' . t('Delete in your theme the !abbr_css style:', array(
      '!abbr_css' => $abbr_css,
      '!abbr_id' => $abbr_id,
    )) . ' "<code>body {font-size: ...;}</code>". ' . t('For example') . ': "<code><del>body {font-size: 12px;}</del></code>".</span></span>',
  );
  $form['textsize_adv']['textsize_message'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display message after changing text size'),
    '#default_value' => variable_get('textsize_message', 1),
    '#description' => t('Default') . ': ' . t('Checked.'),
  );
  $form['textsize_adv']['textsize_cookie_expires'] = array(
    '#type' => 'textfield',
    '#title' => t('Cookie Expires'),
    '#size' => 4,
    '#maxlength' => 4,
    '#field_suffix' => t('days'),
    '#default_value' => variable_get('textsize_cookie_expires', 365),
    '#description' => t('Default') . ': "365" ' . t('days') . '. ' . t('Allowed values') . ': 1-3650 ' . t('days') . '.',
    '#required' => TRUE,
  );
  $form['textsize_adv']['textsize_cookie_domain'] = array(
    '#type' => 'textfield',
    '#title' => t('Cookie Domain'),
    '#size' => 40,
    '#maxlength' => 100,
    '#field_prefix' => 'http://' . $_SERVER['SERVER_NAME'],
    '#default_value' => variable_get('textsize_cookie_domain', base_path()),
    '#description' => t('Default') . ': "' . base_path() . '". <span class="warning">' . t('Warning') . ': ' . t('After a change, the user must store the cookie again.') . '</span>',
    '#required' => TRUE,
  );
  $form['textsize_theme'] = array(
    '#type' => 'fieldset',
    '#title' => t('Theme settings'),
    '#description' => t('Enable, disable or set the display of certain text size elements.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['textsize_theme']['textsize_display'] = array(
    '#type' => 'fieldset',
    '#title' => t('Toggle display'),
    '#description' => t('Enable or disable the display of certain text size elements.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['textsize_theme']['textsize_display']['textsize_display_subtitle'] = array(
    '#type' => 'checkbox',
    '#title' => t('Subtitle'),
    '#default_value' => variable_get('textsize_display_subtitle', 0),
    '#description' => t('Ideal for image links and the select menue (title as label).') . ' ' . t('Default') . ': ' . t('Not checked.'),
  );
  $form['textsize_theme']['textsize_display']['textsize_display_increase'] = array(
    '#type' => 'checkbox',
    '#title' => t('Increase Text Size'),
    '#default_value' => variable_get('textsize_display_increase', 1),
    '#description' => t('Default') . ': ' . t('Checked.'),
  );
  $form['textsize_theme']['textsize_display']['textsize_display_decrease'] = array(
    '#type' => 'checkbox',
    '#title' => t('Decrease Text Size'),
    '#default_value' => variable_get('textsize_display_decrease', 1),
    '#description' => t('Default') . ': ' . t('Checked.'),
  );
  $form['textsize_theme']['textsize_display']['textsize_display_normal'] = array(
    '#type' => 'checkbox',
    '#title' => t('Normal Text Size'),
    '#default_value' => variable_get('textsize_display_normal', 1),
    '#description' => t('Default') . ': ' . t('Checked.'),
  );
  $form['textsize_theme']['textsize_display']['textsize_display_links'] = array(
    '#type' => 'checkbox',
    '#title' => t('Link text'),
    '#default_value' => variable_get('textsize_display_links', 1),
    '#description' => t('Default') . ': ' . t('Checked.') . ' <span class="warning">' . t('Warning') . ': ' . t('Not for block type "Image links" with images in the !abbr_xhtml source code.', array(
      '!abbr_xhtml' => $abbr_xhtml,
    )) . '</span>',
  );
  $form['textsize_theme']['textsize_display']['textsize_display_current_text_value'] = array(
    '#type' => 'radios',
    '#title' => t('Display current text size text and value'),
    '#options' => array(
      'text_value' => t('Text and value') . ' (' . t('for example') . ': "' . t("Current Size") . ': 100%")',
      'value' => t('Only the value') . ' (' . t('for example') . ': "<span title="' . t("Current Size") . ': 100%" class="textsize_current_help">100%</span>")',
      'hidden' => t('Hide text and value'),
      'remove' => t('Remove text and value in the source code') . ' [' . $link_footnote_6 . ']',
    ),
    '#default_value' => variable_get('textsize_display_current_text_value', 'text_value'),
    '#description' => t('Default') . ': "' . t('Text and value') . '". <br /><span id="footnote-6" class="warning">[6] ' . t('Warning') . ': ' . t('Not for screen readers or text browsers (text is not in the !abbr_xhtml source code).', array(
      '!abbr_xhtml' => $abbr_xhtml,
    )) . '</span>',
  );
  $form['textsize_theme']['textsize_inline'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display inline'),
    '#description' => t('Set the display of certain text size elements to inline or normal.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['textsize_theme']['textsize_inline']['textsize_display_list_inline'] = array(
    '#type' => 'checkbox',
    '#title' => t('Subtitle, list and select menu'),
    '#default_value' => variable_get('textsize_display_list_inline', 0),
    '#description' => t('Default') . ': ' . t('Not checked.'),
  );
  $form['textsize_theme']['textsize_inline']['textsize_display_current_inline'] = array(
    '#type' => 'checkbox',
    '#title' => t('Current text size'),
    '#default_value' => variable_get('textsize_display_current_inline', 0),
    '#description' => t('Default') . ': ' . t('Not checked.'),
  );
  return system_settings_form($form);
}