You are here

public function ViewmodepagePattern::replaceRelationship in View Mode Page 8.3

Same name and namespace in other branches
  1. 4.0.x src/Entity/ViewmodepagePattern.php \Drupal\view_mode_page\Entity\ViewmodepagePattern::replaceRelationship()
  2. 3.2.x src/Entity/ViewmodepagePattern.php \Drupal\view_mode_page\Entity\ViewmodepagePattern::replaceRelationship()

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 ViewmodepagePatternInterface::replaceRelationship

File

src/Entity/ViewmodepagePattern.php, line 360

Class

ViewmodepagePattern
Defines the Viewmodepage pattern entity.

Namespace

Drupal\view_mode_page\Entity

Code

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