You are here

abstract class BlockFieldSelectionBase in Block field 8

Base class for Block field selection plugins.

Hierarchy

Expanded class hierarchy of BlockFieldSelectionBase

2 files declare their use of BlockFieldSelectionBase
Blocks.php in src/Plugin/block_field/BlockFieldSelection/Blocks.php
Categories.php in src/Plugin/block_field/BlockFieldSelection/Categories.php

File

src/BlockFieldSelectionBase.php, line 13

Namespace

Drupal\block_field
View source
abstract class BlockFieldSelectionBase extends PluginBase implements BlockFieldSelectionInterface, ConfigurableInterface {

  /**
   * Constructs a new selection 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.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this
      ->setConfiguration($configuration);
  }

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getConfiguration() {
    return $this->configuration;
  }

  /**
   * {@inheritdoc}
   */
  public function setConfiguration(array $configuration) {

    // Merge in defaults.
    $this->configuration = NestedArray::mergeDeep($this
      ->defaultConfiguration(), $configuration);
  }

  /**
   * Move settings up a level for easier processing and storage.
   */
  public function formProcessMergeParent($element) {
    $parents = $element['#parents'];
    array_pop($parents);
    $element['#parents'] = $parents;
    return $element;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockFieldSelectionBase::buildConfigurationForm public function Form constructor. Overrides PluginFormInterface::buildConfigurationForm 2
BlockFieldSelectionBase::defaultConfiguration public function Gets default configuration for this plugin. Overrides ConfigurableInterface::defaultConfiguration 2
BlockFieldSelectionBase::formProcessMergeParent public function Move settings up a level for easier processing and storage.
BlockFieldSelectionBase::getConfiguration public function Gets this plugin's configuration. Overrides ConfigurableInterface::getConfiguration
BlockFieldSelectionBase::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurableInterface::setConfiguration
BlockFieldSelectionBase::submitConfigurationForm public function Form submission handler. Overrides PluginFormInterface::submitConfigurationForm
BlockFieldSelectionBase::validateConfigurationForm public function Form validation handler. Overrides PluginFormInterface::validateConfigurationForm
BlockFieldSelectionBase::__construct public function Constructs a new selection object. Overrides PluginBase::__construct
BlockFieldSelectionInterface::getReferenceableBlockDefinitions public function Returns filtered block definitions based on plugin settings. 2
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 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::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
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.