Images with reference

Rating

If there is a number field eg. rating, reduction, price, age,.. then it is possible to change the number into an image. It looks more attractive then just the number.

You can do this either:

  • with computed field
  • rewriting a view field
  • with a reference field

We will discuss the last option. An example.. I choose rating as a number.

Drupal8_001616.png

It shows as a picture.

First we make a content type for the images.. Just an image field..

Drupal8_001611.png

We make the nodes for every option. The title will be our options in the refernece field.


Drupal8_001612.png

Every time we use the corresponding image.


Drupal8_001613.png

then we implement in another content type the field
Drupal8_001614.png

Referencing the image content type.


Drupal8_001615.png
Make in the content typ that in the view mode, you render the entity.
Drupal8_001617.png