You are here

public function ProtectionRule::enableProtection in User protect 8

Enables a certain protection.

Parameters

string $instance_id: The ID of a user protection plugin to enable.

Return value

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

Overrides ProtectionRuleInterface::enableProtection

File

src/Entity/ProtectionRule.php, line 207

Class

ProtectionRule
Defines the Protection rule entity.

Namespace

Drupal\userprotect\Entity

Code

public function enableProtection($instance_id) {
  $this
    ->setPluginConfig($instance_id, [
    'status' => TRUE,
  ]);
  return $this;
}