trait PluginWithFormsTrait in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Plugin/PluginWithFormsTrait.php \Drupal\Core\Plugin\PluginWithFormsTrait
- 10 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 {
/**
* {@inheritdoc}
*/
public function getFormClass($operation) {
if (isset($this
->getPluginDefinition()['forms'][$operation])) {
return $this
->getPluginDefinition()['forms'][$operation];
}
elseif ($operation === 'configure' && $this instanceof PluginFormInterface) {
return static::class;
}
}
/**
* {@inheritdoc}
*/
public function hasFormClass($operation) {
return !empty($this
->getFormClass($operation));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginWithFormsTrait:: |
public | function | ||
PluginWithFormsTrait:: |
public | function |