You are here

public function FieldFormBase::finishSubmitForm in Display Suite 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/FieldFormBase.php \Drupal\ds\Form\FieldFormBase::finishSubmitForm()
  2. 8.2 src/Form/FieldFormBase.php \Drupal\ds\Form\FieldFormBase::finishSubmitForm()

Finishes the submit.

2 calls to FieldFormBase::finishSubmitForm()
BlockFieldConfigForm::submitForm in src/Form/BlockFieldConfigForm.php
Form submission handler.
FieldFormBase::submitForm in src/Form/FieldFormBase.php
Form submission handler.

File

src/Form/FieldFormBase.php, line 236

Class

FieldFormBase
Base form for fields.

Namespace

Drupal\ds\Form

Code

public function finishSubmitForm(array &$form, FormStateInterface $form_state) {
  $field = $this->field;

  // Save field and clear ds_fields_info cache.
  $this->cacheInvalidator
    ->invalidateTags([
    'ds_fields_info',
  ]);

  // Also clear the ds plugin cache.
  \Drupal::service('plugin.manager.ds')
    ->clearCachedDefinitions();

  // Redirect.
  $url = new Url('ds.fields_list');
  $form_state
    ->setRedirectUrl($url);
  $this
    ->messenger()
    ->addMessage($this
    ->t('The field %field has been saved.', [
    '%field' => $field['label'],
  ]));
}