You are here

public function PathautoState::persist in Pathauto 8

Persists the state.

File

src/PathautoState.php, line 98

Class

PathautoState
A property that stores in keyvalue whether an entity should receive an alias.

Namespace

Drupal\pathauto

Code

public function persist() {

  // Do nothing if current value is same as original value.
  if ($this
    ->getValue() === $this
    ->getOriginalValue()) {
    return;
  }
  \Drupal::keyValue($this
    ->getCollection())
    ->set(static::getPathautoStateKey($this->parent
    ->getEntity()
    ->id()), $this
    ->getValue());
}