How to display current pages the media entity is referenced during deletion?
Additionally to the comment, here's the snippet we used based on the entity_usage module in a hook_form_alter():

  $object = $form_state-&gt;getFormObject();
  if ($object instanceof ContentEntityDeleteForm) {
    $entity = $object-&gt;getEntity();
    $usage_data = \Drupal::service('entity_usage.usage')-&gt;listSources($entity);

    if (!empty($usage_data)) {
      $count = 0;

      foreach ($usage_data as $usage) {
        $count += count($usage);
      }

      $form['usage_warning_message'] = [
        '#type' =&gt; 'container',
        '#markup' =&gt; t('This content is used in &lt;a href="@usage_url" target="_blank"&gt;@count&lt;/a&gt; places.', [
          '@usage_url' =&gt; Url::fromRoute('entity_usage.usage_list', [
            'entity_type' =&gt; $entity-&gt;getEntityTypeId(),
            'entity_id' =&gt; $entity-&gt;id(),
          ])-&gt;toString(),
          '@count' =&gt; $count,
        ]),
        '#attributes' =&gt; [
          'class' =&gt; ['messages', 'messages--warning'],
        ],
        '#weight' =&gt; -100,
      ];
    }
  }