You are here

public function PathautoPattern::addRelationship in Pathauto 8

Adds a relationship.

The relationship will not be changed if it already exists.

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::addRelationship

File

src/Entity/PathautoPattern.php, line 256

Class

PathautoPattern
Defines the Pathauto pattern entity.

Namespace

Drupal\pathauto\Entity

Code

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