You are here

public function ProtectionRule::setPluginConfig in User protect 8

Sets the configuration for a user protection plugin instance.

Parameters

string $instance_id: The ID of a user protection plugin to set the configuration for.

array $configuration: The user protection plugin configuration to set.

Return value

\Drupal\userprotect\Entity\ProtectionRuleInterface The called protection rule entity.

Overrides ProtectionRuleInterface::setPluginConfig

2 calls to ProtectionRule::setPluginConfig()
ProtectionRule::disableProtection in src/Entity/ProtectionRule.php
Disables a certain protection.
ProtectionRule::enableProtection in src/Entity/ProtectionRule.php
Enables a certain protection.

File

src/Entity/ProtectionRule.php, line 195

Class

ProtectionRule
Defines the Protection rule entity.

Namespace

Drupal\userprotect\Entity

Code

public function setPluginConfig($instance_id, array $configuration) {
  $this->protections[$instance_id] = $configuration;
  if (isset($this->protectionsCollection)) {
    $this->protectionsCollection
      ->setInstanceConfiguration($instance_id, $configuration);
    $this->protectionsCollection
      ->sort();
  }
  return $this;
}