You are here

public function EntityAliasTypeBase::setContextValue in Pathauto 8

Sets the value for a defined context.

Parameters

string $name: The name of the context in the plugin definition.

mixed $value: The value to set the context to. The value has to validate against the provided context definition.

Return value

$this A context aware plugin object for chaining.

Throws

\Drupal\Component\Plugin\Exception\PluginException If the value does not pass validation.

Overrides ContextAwarePluginBase::setContextValue

File

src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php, line 335

Class

EntityAliasTypeBase
A pathauto alias type plugin for entities with canonical links.

Namespace

Drupal\pathauto\Plugin\pathauto\AliasType

Code

public function setContextValue($name, $value) {

  // Overridden to avoid merging existing cacheability metadata, which is not
  // relevant for alias type plugins.
  $this->context[$name] = new Context($this
    ->getContextDefinition($name), $value);
  return $this;
}