W3cubDocs

/Drupal 8

public function EntityForm::save

public EntityForm::save(array $form, FormStateInterface $form_state)

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 EntityFormInterface::save

File

core/lib/Drupal/Core/Entity/EntityForm.php, line 282

Class

EntityForm
Base class for entity forms.

Namespace

Drupal\Core\Entity

Code

public function save(array $form, FormStateInterface $form_state) {
  return $this->entity->save();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityForm.php/function/EntityForm::save/8.1.x