PluginWithFormsTrait.php
Same filename in other branches
Namespace
Drupal\Core\PluginFile
-
core/
lib/ Drupal/ Core/ Plugin/ PluginWithFormsTrait.php
View source
<?php
namespace Drupal\Core\Plugin;
/**
* Provides a trait with typical behavior for plugins which have forms.
*/
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));
}
}
Traits
Title | Deprecated | Summary |
---|---|---|
PluginWithFormsTrait | Provides a trait with typical behavior for plugins which have forms. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.