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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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.