Issue #3202040 by jonathanshaw: EntityQuery accessCheck: bundle delete forms should warn of content at risk regardless of access
parent
f407fad818
commit
aef67cd5a3
|
@ -17,6 +17,7 @@ class BlockContentTypeDeleteForm extends EntityDeleteForm {
|
|||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$blocks = $this->entityTypeManager->getStorage('block_content')->getQuery()
|
||||
->accessCheck(FALSE)
|
||||
->condition('type', $this->entity->id())
|
||||
->execute();
|
||||
if (!empty($blocks)) {
|
||||
|
|
|
@ -65,6 +65,7 @@ class CommentTypeDeleteForm extends EntityDeleteForm {
|
|||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$comments = $this->entityTypeManager->getStorage('comment')->getQuery()
|
||||
->accessCheck(FALSE)
|
||||
->condition('comment_type', $this->entity->id())
|
||||
->execute();
|
||||
$entity_type = $this->entity->getTargetEntityTypeId();
|
||||
|
|
|
@ -45,6 +45,7 @@ class MediaTypeDeleteConfirmForm extends EntityDeleteForm {
|
|||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$num_entities = $this->entityTypeManager->getStorage('media')->getQuery()
|
||||
->accessCheck(FALSE)
|
||||
->condition('bundle', $this->entity->id())
|
||||
->count()
|
||||
->execute();
|
||||
|
|
|
@ -17,6 +17,7 @@ class NodeTypeDeleteConfirm extends EntityDeleteForm {
|
|||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$num_nodes = $this->entityTypeManager->getStorage('node')->getQuery()
|
||||
->accessCheck(FALSE)
|
||||
->condition('type', $this->entity->id())
|
||||
->count()
|
||||
->execute();
|
||||
|
|
Loading…
Reference in New Issue