public function Border::submitStyleFormElements in Bootstrap Styles 1.0.x
Overrides StylePluginBase::submitStyleFormElements
File
- src/
Plugin/ BootstrapStyles/ Style/ Border.php, line 452
Class
- Border
- Class Border.
Namespace
Drupal\bootstrap_styles\Plugin\BootstrapStyles\StyleCode
public function submitStyleFormElements(array $group_elements) {
$directions = [
'left',
'top',
'right',
'bottom',
];
$schema = [
'border' => [
'border_style' => [
'class' => $group_elements['border_style'],
],
'border_width' => [
'class' => $this
->getStyleOptionClassByIndex('border_width', $group_elements['border_width']),
],
'border_color' => [
'class' => $group_elements['border_color'],
],
'rounded_corners' => [
'class' => $this
->getStyleOptionClassByIndex('rounded_corners', $group_elements['rounded_corners']),
],
],
];
for ($i = 0; $i < 4; $i++) {
$schema['border']['border_' . $directions[$i] . '_style']['class'] = $group_elements['border_' . $directions[$i] . '_style'];
$schema['border']['border_' . $directions[$i] . '_width']['class'] = $this
->getStyleOptionClassByIndex('border_' . $directions[$i] . '_width', $group_elements['border_' . $directions[$i] . '_width']);
$schema['border']['border_' . $directions[$i] . '_color']['class'] = $group_elements['border_' . $directions[$i] . '_color'];
}
// Rounded corners.
$corners = [
'top_left' => 'Top Left',
'top_right' => 'Top Right',
'bottom_left' => 'Bottom Left',
'bottom_right' => 'Bottom Right',
];
foreach (array_keys($corners) as $corner_key) {
$schema['border']['rounded_corner_' . $corner_key]['class'] = $this
->getStyleOptionClassByIndex('rounded_corner_' . $corner_key, $group_elements['rounded_corner_' . $corner_key]);
}
return $schema;
}