public NodeForm::submitForm(array &$form, FormStateInterface $form_state)
Updates the node object by processing the submitted values.
This function can be called by a "Next" button of a wizard to update the form state's entity with the current step's values before proceeding to the next step.
Overrides ContentEntityForm::submitForm
File
- core/modules/node/src/NodeForm.php, line 315
Class
- NodeForm
- Form handler for the node edit forms.
Namespace
Drupal\node
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | public function submitForm( array & $form , FormStateInterface $form_state ) { // Build the node object from the submitted values. parent::submitForm( $form , $form_state ); $node = $this ->entity; // Save as a new revision if requested to do so. if (! $form_state ->isValueEmpty( 'revision' ) && $form_state ->getValue( 'revision' ) != FALSE) { $node ->setNewRevision(); // If a new revision is created, save the current user as revision author. $node ->setRevisionCreationTime(REQUEST_TIME); $node ->setRevisionUserId(\Drupal::currentUser()->id()); } else { $node ->setNewRevision(FALSE); } } |
Please login to continue.