You are here

ConfigurableActionBase.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/lib/Drupal/Core/Action/ConfigurableActionBase.php

Namespace

Drupal\Core\Action

File

core/lib/Drupal/Core/Action/ConfigurableActionBase.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Core\Action\ConfigurableActionBase.
 */
namespace Drupal\Core\Action;

use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;

/**
 * Provides a base implementation for a configurable Action plugin.
 */
abstract class ConfigurableActionBase extends ActionBase implements ConfigurablePluginInterface, PluginFormInterface {

  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->configuration += $this
      ->defaultConfiguration();
  }

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

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

  /**
   * {@inheritdoc}
   */
  public function setConfiguration(array $configuration) {
    $this->configuration = $configuration;
  }

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

  /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    return array();
  }

}

Classes

Namesort descending Description
ConfigurableActionBase Provides a base implementation for a configurable Action plugin.