You are here

public function PathautoPattern::replaceRelationship in Pathauto 8

Replaces a relationship.

Only already existing relationships are updated.

Parameters

string $token: Relationship identifier.

string|null $label: (optional) A label, will use the label of the referenced context if not provided.

Return value

$this

Overrides PathautoPatternInterface::replaceRelationship

File

src/Entity/PathautoPattern.php, line 268

Class

PathautoPattern
Defines the Pathauto pattern entity.

Namespace

Drupal\pathauto\Entity

Code

public function replaceRelationship($token, $label) {
  if ($this
    ->hasRelationship($token)) {
    $this->relationships[$token] = [
      'label' => $label,
    ];
  }
  return $this;
}