public function OgMembership::hasRole in Organic groups 8
Checks if the membership has the role with the given ID.
Parameters
string $role_id: The ID of the role to check.
Return value
bool True if the membership has the role.
Overrides OgMembershipInterface::hasRole
File
- src/
Entity/ OgMembership.php, line 349
Class
- OgMembership
- The membership entity that connects a group and a user.
Namespace
Drupal\og\EntityCode
public function hasRole(string $role_id) : bool {
return in_array($role_id, $this
->getRolesIds());
}