You are here

public function Context::setName in Context 8.4

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

Set the machine name of the context.

Parameters

string $name: The new name to set.

Return value

$this This Context object.

Overrides ContextInterface::setName

File

src/Entity/Context.php, line 152

Class

Context
Defines the Context entity.

Namespace

Drupal\context\Entity

Code

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