You are here

function textsize_block_form_options in Text Size 7

Same name and namespace in other branches
  1. 5 includes/textsize.block.inc \textsize_block_form_options()
  2. 6 includes/textsize.block.inc \textsize_block_form_options()

Returns an array of available values for the select element in the block text size.

Return value

An array of available values, for selecting the text size.

See also

textsize_form()

1 call to textsize_block_form_options()
textsize_form in includes/textsize.block.inc
Implement hook_form().

File

includes/textsize.block.inc, line 297
block, page and theme functions.

Code

function textsize_block_form_options() {
  $textsize_link_type = variable_get('textsize_link_type', 'variable');
  $ts_in = variable_get('textsize_increment', 6);
  $ts_no = variable_get('textsize_normal', 76);
  $ts_mi = variable_get('textsize_minimum', 50);
  $ts_ma = variable_get('textsize_maximum', 150);
  if ($textsize_link_type == 'fix') {
    $ts_st = $ts_no - $ts_in;
    $ts_en = $ts_no + $ts_in;
  }
  elseif ($textsize_link_type == 'variable') {
    $ts_st = $ts_no - ceil(($ts_no - $ts_mi) / $ts_in) * $ts_in;
    $ts_en = $ts_no + floor(($ts_ma - $ts_no) / $ts_in) * $ts_in;
  }
  $options = array();
  for ($value = $ts_st; $value <= $ts_en; $value = round($value + $ts_in, 2)) {
    $options[(string) $value] = textsize_display($value, 2) . '';
  }
  return $options;
}