If-then-else conditional rewrites

Jim continued, "There are times when you'd like to display one of two different fields depending on some condition. Almost always, when we hear that a client wants to do something like this, we start planning on custom code to implement it. Many of these would be really hard to implement in Views, but some are of the form that if I have information in field X, then display it and otherwise display field Y. These kinds of requests can be handled within Views using the REWRITE RESULTS and NO RESULTS BEHAVIOR fieldsets."

No results options

"We haven't really covered the NO RESULTS BEHAVIOR fieldset, which looks similar to this when expanded:

No Results Behavior options

This is pretty straightforward. If a field is empty, ...

Get Mastering Drupal 8 Views now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.