Issue #3202040 by jonathanshaw: EntityQuery accessCheck: bundle delete forms should warn of content at risk regardless of access

merge-requests/415/head
catch 2021-03-11 09:37:12 +00:00
parent f407fad818
commit aef67cd5a3
4 changed files with 4 additions and 0 deletions

View File

@ -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)) {

View File

@ -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();

View File

@ -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();

View File

@ -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();