You are here

public function PluginWithFormsTrait::getFormClass in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Plugin/PluginWithFormsTrait.php \Drupal\Core\Plugin\PluginWithFormsTrait::getFormClass()
  2. 9 core/lib/Drupal/Core/Plugin/PluginWithFormsTrait.php \Drupal\Core\Plugin\PluginWithFormsTrait::getFormClass()

Implements \Drupal\Core\Plugin\PluginWithFormsInterface::getFormClass().

File

core/lib/Drupal/Core/Plugin/PluginWithFormsTrait.php, line 13

Class

PluginWithFormsTrait
Provides a trait with typical behavior for plugins which have forms.

Namespace

Drupal\Core\Plugin

Code

public function getFormClass($operation) {
  if (isset($this
    ->getPluginDefinition()['forms'][$operation])) {
    return $this
      ->getPluginDefinition()['forms'][$operation];
  }
  elseif ($operation === 'configure' && $this instanceof PluginFormInterface) {
    return static::class;
  }
}