og-8.x-1.x-dev/src/Event/GroupContentEntityOperationAccessEvent.php
src/Event/GroupContentEntityOperationAccessEvent.php
<?php
declare(strict_types=1);
namespace Drupal\og\Event;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Event that determines access to group content entity operations.
*/
class GroupContentEntityOperationAccessEvent extends AccessEventBase implements GroupContentEntityOperationAccessEventInterface {
/**
* Constructs a GroupContentEntityOperationAccessEvent.
*
* @param string $operation
* The entity operation, such as "create", "update" or "delete".
* @param \Drupal\Core\Entity\ContentEntityInterface $group
* The group in scope of which the access check is being performed.
* @param \Drupal\Core\Entity\ContentEntityInterface $groupContent
* The group content upon which the entity operation is performed.
* @param \Drupal\Core\Session\AccountInterface $user
* The user for which to check access.
*/
public function __construct(
protected readonly string $operation,
ContentEntityInterface $group,
protected readonly ContentEntityInterface $groupContent,
AccountInterface $user,
) {
parent::__construct($group, $user);
}
/**
* {@inheritdoc}
*/
public function getOperation(): string {
return $this->operation;
}
/**
* {@inheritdoc}
*/
public function getGroupContent(): ContentEntityInterface {
return $this->groupContent;
}
}
