PluginWithFormsTrait.php in Drupal 9
Same filename and directory in other branches
Namespace
Drupal\Core\PluginFile
core/lib/Drupal/Core/Plugin/PluginWithFormsTrait.phpView source
<?php
namespace Drupal\Core\Plugin;
/**
* Provides a trait with typical behavior for plugins which have forms.
*/
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));
}
}
Traits
Name![]() |
Description |
---|---|
PluginWithFormsTrait | Provides a trait with typical behavior for plugins which have forms. |