Problem/Motivation
In the WebformElementBase class you will find the following $operations array, giving you every possible operation except "delete". As a user I would like to have a webform element overriding the access handing for deleting a webform submission. In normal situation you would not need this, but It comes on handy when you are able to override the delete access rule for webform submissions.
File: src/Plugin/WebformElementBase.php
$operations = [
'create' => [
'#title' => $this->t('Create submission'),
'#description' => $this->t('Select roles and users that should be able to populate this element when creating a new submission.'),
'#open' => TRUE,
],
'update' => [
'#title' => $this->t('Update submission'),
'#description' => $this->t('Select roles and users that should be able to update this element when updating an existing submission.'),
'#open' => FALSE,
],
'view' => [
'#title' => $this->t('View submission'),
'#description' => $this->t('Select roles and users that should be able to view this element when viewing a submission.'),
'#open' => FALSE,
],
];
Proposed resolution
A simple code change would make it possible that someone could create a webform element and using an option to override the general access rule for delete. A use case would be for the
webform_workflows_element module β
API changes
$operations = [
'create' => [
'#title' => $this->t('Create submission'),
'#description' => $this->t('Select roles and users that should be able to populate this element when creating a new submission.'),
'#open' => TRUE,
],
'update' => [
'#title' => $this->t('Update submission'),
'#description' => $this->t('Select roles and users that should be able to update this element when updating an existing submission.'),
'#open' => FALSE,
],
'view' => [
'#title' => $this->t('View submission'),
'#description' => $this->t('Select roles and users that should be able to view this element when viewing a submission.'),
'#open' => FALSE,
],
'delete' => [
'#title' => $this->t('Delete submission'),
'#description' => $this->t('Select roles and users that should be able to delete this element when deleting a submission.'),
'#open' => FALSE,
],
];