trait PluginWithFormsTrait in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Plugin/PluginWithFormsTrait.php \Drupal\Core\Plugin\PluginWithFormsTrait
- 9 core/lib/Drupal/Core/Plugin/PluginWithFormsTrait.php \Drupal\Core\Plugin\PluginWithFormsTrait
Provides a trait with typical behavior for plugins which have forms.
Hierarchy
- trait \Drupal\Core\Plugin\PluginWithFormsTrait
3 files declare their use of PluginWithFormsTrait
- BlockPluginTrait.php in core/
lib/ Drupal/ Core/ Block/ BlockPluginTrait.php - PluginWithFormsTraitTest.php in core/
tests/ Drupal/ Tests/ Core/ Plugin/ PluginWithFormsTraitTest.php - WorkflowTypeBase.php in core/
modules/ workflows/ src/ Plugin/ WorkflowTypeBase.php
File
- core/
lib/ Drupal/ Core/ Plugin/ PluginWithFormsTrait.php, line 8
Namespace
Drupal\Core\PluginView source
trait PluginWithFormsTrait {
/**
* Implements \Drupal\Core\Plugin\PluginWithFormsInterface::getFormClass().
*/
public function getFormClass($operation) {
if (isset($this
->getPluginDefinition()['forms'][$operation])) {
return $this
->getPluginDefinition()['forms'][$operation];
}
elseif ($operation === 'configure' && $this instanceof PluginFormInterface) {
return static::class;
}
}
/**
* Implements \Drupal\Core\Plugin\PluginWithFormsInterface::hasFormClass().
*/
public function hasFormClass($operation) {
return !empty($this
->getFormClass($operation));
}
}