You are here

public function ProtectionRule::getProtection in User protect 8

Returns a specific user protection.

Parameters

string $protection: The user protection plugin ID.

Return value

\Drupal\userprotect\Plugin\UserProtection\UserProtectionInterface The user protection object.

Overrides ProtectionRuleInterface::getProtection

File

src/Entity/ProtectionRule.php, line 171

Class

ProtectionRule
Defines the Protection rule entity.

Namespace

Drupal\userprotect\Entity

Code

public function getProtection($protection) {
  return $this
    ->getProtections()
    ->get($protection);
}