Add space before/after settings
This commit is contained in:
@@ -35,6 +35,15 @@ class ContainerViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @var int[]
|
||||
*/
|
||||
protected static $scale = [
|
||||
'none' => 0,
|
||||
'default' => 8,
|
||||
'large' => 16,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
@@ -80,6 +89,17 @@ class ContainerViewHelper extends AbstractViewHelper
|
||||
if ($arguments['cssClasses'] !== null) {
|
||||
$classes[] = $arguments['cssClasses'];
|
||||
}
|
||||
|
||||
$scaleTop = empty($data['space_before_class']) ? static::$scale['default'] : static::$scale[$data['space_before_class']];
|
||||
$scaleBottom = empty($data['space_after_class']) ? static::$scale['default'] : static::$scale[$data['space_after_class']];
|
||||
|
||||
$classes[] = sprintf('pt-%d', $scaleTop);
|
||||
$classes[] = sprintf('pb-%d', $scaleBottom);
|
||||
|
||||
if ('default' !== $data['frame_class']) {
|
||||
$classes[] = $data['frame_class'];
|
||||
}
|
||||
|
||||
if (true === $arguments['rteContent'] || count($classes) > 0) {
|
||||
return sprintf('<div class="%s"%s>%s</div>', implode(' ', $classes), $arguments['rteContent'] ? ' data-rte-content' : '', $content);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user