public function ProtectionRule::setProtectedEntityTypeId in User protect 8
Sets the protected entity type id.
Parameters
string $entity_type_id: ID of the entity type that should be protected.
Return value
\Drupal\userprotect\Entity\ProtectionRuleInterface The class instance this method is called on.
Throws
\InvalidArgumentException Thrown if $entity_type_id is invalid.
Overrides ProtectionRuleInterface::setProtectedEntityTypeId
File
- src/Entity/ ProtectionRule.php, line 135 
Class
- ProtectionRule
- Defines the Protection rule entity.
Namespace
Drupal\userprotect\EntityCode
public function setProtectedEntityTypeId($entity_type_id) {
  // Check if given entity type exists. An InvalidArgumentException will be
  // thrown if not.
  \Drupal::entityTypeManager()
    ->getDefinition($entity_type_id, TRUE);
  $this->protectedEntityTypeId = $entity_type_id;
  return $this;
}