public QuickEditController::entitySave(EntityInterface $entity)
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.
File
- core/modules/quickedit/src/QuickEditController.php, line 285
Class
- QuickEditController
- Returns responses for Quick Edit module routes.
Namespace
Drupal\quickedit
Code
public function entitySave(EntityInterface $entity) {
// 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 = array(
'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;
}
Please login to continue.