public function Border::build in Bootstrap Styles 1.0.x
Overrides StylePluginBase::build
File
- src/
Plugin/ BootstrapStyles/ Style/ Border.php, line 501
Class
- Border
- Class Border.
Namespace
Drupal\bootstrap_styles\Plugin\BootstrapStyles\StyleCode
public function build(array $build, array $storage, $theme_wrapper = NULL) {
$classes = [];
$classes[] = $storage['border']['border_style']['class'];
$classes[] = $storage['border']['border_width']['class'];
$classes[] = $storage['border']['border_color']['class'];
$directions = [
'left',
'top',
'right',
'bottom',
];
$corners = [
'top_left' => 'Top Left',
'top_right' => 'Top Right',
'bottom_left' => 'Bottom Left',
'bottom_right' => 'Bottom Right',
];
for ($i = 0; $i < 4; $i++) {
$classes[] = $storage['border']['border_' . $directions[$i] . '_style']['class'];
$classes[] = $storage['border']['border_' . $directions[$i] . '_width']['class'];
$classes[] = $storage['border']['border_' . $directions[$i] . '_color']['class'];
}
// Rounded corners.
if (isset($storage['border']['rounded_corners']['class'])) {
$classes[] = $storage['border']['rounded_corners']['class'];
}
foreach (array_keys($corners) as $corner_key) {
$classes[] = $storage['border']['rounded_corner_' . $corner_key]['class'];
}
// Add the classes to the build.
$build = $this
->addClassesToBuild($build, $classes, $theme_wrapper);
// Attach bs-classes to the build.
$build['#attached']['library'][] = 'bootstrap_styles/plugin.border.build';
return $build;
}