You are here

function _styleswitcher_weight_delta in Style Switcher 7.2

Same name and namespace in other branches
  1. 6.2 styleswitcher.admin.inc \_styleswitcher_weight_delta()

Calculates #delta for style's weight element.

The function does not use static variable because it's called only once.

Parameters

string $theme: Name of the theme for which styles the delta is calculated.

Return value

int Optimal #delta value.

1 call to _styleswitcher_weight_delta()
styleswitcher_config_theme in ./styleswitcher.admin.inc
Page callback: Constructs a form for a theme-specific styles settings.

File

./styleswitcher.admin.inc, line 470
Styleswitcher configuration functionality.

Code

function _styleswitcher_weight_delta($theme) {
  foreach (styleswitcher_style_load_multiple($theme) as $style) {
    $weights[] = $style['weight'];
  }
  return max(abs(min($weights)), max($weights), floor(count($weights) / 2));
}