How to get an generic image icon for image field type (like Generic File formatter for file field) I have media field on a paragraph entity.
This field can hold media types, files, image etc.

Looking at admin/structure/media/manage/file/display there is a generic file formatter. However, for image - admin/structure/media/manage/image/display there is not.

So when the data is rendered, I get generic icon for word documents, but not images.

How can I get all my media items to render as generic icons?
It seems this issue is being worked on at : #2568289: Not possible to reuse field formatters between entity_reference, file, and image fields
For now I've used the following code - included in the mytheme.theme file. (view mode custom_generic_file)
use Drupal\file\Plugin\Field\FieldType\FileItem;

/**
 * Implements hook_preprocess_field().
 */
  function mytheme_preprocess_field(&amp;$variables, $hook) {
    __mytheme_preprocess_field__generic_download_icons_view_mode($variables, $hook);
  }
     
/**
 * Ensure generic icon view mode for image media entities.
 *
 * Image field type doesn't have a generic file formatter.
 *
 * Called by hook_preprocess_field().
 *
 * @see Drupal\file\Plugin\Field\FieldFormatter\GenericFileFormatter::viewElements()
 * @see https://www.drupal.org/project/drupal/issues/2568289
 */
   function __mytheme_preprocess_field__generic_download_icons_view_mode(&amp;$variables, $hook) {
  if (isset($variables['entity_type'])
    &amp;&amp; ($variables['entity_type'] == 'media')
    &amp;&amp; isset($variables['field_type'])
    &amp;&amp; ($variables['field_type'] == 'image')
    &amp;&amp; isset($variables['element']['#view_mode'])
    &amp;&amp; ($variables['element']['#view_mode'] == 'custom_generic_file')) {

    foreach ($variables['items'] as $key =&gt; $item) {
      /* @var Drupal\image\Plugin\Field\FieldType\ImageItem */
      if (isset($item['content']['#item']) &amp;&amp; $item['content']['#item'] instanceof FileItem) {
        /** @var \Drupal\Core\Entity\Plugin\DataType\EntityReference $entityReference */
        $entityReference = $item['content']['#item']-&gt;get('entity');
        /** @var \Drupal\Core\Entity\Plugin\DataType\EntityAdapter $entityAdapter */
        $entityAdapter = $entityReference-&gt;getTarget();
        /** @var \Drupal\Core\Entity\EntityInterface $file */
        /** @var \Drupal\file\Entity\File $file */
        $file = $entityAdapter-&gt;getValue();
        $item['content'] = [
          '#theme' =&gt; 'file_link',
          '#file' =&gt; $file,
          '#description' =&gt; NULL,
          '#cache' =&gt; [
            'tags' =&gt; $file-&gt;getCacheTags(),
          ],
        ];
        // Replace for real.
        $variables['items'][$key]['content'] = $item['content'];
      }
    }
  }
}