Change entity.field.FieldFormatter for a custom view


The correct way to implement this, is to use "Display modes": add custom "Display mode" for entity, and set the another formatter for images field. In the View settings set it to use that "Display mode" to display entity.

Tags: Theming / Drupal 8

Similar questions

Kernel base test for media view displays is failing with: LogicException: Missing bundle entity, entity type media_type, entity id image
I am trying to test media view displays via a test, which is based on the KernelTestBase class. I have also tried to inherit from Drupal\Tests\media\Kernel\MediaKernelTestBase, but got the same error from bellow: LogicException: Missing bundle entity, entity type media_type, entity id image. My test class looks like this: Does anyone know, what I a...
Theming custom entity created with Entity API: accessing entity's fields in template file
First of all let me say that this is my first project in Drupal and I am still confused, I apologize if my question is stupid. I created a custom entity in Drupal 7 using Entity API. The custom entity represents a golf course. I used this tutorial: Then I tried to add a custo...
Custom Entity: define a view in entity reference field
I defined a custom entity and for a entity reference field I want to set the view reference widget and a view/ display to be used instead of an autocomplete. I tried many different settings - nothing worked. The latest version not working is: For the form view setting I also tried and No success. Can somebody give me a hint?
How to create one entity and assign the same entity as field to new entity programatically
-I need to create one entity (need to do coding)- that I created already, now want to create another entity, lets say "Entity 2"( term(taxonomy, param1, param2, description( it will have multiple values- multiple description). Now I need to add entity 2 as field for entity 1. Entity 1 can have multiple entities of type "Entity 2"
How to change view's field (Custom-Text field specifically) value based on other field value using hook_view_pre_render?
I have created a taxonomy-term view. I have added two fields in a view: term-id and custom-text field. I want to check if term-id has children and depending upon the result, I want to set markup inside custom-text field. I am able to get term-id in hook_views_pre_render with following code, but I am not able to set the value of custom-text field I ...
Custom translatable content entity appears twice when choosing the entity type to create a view
I'm Developing a custom module with custom content entities that needs to be translatable. The problem is that when they are made translatable by adding: translatable = TRUE in the @ContentEntityType annotation, the entities appear twice in the drop down view setting options (check the image, 'Faculty' appears twice) which is really strange. I don'...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.