You are here

public function FeedType::preSave in Feeds 8.3

Acts on an entity before the presave hook is invoked.

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

Ensure that config entities which are bundles of other entities cannot have their ID changed.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

Throws

\Drupal\Core\Config\ConfigNameException Thrown when attempting to rename a bundle entity.

Overrides ConfigEntityBundleBase::preSave

File

src/Entity/FeedType.php, line 561

Class

FeedType
Defines the Feeds feed type entity.

Namespace

Drupal\feeds\Entity

Code

public function preSave(EntityStorageInterface $storage_controller, $update = TRUE) {
  foreach ($this
    ->getPlugins() as $type => $plugin) {
    $plugin
      ->onFeedTypeSave($update);
  }
  foreach ($this->targetPlugins as $delta => $target_plugin) {
    if ($target_plugin instanceof ConfigurableTargetInterface) {
      $this->mappings[$delta]['settings'] = $target_plugin
        ->getConfiguration();
    }
    else {
      unset($this->mappings[$delta]['settings']);
    }
  }
  $this->mappings = array_values($this->mappings);
  parent::preSave($storage_controller, $update);
}