You are here

public function Context::setLabel in Context 8.4

Same name and namespace in other branches
  1. 8 src/Entity/Context.php \Drupal\context\Entity\Context::setLabel()
  2. 8.0 src/Entity/Context.php \Drupal\context\Entity\Context::setLabel()

Set the context label.

Parameters

string $label: The new context label to set.

Return value

$this This Context object.

Overrides ContextInterface::setLabel

File

src/Entity/Context.php, line 173

Class

Context
Defines the Context entity.

Namespace

Drupal\context\Entity

Code

public function setLabel($label) {
  if (!is_string($label)) {
    throw new InvalidArgumentException('The context label must be a string.');
  }
  $this->label = $label;
  return $this;
}