You are here

public function PathautoPattern::preSave in Pathauto 8

Not using core's default logic around ConditionPluginCollection since it incorrectly assumes no condition will ever be applied twice.

Overrides ConfigEntityBase::preSave

File

src/Entity/PathautoPattern.php, line 145

Class

PathautoPattern
Defines the Pathauto pattern entity.

Namespace

Drupal\pathauto\Entity

Code

public function preSave(EntityStorageInterface $storage) {
  parent::preSave($storage);
  $criteria = [];
  foreach ($this
    ->getSelectionConditions() as $id => $condition) {
    $criteria[$id] = $condition
      ->getConfiguration();
  }
  $this->selection_criteria = $criteria;

  // Invalidate the static caches.
  \Drupal::service('pathauto.generator')
    ->resetCaches();
}