class EventEnrollmentEntityDeleteAction in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/EventEnrollmentEntityDeleteAction.php \Drupal\social_event_managers\Plugin\Action\EventEnrollmentEntityDeleteAction
- 8.6 modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/EventEnrollmentEntityDeleteAction.php \Drupal\social_event_managers\Plugin\Action\EventEnrollmentEntityDeleteAction
- 8.7 modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/EventEnrollmentEntityDeleteAction.php \Drupal\social_event_managers\Plugin\Action\EventEnrollmentEntityDeleteAction
- 8.8 modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/EventEnrollmentEntityDeleteAction.php \Drupal\social_event_managers\Plugin\Action\EventEnrollmentEntityDeleteAction
- 10.3.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/EventEnrollmentEntityDeleteAction.php \Drupal\social_event_managers\Plugin\Action\EventEnrollmentEntityDeleteAction
- 10.0.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/EventEnrollmentEntityDeleteAction.php \Drupal\social_event_managers\Plugin\Action\EventEnrollmentEntityDeleteAction
- 10.1.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/EventEnrollmentEntityDeleteAction.php \Drupal\social_event_managers\Plugin\Action\EventEnrollmentEntityDeleteAction
- 10.2.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/EventEnrollmentEntityDeleteAction.php \Drupal\social_event_managers\Plugin\Action\EventEnrollmentEntityDeleteAction
Delete event enrollment entity action.
Plugin annotation
@Action(
id = "social_event_managers_delete_event_enrollment_action",
label = @Translation("Delete selected event enrollment entities"),
type = "event_enrollment",
confirm = TRUE,
confirm_form_route_name = "social_event_managers.vbo.confirm",
)
Hierarchy
- class \Drupal\social_event_managers\Plugin\Action\EventEnrollmentEntityDeleteAction extends \Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase
Expanded class hierarchy of EventEnrollmentEntityDeleteAction
File
- modules/
social_features/ social_event/ modules/ social_event_managers/ src/ Plugin/ Action/ EventEnrollmentEntityDeleteAction.php, line 22
Namespace
Drupal\social_event_managers\Plugin\ActionView source
class EventEnrollmentEntityDeleteAction extends ViewsBulkOperationsActionBase {
/**
* {@inheritdoc}
*/
public function execute($entity = NULL) {
/** @var \Drupal\social_event\EventEnrollmentInterface $entity */
$entity
->delete();
}
/**
* {@inheritdoc}
*/
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
$access = AccessResult::forbidden();
if ($object instanceof EventEnrollmentInterface) {
$access = $object
->access('delete', $account, TRUE);
$event_id = $object
->getFieldValue('field_event', 'target_id');
$node = \Drupal::entityTypeManager()
->getStorage('node')
->load($event_id);
// Also Event organizers can do this.
if ($node instanceof NodeInterface && social_event_manager_or_organizer($node)) {
$access = AccessResult::allowedIf($object instanceof EventEnrollmentInterface);
}
}
return $return_as_object ? $access : $access
->isAllowed();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EventEnrollmentEntityDeleteAction:: |
public | function | ||
EventEnrollmentEntityDeleteAction:: |
public | function |