View source
<?php
namespace Drupal\layout_builder_base\Plugin\Layout;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\file\Entity\File;
use Drupal\image\Entity\ImageStyle;
use Drupal\layout_builder\Plugin\Layout\MultiWidthLayoutBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class BaseLayoutBase extends MultiWidthLayoutBase {
protected $layoutBuilderBaseSettings;
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory) {
$this->layoutBuilderBaseSettings = $config_factory
->get('layout_builder_base.settings');
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('config.factory'));
}
public function defaultConfiguration() {
$config = [
'column_gap' => $this
->getDefaultColumnGap(),
'row_gap' => $this
->getDefaultRowGap(),
'column_width' => $this
->getDefaultColumnWidth(),
'column_breakpoint' => $this
->getDefaultColumnBreakpoint(),
'align_items' => $this
->getDefaultAlignItems(),
'background' => $this
->getDefaultBackground(),
'background_image' => $this
->getDefaultImageBackground(),
'background_image_style' => $this
->getDefaultBackgroundImageStyle(),
'background_attachment' => $this
->getDefaultBackgroundAttachment(),
'background_position' => $this
->getDefaultBackgroundPosition(),
'background_size' => $this
->getDefaultBackgroundSize(),
'background_overlay' => $this
->getDefaultBackgroundOverlay(),
'equal_top_bottom_margins' => $this
->getDefaultEqualTopBottomMargin(),
'equal_left_right_margins' => $this
->getDefaultEqualLeftRightMargin(),
'top_margin' => $this
->getDefaultTopMargin(),
'right_margin' => $this
->getDefaultRightMargin(),
'bottom_margin' => $this
->getDefaultBottomMargin(),
'left_margin' => $this
->getDefaultLeftMargin(),
'equal_top_bottom_paddings' => $this
->getDefaultEqualTopBottomPadding(),
'equal_left_right_paddings' => $this
->getDefaultEqualLeftRightPadding(),
'top_padding' => $this
->getDefaultTopPadding(),
'right_padding' => $this
->getDefaultRightPadding(),
'bottom_padding' => $this
->getDefaultBottomPadding(),
'left_padding' => $this
->getDefaultLeftPadding(),
'container' => $this
->getDefaultContainer(),
'content_container' => $this
->getDefaultContentContainer(),
'height' => $this
->getDefaultHeight(),
'color' => $this
->getDefaultColor(),
'alignment' => $this
->getDefaultAlignment(),
'modifier' => $this
->getDefaultModifiers(),
'customizable_columns' => $this
->getDefaultCustomizableColumns(),
];
return array_merge(parent::defaultConfiguration(), $config);
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
if (empty($this
->getWidthOptions())) {
unset($form['column_widths']);
}
if ($this
->isMultipleColumnsLayout()) {
$form['grid'] = [
'#type' => 'details',
'#title' => $this
->t('Grid properties'),
];
if (!empty($this
->getColumnGapOptions())) {
$form['grid']['column_gap'] = [
'#type' => 'select',
'#title' => $this
->t('Column gap'),
'#default_value' => $this->configuration['column_gap'],
'#options' => $this
->getColumnGapOptions(),
'#description' => $this
->t('Choose the column gap for this layout.'),
];
}
if (!empty($this
->getRowGapOptions())) {
$form['grid']['row_gap'] = [
'#type' => 'select',
'#title' => $this
->t('Row gap'),
'#default_value' => $this->configuration['row_gap'],
'#options' => $this
->getRowGapOptions(),
'#description' => $this
->t('Choose the row gap for this layout.'),
];
}
if (!empty($this
->getColumnBreakpointOptions())) {
$form['grid']['column_breakpoint'] = [
'#type' => 'select',
'#title' => $this
->t('Column breakpoint'),
'#default_value' => $this->configuration['column_breakpoint'],
'#options' => $this
->getColumnBreakpointOptions(),
'#description' => $this
->t('Choose the column breakpoint where it comes back to one column for this layout.'),
];
}
if (!empty($this
->getColumnWidthOptions())) {
$form['grid']['column_width'] = [
'#type' => 'select',
'#title' => $this
->t('Column width'),
'#default_value' => $this->configuration['column_width'],
'#options' => $this
->getColumnWidthOptions(),
'#description' => $this
->t('Choose the column width for this layout.'),
];
}
if (!empty($this
->getAlignItemsOptions())) {
$form['grid']['align_items'] = [
'#type' => 'select',
'#title' => $this
->t('Align items'),
'#default_value' => $this->configuration['align_items'],
'#options' => $this
->getAlignItemsOptions(),
'#description' => $this
->t('Choose the align items logic for this layout.'),
];
}
if (!empty($this
->getCustomizableColumnsOptions())) {
$form['grid']['customizable_columns'] = [
'#type' => 'select',
'#title' => $this
->t('Customizable columns'),
'#default_value' => $this->configuration['customizable_columns'],
'#options' => $this
->getCustomizableColumnsOptions(),
'#description' => $this
->t('Choose the type of column layout.'),
];
}
}
$background_implemented = $this
->enableImageBackground() || !empty($this
->getBackgroundOptions()) || !empty($this
->getBackgroundAttachmentOptions()) || !empty($this
->getBackgroundPositionOptions()) || !empty($this
->getBackgroundSizeOptions()) || !empty($this
->getBackgroundOverlayOptions());
if ($background_implemented) {
$form['background_detail'] = [
'#type' => 'details',
'#title' => $this
->t('Background'),
];
}
if ($this
->enableImageBackground()) {
$form['background_detail']['background_image'] = [
'#type' => 'managed_file',
'#title' => $this
->t('Background image'),
'#default_value' => !empty($this->configuration['background_image']) ? [
$this->configuration['background_image'],
] : '',
'#description' => $this
->t('Choose a background image for this layout. This feature is using inline CSS.'),
'#upload_validators' => [
'file_validate_is_image' => [],
'file_validate_extensions' => [
'gif png jpg jpeg',
],
],
'#upload_location' => 'public://layout_background/',
];
$form['background_detail']['background_image_style'] = [
'#type' => 'select',
'#title' => $this
->t('Background Image Style'),
'#default_value' => $this->configuration['background_image_style'],
'#options' => $this
->getBackgroundImageStyleOptions(),
];
}
if (!empty($this
->getBackgroundOptions())) {
$form['background_detail']['background'] = [
'#type' => 'select',
'#title' => $this
->t('Background'),
'#default_value' => $this->configuration['background'],
'#options' => $this
->getBackgroundOptions(),
'#description' => $this
->t('Choose the background for this layout.'),
];
}
if (!empty($this
->getBackgroundAttachmentOptions())) {
$form['background_detail']['background_attachment'] = [
'#type' => 'select',
'#title' => $this
->t('Background Attachment'),
'#default_value' => $this->configuration['background_attachment'],
'#options' => $this
->getBackgroundAttachmentOptions(),
'#description' => $this
->t('Choose the background attachment for this layout.'),
];
}
if (!empty($this
->getBackgroundPositionOptions())) {
$form['background_detail']['background_position'] = [
'#type' => 'select',
'#title' => $this
->t('Background Position'),
'#default_value' => $this->configuration['background_position'],
'#options' => $this
->getBackgroundPositionOptions(),
'#description' => $this
->t('Choose the background position for this layout.'),
];
}
if (!empty($this
->getBackgroundSizeOptions())) {
$form['background_detail']['background_size'] = [
'#type' => 'select',
'#title' => $this
->t('Background Size'),
'#default_value' => $this->configuration['background_size'],
'#options' => $this
->getBackgroundSizeOptions(),
'#description' => $this
->t('Choose the background size for this layout.'),
];
}
if (!empty($this
->getBackgroundOverlayOptions())) {
$form['background_detail']['background_overlay'] = [
'#type' => 'select',
'#title' => $this
->t('Background Overlay'),
'#default_value' => $this->configuration['background_overlay'],
'#options' => $this
->getBackgroundOverlayOptions(),
'#description' => $this
->t('Choose the background overlay for this layout.'),
];
}
$margin_implemented = !empty($this
->getTopMarginOptions()) || !empty($this
->getBottomMarginOptions()) || !empty($this
->getLeftMarginOptions()) || !empty($this
->getRightMarginOptions()) || !empty($this
->getEqualTopBottomMarginsOptions()) || !empty($this
->getEqualLeftRightMarginsOptions());
if ($margin_implemented) {
$form['margin'] = [
'#type' => 'details',
'#title' => $this
->t('Margins'),
];
}
if (!empty($this
->getTopMarginOptions())) {
$form['margin']['top_margin'] = [
'#type' => 'select',
'#title' => $this
->t('Top Margin'),
'#default_value' => $this->configuration['top_margin'],
'#options' => $this
->getTopMarginOptions(),
'#description' => $this
->t('Choose the top margin for this layout.'),
];
}
if (!empty($this
->getBottomMarginOptions())) {
$form['margin']['bottom_margin'] = [
'#type' => 'select',
'#title' => $this
->t('Bottom Margin'),
'#default_value' => $this->configuration['bottom_margin'],
'#options' => $this
->getBottomMarginOptions(),
'#description' => $this
->t('Choose the bottom margin for this layout.'),
];
}
if (!empty($this
->getLeftMarginOptions())) {
$form['margin']['left_margin'] = [
'#type' => 'select',
'#title' => $this
->t('Left Margin'),
'#default_value' => $this->configuration['left_margin'],
'#options' => $this
->getLeftMarginOptions(),
'#description' => $this
->t('Choose the left margin for this layout.'),
];
}
if (!empty($this
->getRightMarginOptions())) {
$form['margin']['right_margin'] = [
'#type' => 'select',
'#title' => $this
->t('Right Margin'),
'#default_value' => $this->configuration['right_margin'],
'#options' => $this
->getRightMarginOptions(),
'#description' => $this
->t('Choose the right margin for this layout.'),
];
}
if (!empty($this
->getEqualTopBottomMarginsOptions())) {
$form['margin']['equal_top_bottom_margins'] = [
'#type' => 'select',
'#title' => $this
->t('Top Bottom Margins'),
'#default_value' => $this->configuration['equal_top_bottom_margins'],
'#options' => $this
->getEqualTopBottomMarginsOptions(),
'#description' => $this
->t('Choose the top/bottom margins for this layout.'),
];
}
if (!empty($this
->getEqualLeftRightMarginsOptions())) {
$form['margin']['equal_left_right_margins'] = [
'#type' => 'select',
'#title' => $this
->t('Left Right Margins'),
'#default_value' => $this->configuration['equal_left_right_margins'],
'#options' => $this
->getEqualLeftRightMarginsOptions(),
'#description' => $this
->t('Choose the left/right margins for this layout.'),
];
}
$padding_implemented = !empty($this
->getTopPaddingOptions()) || !empty($this
->getBottomPaddingOptions()) || !empty($this
->getLeftPaddingOptions()) || !empty($this
->getRightPaddingOptions()) || !empty($this
->getEqualTopBottomPaddingsOptions()) || !empty($this
->getEqualLeftRightPaddingsOptions());
if ($padding_implemented) {
$form['padding'] = [
'#type' => 'details',
'#title' => $this
->t('Paddings'),
];
}
if (!empty($this
->getTopPaddingOptions())) {
$form['padding']['top_padding'] = [
'#type' => 'select',
'#title' => $this
->t('Top Padding'),
'#default_value' => $this->configuration['top_padding'],
'#options' => $this
->getTopPaddingOptions(),
'#description' => $this
->t('Choose the top padding for this layout.'),
];
}
if (!empty($this
->getBottomPaddingOptions())) {
$form['padding']['bottom_padding'] = [
'#type' => 'select',
'#title' => $this
->t('Bottom Padding'),
'#default_value' => $this->configuration['bottom_padding'],
'#options' => $this
->getBottomPaddingOptions(),
'#description' => $this
->t('Choose the bottom padding for this layout.'),
];
}
if (!empty($this
->getLeftPaddingOptions())) {
$form['padding']['left_padding'] = [
'#type' => 'select',
'#title' => $this
->t('Left Padding'),
'#default_value' => $this->configuration['left_padding'],
'#options' => $this
->getLeftPaddingOptions(),
'#description' => $this
->t('Choose the left padding for this layout.'),
];
}
if (!empty($this
->getRightPaddingOptions())) {
$form['padding']['right_padding'] = [
'#type' => 'select',
'#title' => $this
->t('Right Padding'),
'#default_value' => $this->configuration['right_padding'],
'#options' => $this
->getRightPaddingOptions(),
'#description' => $this
->t('Choose the right padding for this layout.'),
];
}
if (!empty($this
->getEqualTopBottomPaddingsOptions())) {
$form['padding']['equal_top_bottom_paddings'] = [
'#type' => 'select',
'#title' => $this
->t('Top Bottom Paddings'),
'#default_value' => $this->configuration['equal_top_bottom_paddings'],
'#options' => $this
->getEqualTopBottomPaddingsOptions(),
'#description' => $this
->t('Choose the top/bottom paddings for this layout.'),
];
}
if (!empty($this
->getEqualLeftRightPaddingsOptions())) {
$form['padding']['equal_left_right_paddings'] = [
'#type' => 'select',
'#title' => $this
->t('Left Right Paddings'),
'#default_value' => $this->configuration['equal_left_right_paddings'],
'#options' => $this
->getEqualLeftRightPaddingsOptions(),
'#description' => $this
->t('Choose the left/right paddings for this layout.'),
];
}
$container_implemented = !empty($this
->getHeightOptions()) || !empty($this
->getContainerOptions()) || !empty($this
->getContentContainerOptions());
if (!empty($container_implemented)) {
$form['container_detail'] = [
'#type' => 'details',
'#title' => $this
->t('Container'),
];
}
if (!empty($this
->getHeightOptions())) {
$form['container_detail']['height'] = [
'#type' => 'select',
'#title' => $this
->t('Height'),
'#default_value' => $this->configuration['height'],
'#options' => $this
->getHeightOptions(),
'#description' => $this
->t('Choose the height for this layout. It will change the minimum height of your layout.'),
];
}
if (!empty($this
->getContainerOptions())) {
$form['container_detail']['container'] = [
'#type' => 'select',
'#title' => $this
->t('Container'),
'#default_value' => $this->configuration['container'],
'#options' => $this
->getContainerOptions(),
'#description' => $this
->t('Choose the size of the container for this layout. It will change the maximum width of your layout.'),
];
}
if (!empty($this
->getContentContainerOptions())) {
$form['container_detail']['content_container'] = [
'#type' => 'select',
'#title' => $this
->t('Content container'),
'#default_value' => $this->configuration['content_container'],
'#options' => $this
->getContentContainerOptions(),
'#description' => $this
->t('Choose the size of the container for the content of this layout. It is pretty usefull if you want a full width background but contains your content in the middle.'),
];
}
$style_implemented = !empty($this
->getColorsOptions()) || !empty($this
->getAlignmentOptions()) || !empty($this
->getModifiersOptions());
if ($style_implemented) {
$form['styles'] = [
'#type' => 'details',
'#title' => $this
->t('Styles'),
];
}
if (!empty($this
->getColorsOptions())) {
$form['styles']['color'] = [
'#type' => 'select',
'#title' => $this
->t('Default color'),
'#default_value' => $this->configuration['color'],
'#options' => $this
->getColorsOptions(),
'#description' => $this
->t('Choose the default color for the text of this layout.'),
];
}
if (!empty($this
->getAlignmentOptions())) {
$form['styles']['alignment'] = [
'#type' => 'select',
'#title' => $this
->t('Default alignment'),
'#default_value' => $this->configuration['alignment'],
'#options' => $this
->getAlignmentOptions(),
'#description' => $this
->t('Choose the default alignment for the text of this layout.'),
];
}
if (!empty($this
->getModifiersOptions())) {
$form['styles']['modifiers'] = [
'#type' => 'select',
'#title' => $this
->t('Modifiers'),
'#default_value' => $this->configuration['modifiers'],
'#options' => $this
->getModifiersOptions(),
'#description' => $this
->t('Choose the modifiers for this layout.'),
];
}
return $form;
}
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::submitConfigurationForm($form, $form_state);
$grid_values = $form_state
->getValue('grid');
$background_values = $form_state
->getValue('background_detail');
$padding_values = $form_state
->getValue('padding');
$margin_values = $form_state
->getValue('margin');
$container_values = $form_state
->getValue('container_detail');
$style_values = $form_state
->getValue('styles');
$background_file = !empty($background_values['background_image']) ? $background_values['background_image'] : 0;
if (isset($background_file[0]) && !empty($background_file[0])) {
$file = File::load($background_file[0]);
$file
->setPermanent();
$file
->save();
}
$image_background_style = $background_values['background_image_style'];
$this->configuration['background_image'] = !empty($file) ? $file
->id() : '';
$this->configuration['background_image_style'] = !empty($image_background_style) ? $image_background_style : '';
$this->configuration['background'] = $background_values['background'] ?? '';
$this->configuration['background_attachment'] = $background_values['background_attachment'] ?? '';
$this->configuration['background_position'] = $background_values['background_position'] ?? '';
$this->configuration['background_size'] = $background_values['background_size'] ?? '';
$this->configuration['background_overlay'] = $background_values['background_overlay'] ?? '';
$this->configuration['top_margin'] = $margin_values['top_margin'] ?? '';
$this->configuration['bottom_margin'] = $margin_values['bottom_margin'] ?? '';
$this->configuration['left_margin'] = $margin_values['left_margin'] ?? '';
$this->configuration['right_margin'] = $margin_values['right_margin'] ?? '';
$this->configuration['equal_top_bottom_margins'] = $margin_values['equal_top_bottom_margins'] ?? '';
$this->configuration['equal_left_right_margins'] = $margin_values['equal_left_right_margins'] ?? '';
$this->configuration['equal_top_bottom_paddings'] = $padding_values['equal_top_bottom_paddings'] ?? '';
$this->configuration['equal_left_right_paddings'] = $padding_values['equal_left_right_paddings'] ?? '';
$this->configuration['top_padding'] = $padding_values['top_padding'] ?? '';
$this->configuration['bottom_padding'] = $padding_values['bottom_padding'] ?? '';
$this->configuration['left_padding'] = $padding_values['left_padding'] ?? '';
$this->configuration['right_padding'] = $padding_values['right_padding'] ?? '';
$this->configuration['container'] = $container_values['container'] ?? '';
$this->configuration['content_container'] = $container_values['content_container'] ?? '';
$this->configuration['height'] = $container_values['height'] ?? '';
$this->configuration['color'] = $style_values['color'] ?? '';
$this->configuration['alignment'] = $style_values['alignment'] ?? '';
$this->configuration['column_gap'] = $grid_values['column_gap'] ?? '';
$this->configuration['row_gap'] = $grid_values['row_gap'] ?? '';
$this->configuration['column_width'] = $grid_values['column_width'] ?? '';
$this->configuration['column_breakpoint'] = $grid_values['column_breakpoint'] ?? '';
$this->configuration['align_items'] = $grid_values['align_items'] ?? '';
$this->configuration['modifiers'] = $style_values['modifiers'] ?? '';
$this->configuration['customizable_columns'] = $grid_values['customizable_columns'] ?? '';
}
public function build(array $regions) {
$build = parent::build($regions);
$classes = [
$this->configuration['background'],
$this->configuration['background_attachment'],
$this->configuration['background_position'],
$this->configuration['background_size'],
$this->configuration['background_overlay'],
$this->configuration['top_margin'],
$this->configuration['bottom_margin'],
$this->configuration['left_margin'],
$this->configuration['right_margin'],
$this->configuration['equal_top_bottom_margins'],
$this->configuration['equal_left_right_margins'],
$this->configuration['top_padding'],
$this->configuration['bottom_padding'],
$this->configuration['left_padding'],
$this->configuration['right_padding'],
$this->configuration['equal_top_bottom_paddings'],
$this->configuration['equal_left_right_paddings'],
$this->configuration['container'],
$this->configuration['content_container'],
$this->configuration['height'],
$this->configuration['color'],
$this->configuration['alignment'],
$this->configuration['column_gap'],
$this->configuration['row_gap'],
$this->configuration['column_breakpoint'],
$this->configuration['column_width'],
$this->configuration['align_items'],
$this->configuration['modifiers'],
$this->configuration['customizable_columns'],
];
$build_classes = array_merge($build['#attributes']['class'], $classes);
$build['#attributes']['class'] = $build_classes;
if (!empty($this->configuration['background_image'])) {
$image = File::load($this->configuration['background_image']);
if (!empty($image)) {
$uri = $image->uri->value;
$style = $this->configuration['background_image_style'];
if (!empty($style)) {
$uri = ImageStyle::load($style)
->buildUrl($image
->getFileUri());
}
$url = file_create_url($uri);
$build['#attributes']['style'] = 'background-image: url("' . $url . '")';
}
}
return $build;
}
protected function getDefaultConfigOption($config_key, $options) {
$default = $this->layoutBuilderBaseSettings
->get($config_key);
$default_value = !empty($default) ? $default : '';
if (empty($default_value)) {
$options_keys = array_keys($options);
$default_value = !empty($options_keys) ? array_shift($options_keys) : '';
}
return $default_value;
}
protected function getDefaultBackground() {
$options = $this
->getBackgroundOptions();
return $this
->getDefaultConfigOption('background', $options);
}
protected function getDefaultImageBackground() {
return '';
}
protected function getDefaultBackgroundImageStyle() {
return '';
}
protected function getDefaultBackgroundAttachment() {
$options = $this
->getBackgroundAttachmentOptions();
return $this
->getDefaultConfigOption('background_attachment', $options);
}
protected function getDefaultBackgroundPosition() {
$options = $this
->getBackgroundPositionOptions();
return $this
->getDefaultConfigOption('background_position', $options);
}
protected function getDefaultBackgroundSize() {
$options = $this
->getBackgroundSizeOptions();
return $this
->getDefaultConfigOption('background_size', $options);
}
protected function getDefaultBackgroundOverlay() {
$options = $this
->getBackgroundOverlayOptions();
return $this
->getDefaultConfigOption('background_overlay', $options);
}
protected function getDefaultEqualTopBottomMargin() {
$options = $this
->getEqualTopBottomMarginsOptions();
return $this
->getDefaultConfigOption('equal_top_bottom_margins', $options);
}
protected function getDefaultEqualLeftRightMargin() {
$options = $this
->getEqualLeftRightMarginsOptions();
return $this
->getDefaultConfigOption('equal_left_right_margins', $options);
}
protected function getDefaultTopMargin() {
$options = $this
->getTopMarginOptions();
return $this
->getDefaultConfigOption('top_margin', $options);
}
protected function getDefaultRightMargin() {
$options = $this
->getRightMarginOptions();
return $this
->getDefaultConfigOption('right_margin', $options);
}
protected function getDefaultBottomMargin() {
$options = $this
->getBottomMarginOptions();
return $this
->getDefaultConfigOption('bottom_margin', $options);
}
protected function getDefaultLeftMargin() {
$options = $this
->getLeftMarginOptions();
return $this
->getDefaultConfigOption('left_margin', $options);
}
protected function getDefaultEqualTopBottomPadding() {
$options = $this
->getEqualTopBottomPaddingsOptions();
return $this
->getDefaultConfigOption('equal_top_bottom_paddings', $options);
}
protected function getDefaultEqualLeftRightPadding() {
$options = $this
->getEqualLeftRightPaddingsOptions();
return $this
->getDefaultConfigOption('equal_left_right_paddings', $options);
}
protected function getDefaultTopPadding() {
$options = $this
->getTopPaddingOptions();
return $this
->getDefaultConfigOption('top_padding', $options);
}
protected function getDefaultRightPadding() {
$options = $this
->getRightPaddingOptions();
return $this
->getDefaultConfigOption('right_padding', $options);
}
protected function getDefaultBottomPadding() {
$options = $this
->getBottomPaddingOptions();
return $this
->getDefaultConfigOption('bottom_padding', $options);
}
protected function getDefaultLeftPadding() {
$options = $this
->getLeftPaddingOptions();
return $this
->getDefaultConfigOption('left_padding', $options);
}
protected function getDefaultContainer() {
$options = $this
->getContainerOptions();
return $this
->getDefaultConfigOption('container', $options);
}
protected function getDefaultContentContainer() {
$options = $this
->getContentContainerOptions();
return $this
->getDefaultConfigOption('content_container', $options);
}
protected function getDefaultHeight() {
$options = $this
->getHeightOptions();
return $this
->getDefaultConfigOption('height', $options);
}
protected function getDefaultColor() {
$options = $this
->getColorsOptions();
return $this
->getDefaultConfigOption('color', $options);
}
protected function getDefaultAlignment() {
$options = $this
->getAlignmentOptions();
return $this
->getDefaultConfigOption('alignment', $options);
}
protected function getDefaultColumnGap() {
$options = $this
->getColumnGapOptions();
return $this
->getDefaultConfigOption('column_gap', $options);
}
protected function getDefaultRowGap() {
$options = $this
->getRowGapOptions();
return $this
->getDefaultConfigOption('row_gap', $options);
}
protected function getDefaultColumnBreakpoint() {
$options = $this
->getColumnBreakpointOptions();
return $this
->getDefaultConfigOption('column_breakpoint', $options);
}
protected function getDefaultColumnWidth() {
$options = $this
->getColumnWidthOptions();
return $this
->getDefaultConfigOption('column_width', $options);
}
protected function getDefaultAlignItems() {
$options = $this
->getColumnWidthOptions();
return $this
->getDefaultConfigOption('align_items', $options);
}
protected function getDefaultModifiers() {
$options = $this
->getModifiersOptions();
return $this
->getDefaultConfigOption('modifier', $options);
}
protected function getDefaultCustomizableColumns() {
$options = $this
->getCustomizableColumnsOptions();
return $this
->getDefaultConfigOption('customizable_columns', $options);
}
protected function isMultipleColumnsLayout() {
return FALSE;
}
protected function enableImageBackground() {
return FALSE;
}
protected abstract function getBackgroundOptions();
protected function getBackgroundImageStyleOptions() {
$image_styles = ImageStyle::loadMultiple();
$options = [
'' => $this
->t('None'),
];
foreach ($image_styles as $style) {
$options[$style
->id()] = $style
->label();
}
return $options;
}
protected abstract function getBackgroundAttachmentOptions();
protected abstract function getBackgroundPositionOptions();
protected abstract function getBackgroundSizeOptions();
protected abstract function getBackgroundOverlayOptions();
protected abstract function getEqualTopBottomMarginsOptions();
protected abstract function getEqualLeftRightMarginsOptions();
protected abstract function getTopMarginOptions();
protected abstract function getRightMarginOptions();
protected abstract function getBottomMarginOptions();
protected abstract function getLeftMarginOptions();
protected abstract function getEqualTopBottomPaddingsOptions();
protected abstract function getEqualLeftRightPaddingsOptions();
protected abstract function getTopPaddingOptions();
protected abstract function getRightPaddingOptions();
protected abstract function getBottomPaddingOptions();
protected abstract function getLeftPaddingOptions();
protected abstract function getContainerOptions();
protected abstract function getContentContainerOptions();
protected abstract function getHeightOptions();
protected abstract function getColorsOptions();
protected abstract function getAlignmentOptions();
protected abstract function getColumnGapOptions();
protected abstract function getRowGapOptions();
protected abstract function getColumnBreakpointOptions();
protected abstract function getColumnWidthOptions();
protected abstract function getAlignItemsOptions();
protected abstract function getModifiersOptions();
protected abstract function getCustomizableColumnsOptions();
}