class SaveEntity
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/action_test/src/Plugin/Action/SaveEntity.php \Drupal\action_test\Plugin\Action\SaveEntity
Provides an operation to save user entities.
Plugin annotation
@Action(
id = "action_test_save_entity",
label = @Translation("Saves entities"),
type = "user"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\Core\Action\ActionBase extends \Drupal\Core\Action\ActionInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\action_test\Plugin\Action\SaveEntity implements \Drupal\Core\Action\ActionBase
- class \Drupal\Core\Action\ActionBase extends \Drupal\Core\Action\ActionInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of SaveEntity
File
-
core/
modules/ system/ tests/ modules/ action_test/ src/ Plugin/ Action/ SaveEntity.php, line 17
Namespace
Drupal\action_test\Plugin\ActionView source
class SaveEntity extends ActionBase {
/**
* {@inheritdoc}
*/
public function execute($entity = NULL) {
$entity->save();
}
/**
* {@inheritdoc}
*/
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
/** @var \Drupal\Core\Entity\EntityInterface $object */
return $object->access('update', $account, $return_as_object);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.