You are here

public function EntityDescriptionFormTrait::save in Lightning Core 8

Same name and namespace in other branches
  1. 8.5 src/EntityDescriptionFormTrait.php \Drupal\lightning_core\EntityDescriptionFormTrait::save()
  2. 8.2 src/EntityDescriptionFormTrait.php \Drupal\lightning_core\EntityDescriptionFormTrait::save()
  3. 8.3 src/EntityDescriptionFormTrait.php \Drupal\lightning_core\EntityDescriptionFormTrait::save()
  4. 8.4 src/EntityDescriptionFormTrait.php \Drupal\lightning_core\EntityDescriptionFormTrait::save()

File

src/EntityDescriptionFormTrait.php, line 37

Class

EntityDescriptionFormTrait
Adds description support to entity forms.

Namespace

Drupal\lightning_core

Code

public function save(array $form, FormStateInterface $form_state) {
  $this
    ->getEntity()
    ->setDescription($form_state
    ->getValue('description'));
  parent::save($form, $form_state);

  // The help text block is very likely to be render cached, so invalidate the
  // relevant cache tag.
  //
  // @see lightning_core_block_view_alter()
  // @see lightning_core_help().
  $this
    ->cacheTagInvalidator()
    ->invalidateTags([
    'block_view:help_block',
  ]);
}