function QuickEditController::entitySave
Same name in other branches
- 9 core/modules/quickedit/src/QuickEditController.php \Drupal\quickedit\QuickEditController::entitySave()
Saves an entity into the database, from PrivateTempStore.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity being edited.
Return value
\Drupal\Core\Ajax\AjaxResponse The Ajax response.
1 string reference to 'QuickEditController::entitySave'
- quickedit.routing.yml in core/
modules/ quickedit/ quickedit.routing.yml - core/modules/quickedit/quickedit.routing.yml
File
-
core/
modules/ quickedit/ src/ QuickEditController.php, line 345
Class
- QuickEditController
- Returns responses for Quick Edit module routes.
Namespace
Drupal\quickeditCode
public function entitySave(EntityInterface $entity) {
self::checkCsrf(\Drupal::request(), \Drupal::currentUser());
// Take the entity from PrivateTempStore and save in entity storage.
// fieldForm() ensures that the PrivateTempStore copy exists ahead.
$tempstore = $this->tempStoreFactory
->get('quickedit');
$tempstore->get($entity->uuid())
->save();
$tempstore->delete($entity->uuid());
// Return information about the entity that allows a front end application
// to identify it.
$output = [
'entity_type' => $entity->getEntityTypeId(),
'entity_id' => $entity->id(),
];
// Respond to client that the entity was saved properly.
$response = new AjaxResponse();
$response->addCommand(new EntitySavedCommand($output));
return $response;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.