You are here

public function Context::setName in Context 8.0

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

Set the machine name of the context.

Parameters

string $name:

Return value

$this

Overrides ContextInterface::setName

File

src/Entity/Context.php, line 147

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;
}