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

4 calls to EntityForm::save()
BlockForm::save in core/modules/block/src/BlockForm.php
ImageStyleFormBase::save in core/modules/image/src/Form/ImageStyleFormBase.php
OverridesEntityForm::save in core/modules/layout_builder/src/Form/OverridesEntityForm.php
PathAliasForm::save in core/modules/path/src/PathAliasForm.php
47 methods override EntityForm::save()
ActionFormBase::save in core/modules/action/src/Form/ActionFormBase.php
BlockContentForm::save in core/modules/block_content/src/BlockContentForm.php
BlockContentTypeForm::save in core/modules/block_content/src/BlockContentTypeForm.php
BlockForm::save in core/modules/block/src/BlockForm.php
BookOutlineForm::save in core/modules/book/src/Form/BookOutlineForm.php

... See full list

File

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

Class

EntityForm
Base class for entity forms.

Namespace

Drupal\Core\Entity

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.