Sets the value of a particular configuration option.
@todo This doesn't belong here. Move this into a new base class in http://drupal.org/node/1764380. @todo This does not set a value in config(), so the name is confusing.
string $name: The name of the configuration option to set.
mixed $value: The value to set.
\Drupal\Core\Executable\ExecutablePluginBase. The executable object for chaining.
public function setConfig($key, $value) {
if ($definition = $this
->getConfigDefinition($key)) {
$typed_data = \Drupal::typedData()
->create($definition, $value);
if ($typed_data
->validate()
->count() > 0) {
throw new PluginException("The provided configuration value does not pass validation.");
}
}
$this->configuration[$key] = $value;
return $this;
}