protected function StyleswitcherConfigTheme::weightDelta in Style Switcher 8.2
Same name and namespace in other branches
- 3.0.x src/Form/StyleswitcherConfigTheme.php \Drupal\styleswitcher\Form\StyleswitcherConfigTheme::weightDelta()
Calculates #delta for style's weight element.
Parameters
string $theme: Name of the theme for which styles the delta is calculated.
Return value
int Optimal #delta value.
1 call to StyleswitcherConfigTheme::weightDelta()
- StyleswitcherConfigTheme::buildForm in src/
Form/ StyleswitcherConfigTheme.php - Form constructor.
File
- src/
Form/ StyleswitcherConfigTheme.php, line 169
Class
- StyleswitcherConfigTheme
- Configure theme-specific styles settings.
Namespace
Drupal\styleswitcher\FormCode
protected function weightDelta($theme) {
foreach (styleswitcher_style_load_multiple($theme) as $style) {
$weights[] = $style['weight'];
}
return max(abs(min($weights)), max($weights), floor(count($weights) / 2));
}