You are here

class BaseOneColumnLayout in Layout Builder Base 8

Configurable layout plugin class.

@internal Plugin classes are internal.

Hierarchy

Expanded class hierarchy of BaseOneColumnLayout

1 string reference to 'BaseOneColumnLayout'
layout_builder_base_library.layouts.yml in modules/layout_builder_base_library/layout_builder_base_library.layouts.yml
modules/layout_builder_base_library/layout_builder_base_library.layouts.yml

File

modules/layout_builder_base_library/src/Plugin/Layout/BaseOneColumnLayout.php, line 17

Namespace

Drupal\layout_builder_base_library\Plugin\Layout
View source
class BaseOneColumnLayout extends DefaultLayoutBase implements ContainerFactoryPluginInterface {

  /**
   * The module handler service.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  protected $moduleHandler;

  /**
   * Constructs a BaseOneColumnLayout object.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *    The config factory service.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $account
   *    The module handler service.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler) {
    $this->moduleHandler = $module_handler;
    parent::__construct($configuration, $plugin_id, $plugin_definition, $config_factory);
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('config.factory'), $container
      ->get('module_handler'));
  }

  /**
   * {@inheritdoc}
   */
  protected function getBackgroundOptions() {
    $options = [
      'layout--background--none' => $this
        ->t('None'),
      'layout--background--white' => $this
        ->t('White'),
      'layout--background--grey' => $this
        ->t('Grey'),
      'layout--background--black' => $this
        ->t('Black'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_background', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getBackgroundAttachmentOptions() {
    $options = [
      'layout--background-attachment--default' => $this
        ->t('Default'),
      'layout--background-attachment--fixed' => $this
        ->t('Fixed'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_background_attachment', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getBackgroundPositionOptions() {
    $options = [
      'layout--background-position--default' => $this
        ->t('Default'),
      'layout--background-position--center' => $this
        ->t('Center'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_background_position', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getBackgroundSizeOptions() {
    $options = [
      'layout--background-size--default' => $this
        ->t('Default'),
      'layout--background-size--cover' => $this
        ->t('Cover'),
      'layout--background-size--contain' => $this
        ->t('Contain'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_background_size', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getBackgroundOverlayOptions() {
    $options = [
      'layout--background-overlay--none' => $this
        ->t('None'),
      'layout--background-overlay--dark-light' => $this
        ->t('Light Dark'),
      'layout--background-overlay--dark' => $this
        ->t('Dark'),
      'layout--background-overlay--darker' => $this
        ->t('Darker'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_background_overlay', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getTopMarginOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--top-margin--none' => $this
        ->t('None'),
      'layout--top-margin--small' => $this
        ->t('Small margin'),
      'layout--top-margin--default' => $this
        ->t('Default margin'),
      'layout--top-margin--big' => $this
        ->t('Big margin'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_top_margin', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getBottomMarginOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--bottom-margin--none' => $this
        ->t('None'),
      'layout--bottom-margin--small' => $this
        ->t('Small margin'),
      'layout--bottom-margin--default' => $this
        ->t('Default margin'),
      'layout--bottom-margin--big' => $this
        ->t('Big margin'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_bottom_margin', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getLeftMarginOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--left-margin--none' => $this
        ->t('None'),
      'layout--left-margin--small' => $this
        ->t('Small margin'),
      'layout--left-margin--default' => $this
        ->t('Default margin'),
      'layout--left-margin--big' => $this
        ->t('Big margin'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_left_margin', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getRightMarginOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--right-margin--none' => $this
        ->t('None'),
      'layout--right-margin--small' => $this
        ->t('Small margin'),
      'layout--right-margin--default' => $this
        ->t('Default margin'),
      'layout--right-margin--big' => $this
        ->t('Big margin'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_right_margin', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getEqualTopBottomMarginsOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--top-bottom-margin--none' => $this
        ->t('None'),
      'layout--top-bottom-margin--small' => $this
        ->t('Small margins'),
      'layout--top-bottom-margin--default' => $this
        ->t('Default margins'),
      'layout--top-bottom-margin--big' => $this
        ->t('Big margins'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_top_bottom_margins', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getEqualLeftRightMarginsOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--left-right-margin--none' => $this
        ->t('None'),
      'layout--left-right-margin--small' => $this
        ->t('Small margins'),
      'layout--left-right-margin--default' => $this
        ->t('Default margins'),
      'layout--left-right-margin--big' => $this
        ->t('Big margins'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_left_right_margins', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getTopPaddingOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--top-padding--none' => $this
        ->t('None'),
      'layout--top-padding--small' => $this
        ->t('Small padding'),
      'layout--top-padding--default' => $this
        ->t('Default padding'),
      'layout--top-padding--big' => $this
        ->t('Big padding'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_top_padding', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getBottomPaddingOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--bottom-padding--none' => $this
        ->t('None'),
      'layout--bottom-padding--small' => $this
        ->t('Small padding'),
      'layout--bottom-padding--default' => $this
        ->t('Default padding'),
      'layout--bottom-padding--big' => $this
        ->t('Big padding'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_bottom_padding', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getLeftPaddingOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--left-padding--none' => $this
        ->t('None'),
      'layout--left-padding--small' => $this
        ->t('Small padding'),
      'layout--left-padding--default' => $this
        ->t('Default padding'),
      'layout--left-padding--big' => $this
        ->t('Big padding'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_left_padding', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getRightPaddingOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--right-padding--none' => $this
        ->t('None'),
      'layout--right-padding--small' => $this
        ->t('Small padding'),
      'layout--right-padding--default' => $this
        ->t('Default padding'),
      'layout--right-padding--big' => $this
        ->t('Big padding'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_right_padding', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getEqualTopBottomPaddingsOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--top-bottom-padding--none' => $this
        ->t('None'),
      'layout--top-bottom-padding--small' => $this
        ->t('Small paddings'),
      'layout--top-bottom-padding--default' => $this
        ->t('Default paddings'),
      'layout--top-bottom-padding--big' => $this
        ->t('Big paddings'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_top_bottom_paddings', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getEqualLeftRightPaddingsOptions() {
    $options = [
      '' => $this
        ->t('Choose'),
      'layout--left-right-padding--none' => $this
        ->t('None'),
      'layout--left-right-padding--small' => $this
        ->t('Small paddings'),
      'layout--left-right-padding--default' => $this
        ->t('Default paddings'),
      'layout--left-right-padding--big' => $this
        ->t('Big paddings'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_left_right_paddings', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getContainerOptions() {
    $options = [
      'layout--container--default' => $this
        ->t('Default'),
      'layout--container--none' => $this
        ->t('None'),
      'layout--container--small' => $this
        ->t('Small'),
      'layout--container--large' => $this
        ->t('Large'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_container', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getContentContainerOptions() {
    $options = [
      'layout--content-container--none' => $this
        ->t('None'),
      'layout--content-container--small' => $this
        ->t('Small'),
      'layout--content-container--default' => $this
        ->t('Default'),
      'layout--content-container--large' => $this
        ->t('Large'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_content_container', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getHeightOptions() {
    $options = [
      'layout--height--default' => $this
        ->t('Default'),
      'layout--height--100vh' => $this
        ->t('100vh'),
      'layout--height--80vh' => $this
        ->t('80vh'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_height', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getColorsOptions() {
    $options = [
      'layout--color--default' => $this
        ->t('Default'),
      'layout--color--black' => $this
        ->t('Black'),
      'layout--color--white' => $this
        ->t('White'),
      'layout--color--grey' => $this
        ->t('Grey'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_color', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getAlignmentOptions() {
    $options = [
      '' => $this
        ->t('Default'),
      'layout--alignment--left' => $this
        ->t('Left'),
      'layout--alignment--right' => $this
        ->t('Right'),
      'layout--alignment--center' => $this
        ->t('Center'),
      'layout--alignment--justify' => $this
        ->t('Justify'),
    ];
    $this->moduleHandler
      ->alter('layout_builder_base_alignment', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function getModifiersOptions() {
    $options = [];
    $this->moduleHandler
      ->alter('layout_builder_base_modifiers', $options);
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  protected function enableImageBackground() {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function build(array $regions) {
    $build = parent::build($regions);
    $build['#attached']['library'][] = 'layout_builder_base_library/layout-builder-base-library';
    return $build;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BaseLayoutBase::$layoutBuilderBaseSettings protected property The layout builder base settings.
BaseLayoutBase::buildConfigurationForm public function Form constructor. Overrides MultiWidthLayoutBase::buildConfigurationForm
BaseLayoutBase::defaultConfiguration public function Gets default configuration for this plugin. Overrides MultiWidthLayoutBase::defaultConfiguration
BaseLayoutBase::getBackgroundImageStyleOptions protected function Gets the background image style options for the configuration form.
BaseLayoutBase::getDefaultAlignItems protected function Get the default align items option.
BaseLayoutBase::getDefaultAlignment protected function Get the default alignment option.
BaseLayoutBase::getDefaultBackground protected function Get the default background option.
BaseLayoutBase::getDefaultBackgroundAttachment protected function Get the default background attachment option.
BaseLayoutBase::getDefaultBackgroundImageStyle protected function Get the default image style background option.
BaseLayoutBase::getDefaultBackgroundOverlay protected function Get the default background overlay option.
BaseLayoutBase::getDefaultBackgroundPosition protected function Get the default background position option.
BaseLayoutBase::getDefaultBackgroundSize protected function Get the default background size option.
BaseLayoutBase::getDefaultBottomMargin protected function Get the default bottom margin option.
BaseLayoutBase::getDefaultBottomPadding protected function Get the default bottom padding option.
BaseLayoutBase::getDefaultColor protected function Get the default color option.
BaseLayoutBase::getDefaultColumnBreakpoint protected function Get the default column breakpoint option.
BaseLayoutBase::getDefaultColumnGap protected function Get the default column gap option.
BaseLayoutBase::getDefaultColumnWidth protected function Get the default column width option. 2
BaseLayoutBase::getDefaultConfigOption protected function Default behavior to get the default config option.
BaseLayoutBase::getDefaultContainer protected function Get the default container option.
BaseLayoutBase::getDefaultContentContainer protected function Get the default content container option.
BaseLayoutBase::getDefaultCustomizableColumns protected function Get the default customizable columns option.
BaseLayoutBase::getDefaultEqualLeftRightMargin protected function Get the default equal left right margin option.
BaseLayoutBase::getDefaultEqualLeftRightPadding protected function Get the default equal left right padding option.
BaseLayoutBase::getDefaultEqualTopBottomMargin protected function Get the default equal top bottom margin option.
BaseLayoutBase::getDefaultEqualTopBottomPadding protected function Get the default equal top bottom padding option.
BaseLayoutBase::getDefaultHeight protected function Get the default height option.
BaseLayoutBase::getDefaultImageBackground protected function Get the default background option.
BaseLayoutBase::getDefaultLeftMargin protected function Get the default left margin option.
BaseLayoutBase::getDefaultLeftPadding protected function Get the default left padding option.
BaseLayoutBase::getDefaultModifiers protected function Get the default modifiers option.
BaseLayoutBase::getDefaultRightMargin protected function Get the default right margin option.
BaseLayoutBase::getDefaultRightPadding protected function Get the default right padding option.
BaseLayoutBase::getDefaultRowGap protected function Get the default row gap option.
BaseLayoutBase::getDefaultTopMargin protected function Get the default top margin option.
BaseLayoutBase::getDefaultTopPadding protected function Get the default top padding option.
BaseLayoutBase::isMultipleColumnsLayout protected function Function to enable the multiple columns features. 1
BaseLayoutBase::submitConfigurationForm public function Form submission handler. Overrides MultiWidthLayoutBase::submitConfigurationForm
BaseOneColumnLayout::$moduleHandler protected property The module handler service.
BaseOneColumnLayout::build public function Build a render array for layout with regions. Overrides BaseLayoutBase::build 4
BaseOneColumnLayout::create public static function Creates an instance of the plugin. Overrides BaseLayoutBase::create
BaseOneColumnLayout::enableImageBackground protected function Function to enable the background image feature. Overrides BaseLayoutBase::enableImageBackground
BaseOneColumnLayout::getAlignmentOptions protected function Gets the alignment options for the configuration form. Overrides DefaultLayoutBase::getAlignmentOptions
BaseOneColumnLayout::getBackgroundAttachmentOptions protected function Gets the background attachment options for the configuration form. Overrides DefaultLayoutBase::getBackgroundAttachmentOptions
BaseOneColumnLayout::getBackgroundOptions protected function Gets the background options for the configuration form. Overrides DefaultLayoutBase::getBackgroundOptions
BaseOneColumnLayout::getBackgroundOverlayOptions protected function Gets the background overlay options for the configuration form. Overrides DefaultLayoutBase::getBackgroundOverlayOptions
BaseOneColumnLayout::getBackgroundPositionOptions protected function Gets the background position options for the configuration form. Overrides DefaultLayoutBase::getBackgroundPositionOptions
BaseOneColumnLayout::getBackgroundSizeOptions protected function Gets the background size options for the configuration form. Overrides DefaultLayoutBase::getBackgroundSizeOptions
BaseOneColumnLayout::getBottomMarginOptions protected function Gets the bottom margin options for the configuration form. Overrides DefaultLayoutBase::getBottomMarginOptions
BaseOneColumnLayout::getBottomPaddingOptions protected function Gets the bottom padding options for the configuration form. Overrides DefaultLayoutBase::getBottomPaddingOptions
BaseOneColumnLayout::getColorsOptions protected function Gets the colors options for the configuration form. Overrides DefaultLayoutBase::getColorsOptions
BaseOneColumnLayout::getContainerOptions protected function Gets the container options for the configuration form. Overrides DefaultLayoutBase::getContainerOptions
BaseOneColumnLayout::getContentContainerOptions protected function Gets the content container options for the configuration form. Overrides DefaultLayoutBase::getContentContainerOptions
BaseOneColumnLayout::getEqualLeftRightMarginsOptions protected function Gets the left and right equal margin options for the configuration form. Overrides DefaultLayoutBase::getEqualLeftRightMarginsOptions
BaseOneColumnLayout::getEqualLeftRightPaddingsOptions protected function Gets the left and right equal padding options for the configuration form. Overrides DefaultLayoutBase::getEqualLeftRightPaddingsOptions
BaseOneColumnLayout::getEqualTopBottomMarginsOptions protected function Gets the top and bottom equal margin options for the configuration form. Overrides DefaultLayoutBase::getEqualTopBottomMarginsOptions
BaseOneColumnLayout::getEqualTopBottomPaddingsOptions protected function Gets the top and bottom equal padding options for the configuration form. Overrides DefaultLayoutBase::getEqualTopBottomPaddingsOptions
BaseOneColumnLayout::getHeightOptions protected function Gets the height options for the configuration form. Overrides DefaultLayoutBase::getHeightOptions
BaseOneColumnLayout::getLeftMarginOptions protected function Gets the left margin options for the configuration form. Overrides DefaultLayoutBase::getLeftMarginOptions
BaseOneColumnLayout::getLeftPaddingOptions protected function Gets the left padding options for the configuration form. Overrides DefaultLayoutBase::getLeftPaddingOptions
BaseOneColumnLayout::getModifiersOptions protected function Gets the modifiers options for the configuration form. Overrides DefaultLayoutBase::getModifiersOptions
BaseOneColumnLayout::getRightMarginOptions protected function Gets the right margin options for the configuration form. Overrides DefaultLayoutBase::getRightMarginOptions
BaseOneColumnLayout::getRightPaddingOptions protected function Gets the right padding options for the configuration form. Overrides DefaultLayoutBase::getRightPaddingOptions
BaseOneColumnLayout::getTopMarginOptions protected function Gets the top margin options for the configuration form. Overrides DefaultLayoutBase::getTopMarginOptions
BaseOneColumnLayout::getTopPaddingOptions protected function Gets the top padding options for the configuration form. Overrides DefaultLayoutBase::getTopPaddingOptions
BaseOneColumnLayout::__construct public function Constructs a BaseOneColumnLayout object. Overrides BaseLayoutBase::__construct
DefaultLayoutBase::getAlignItemsOptions protected function Gets the align items options for the configuration form. Overrides BaseLayoutBase::getAlignItemsOptions 1
DefaultLayoutBase::getColumnBreakpointOptions protected function Gets the column breakpoint options for the configuration form. Overrides BaseLayoutBase::getColumnBreakpointOptions 1
DefaultLayoutBase::getColumnGapOptions protected function Gets the column gap options for the configuration form. Overrides BaseLayoutBase::getColumnGapOptions 1
DefaultLayoutBase::getColumnWidthOptions protected function Gets the column width options for the configuration form. Overrides BaseLayoutBase::getColumnWidthOptions 2
DefaultLayoutBase::getCustomizableColumnsOptions protected function Gets the customizable columns options for the configuration form. Overrides BaseLayoutBase::getCustomizableColumnsOptions 1
DefaultLayoutBase::getRowGapOptions protected function Gets the row gap options for the configuration form. Overrides BaseLayoutBase::getRowGapOptions 1
DefaultLayoutBase::getWidthOptions protected function Gets the width options for the configuration form. Overrides MultiWidthLayoutBase::getWidthOptions
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
LayoutDefault::$pluginDefinition protected property The layout definition. Overrides PluginBase::$pluginDefinition
LayoutDefault::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides DependentPluginInterface::calculateDependencies 2
LayoutDefault::getConfiguration public function Gets this plugin's configuration. Overrides ConfigurableInterface::getConfiguration
LayoutDefault::getPluginDefinition public function Overrides PluginBase::getPluginDefinition
LayoutDefault::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurableInterface::setConfiguration
LayoutDefault::validateConfigurationForm public function Form validation handler. Overrides PluginFormInterface::validateConfigurationForm 1
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
MultiWidthLayoutBase::getDefaultWidth protected function Provides a default value for the width options. 2
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.