You are here

public function SocialNodeForm::save in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_node/src/SocialNodeForm.php \Drupal\social_node\SocialNodeForm::save()
  2. 10.0.x modules/social_features/social_node/src/SocialNodeForm.php \Drupal\social_node\SocialNodeForm::save()
  3. 10.1.x modules/social_features/social_node/src/SocialNodeForm.php \Drupal\social_node\SocialNodeForm::save()

Form submission handler for the 'save' action.

Normally this method should be overridden to provide specific messages to the user and redirect the form after the entity has been saved.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

int Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.

Overrides NodeForm::save

File

modules/social_features/social_node/src/SocialNodeForm.php, line 78

Class

SocialNodeForm
Form handler for the node edit forms.

Namespace

Drupal\social_node

Code

public function save(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\node\NodeInterface $node */
  $node = clone $this->entity;
  $this
    ->messenger()
    ->setNode($node);
  parent::save($form, $form_state);
}