You are here

public function ViewmodepagePattern::replaceRelationship in View Mode Page 4.0.x

Same name and namespace in other branches
  1. 8.3 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;
}