You are here

abstract class PluginFormBase in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Plugin/PluginFormBase.php \Drupal\Core\Plugin\PluginFormBase

Provides a base class for plugin forms.

Classes extending this can be in any namespace, but are commonly placed in the 'PluginForm' namespace, such as \Drupal\module_name\PluginForm\ClassName.

Hierarchy

Expanded class hierarchy of PluginFormBase

4 files declare their use of PluginFormBase
EmptyBlockForm.php in core/modules/block/tests/modules/block_test/src/PluginForm/EmptyBlockForm.php
SettingsTrayFormAnnotationIsClassBlockForm.php in core/modules/settings_tray/tests/modules/settings_tray_test/src/Form/SettingsTrayFormAnnotationIsClassBlockForm.php
SystemBrandingOffCanvasForm.php in core/modules/system/src/Form/SystemBrandingOffCanvasForm.php
SystemMenuOffCanvasForm.php in core/modules/system/src/Form/SystemMenuOffCanvasForm.php

File

core/lib/Drupal/Core/Plugin/PluginFormBase.php, line 15

Namespace

Drupal\Core\Plugin
View source
abstract class PluginFormBase implements PluginFormInterface, PluginAwareInterface {

  /**
   * The plugin this form is for.
   *
   * @var \Drupal\Component\Plugin\PluginInspectionInterface
   */
  protected $plugin;

  /**
   * {@inheritdoc}
   */
  public function setPlugin(PluginInspectionInterface $plugin) {
    $this->plugin = $plugin;
  }

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

    // Validation is optional.
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PluginFormBase::$plugin protected property The plugin this form is for. 4
PluginFormBase::setPlugin public function Sets the plugin for this object. Overrides PluginAwareInterface::setPlugin 1
PluginFormBase::validateConfigurationForm public function Form validation handler. Overrides PluginFormInterface::validateConfigurationForm 2
PluginFormInterface::buildConfigurationForm public function Form constructor. 37
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32