You are here

protected function EntityLegalDocumentForm::saveDocument in Entity Legal 3.0.x

Return value

$this

File

src/Form/EntityLegalDocumentForm.php, line 392

Class

EntityLegalDocumentForm
Base form for contact form edit forms.

Namespace

Drupal\entity_legal\Form

Code

protected function saveDocument(array $form, FormStateInterface $form_state) {
  $this->entity
    ->set('require_signup', $this->entity
    ->get('settings')['new_users']['require'])
    ->set('require_existing', $this->entity
    ->get('settings')['existing_users']['require']);
  $status = $this->entity
    ->save();
  if ($status == SAVED_NEW) {
    $form_state
      ->setRedirect('entity.entity_legal_document_version.add_form', [
      'entity_legal_document' => $this->entity
        ->id(),
    ]);
  }
  $this
    ->messenger()
    ->addStatus($this
    ->t('@type_label @label has been saved', [
    '@type_label' => $this->entity
      ->getEntityType()
      ->getLabel(),
    '@label' => $this->entity
      ->label(),
  ]));
  return $this;
}