public function PathautoState::getValue in Pathauto 8
Gets the data value.
Return value
mixed The data value.
Overrides TypedData::getValue
1 call to PathautoState::getValue()
- PathautoState::persist in src/
PathautoState.php - Persists the state.
File
- src/
PathautoState.php, line 45
Class
- PathautoState
- A property that stores in keyvalue whether an entity should receive an alias.
Namespace
Drupal\pathautoCode
public function getValue() {
if ($this->value === NULL) {
$this->value = $this
->getOriginalValue();
// If it was not yet saved or no value was found, then set the flag to
// create the alias if there is a matching pattern.
if ($this->value === NULL) {
$entity = $this->parent
->getEntity();
$pattern = \Drupal::service('pathauto.generator')
->getPatternByEntity($entity);
$this->value = !empty($pattern) ? static::CREATE : static::SKIP;
}
}
return $this->value;
}