public function ViewmodepagePattern::addRelationship in View Mode Page 4.0.x
Same name and namespace in other branches
- 8.3 src/Entity/ViewmodepagePattern.php \Drupal\view_mode_page\Entity\ViewmodepagePattern::addRelationship()
- 3.2.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\EntityCode
public function addRelationship($token, $label = NULL) {
if (!$this
->hasRelationship($token)) {
$this->relationships[$token] = [
'label' => $label,
];
}
return $this;
}