protected function ActionStorageController::preSave

Acts on an entity before the presave hook is invoked.

Used before the entity is saved and before invoking the presave hook.

Overrides ConfigStorageController::preSave

File

drupal/core/modules/system/lib/Drupal/system/ActionStorageController.php, line 22
Contains \Drupal\system\ActionStorageController.

Class

ActionStorageController
Defines the storage controller class for Action entities.

Namespace

Drupal\system

Code

protected function preSave(EntityInterface $entity) {
  parent::preSave($entity);
  $plugin = $entity
    ->getPlugin();

  // If this plugin has any configuration, ensure that it is set.
  if ($plugin instanceof ConfigurableActionInterface) {
    $entity
      ->set('configuration', $plugin
      ->getConfiguration());
  }
}