You are here

public function ViewmodepagePattern::addRelationship in View Mode Page 3.2.x

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

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

File

src/Entity/ViewmodepagePattern.php, line 348

Class

ViewmodepagePattern
Defines the Viewmodepage pattern entity.

Namespace

Drupal\view_mode_page\Entity

Code

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