class PluginFormBase

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/PluginFormBase.php \Drupal\Core\Plugin\PluginFormBase
  2. 10 core/lib/Drupal/Core/Plugin/PluginFormBase.php \Drupal\Core\Plugin\PluginFormBase
  3. 11.x 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

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
PluginFormBase::$plugin protected property The plugin this form is for. 3
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. 32
PluginFormInterface::submitConfigurationForm public function Form submission handler. 31

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.