Twig D8 Field Format Is it possible via Twig to output a field's value, that uses the fields formatter. I would like to display a file field two different ways in the same twig file. The first will be a link to the file with a label to the left. The second will be the SOLR Extract text from the file, with a label on the left.

Here are the formatters I am talking about.



As shown in the second image, there are multiple options for how to display the field. Is there a way in Twig to do something like the following.

{{ content.field_name.FORMATTER_NAME_HERE }} or
{{ content.field_name[0].value | FORMATTER_NAME_HERE }}


I would like to use the URL to file and Text extracted from attachment formatters.
There's no out of the box way to display a field in twig with two different formatters.  But it can be done with a hook in a custom module.

You can repurpose a field in hook_entity_view or hook_ENTITY_TYPE_view().

Here's an example:

function mymodule_entity_view(array &amp;$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {

  if ($entity-&gt;getEntityTypeId() == 'node' &amp;&amp; $entity-&gt;bundle() == 'article' &amp;&amp; $view_mode == 'teaser') {   
    $settings = [
      'type' =&gt; 'pdf_special_formatter',
      'settings' =&gt; $build['field_pdf']['#items']-&gt;getSettings(),
    ];
    $build['pdf_alternate_display'] = $build['field_pdf']['#items']-&gt;view($settings);

  }  
}


Note that the settings may need to be altered before sending to another field formatter.  You'll have to look at that field formatter for the required settings.