Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Drupal 8 Views

You're reading from   Mastering Drupal 8 Views Build sophisticated displays of your Drupal content, all without programming

Arrow left icon
Product type Paperback
Published in May 2016
Publisher
ISBN-13 9781785886966
Length 272 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
 Marshall Marshall
Author Profile Icon Marshall
Marshall
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Mastering Drupal 8 Views
Credits
Foreword
About the Author
Acknowledgements
About the Reviewer
www.PacktPub.com
Preface
1. Up and Running with Views FREE CHAPTER 2. Views from Scratch 3. Sorting and Filtering 4. Contextual Filters 5. Relationships 6. Add-on Modules 7. Field Rewrites 8. Customizing Views 9. Advanced View Settings 10. Theming Views Content Types for a Sample Site Index

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, you can create alternate values using pretty much the same tools you have for rewrite results. Now that you understand rewrite results, you know what is possible in the NO RESULTS BEHAVIOR field.

There are a couple of options beyond the alternative...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images