Multi-value Field Settings

Learn how to customize the listing of multi-value fields in Views.

We’ll cover the following:

  • How to change the display type
  • How to display just a few items
  • And how to display the items in reverse


Trainer (00:00):
If you have a multi-value field in your view like the tags field, for example, you can control what field values are returned from the multiple field settings section. Now to demonstrate this, let’s go and edit an article and I’ll open it up in a new tab, and then click on edit. And let’s add in a different group of tags, just so that it’s easy for us to see when they change. So instead of these tags, let’s add in tag one, then add in a comma, tag two, tag three, tag four, and finally, tag five. And I’ll close this tab. And if I click on update preview, we should see our article with our five new tags. Let’s scroll back up and edit the tags field. And currently, they are displayed using a separator, which is a comma, but we can change it to whatever we want. Let’s go ahead and change it to a dash.

Trainer (01:06):
So in the separator text field, instead of the comma, add in a space, and then a dash, and another space, and also make sure you have simple separator selected, then click on apply. And if we scroll down, we can now see the tags separated by a dash. Another thing you can do is display the values as an HTML list. So let’s go and edit the field again. And from the display type section, select ordered list, click on apply, and it’ll display the tags in a numbered list, but you can also change it to an unordered list. Let’s go back up and edit the field again. And this time, select unordered list. Click on apply. And now the tags are displayed as bullet points.

Trainer (02:00):
You can also control how many field values are returned. Right now, it’s displaying all of them. But if we edit the field, and change display from zero to three, it’ll display the first three tags. You can also control from which field value to start from. By default, it starts from the first value. But let’s change it so it only displays tag three, four, and five. Let’s edit the field again and go to multiple field settings. Leave the display option set to three and change starting from to number two. The reason why we added two is because the first value is zero. Drupal counts the values starting from zero, not one.

Trainer (02:51):
Click on apply. And if we take a look at our preview, we can now only see tag three, four, and five. Another thing you can do is reverse the list. So instead of going from tag one to five, we can go from tag five to one. Let’s edit the field again, change display from three to five, and change starting from back to zero, and check reversed. And click on apply. And if we scroll down to the previous section, now the tags are in reverse order.

Trainer (03:29):
The final feature I’ll show you is how to display just the first or last field values. Let’s edit the field again and uncheck reversed, and check first and last only. Then click on apply. And if we go to the previous section, now we can only see tag one and tag five. Let’s edit tags again. And we’ll set everything back to the default. So that is the simple separator. Let’s add in a comma and let’s remove all of these options.

Scroll to Top