![]()
Table of Contents
Mastering Drupal 8 Views
Credits
Foreword
About the Author
Acknowledgements
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
A short history
Drupal is always changing
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the color images of this book
Errata
Piracy
Questions
1. Up and Running with Views
Drupal 8 is here, should I upgrade?
Looking at the Views administration page
Views settings
Views advanced settings
Views basic settings
Live Preview Settings
Adapting an existing View
Editing the Property Maintenance view
Debugging â Live Preview is your friend
Summary
2. Views from Scratch
A first try at listing the available properties
Adding a new view
New page settings
Adding fields
The anatomy of a view
View Types
Content
Content revisions
Comments
Log entries
Files
Taxonomy terms
Users
Custom blocks
Custom block revisions
Other View Types
Displays
Master
Page
Block
Attachment
Embed
Entity reference
Feed
REST export
Display Formats
The unformatted list
The HTML list
Grid
Table
Display Contents
Fields
Content/entity
Search results
Showing the Watchdog logs
Adding the Views
The view edit page
Summary
3. Sorting and Filtering
Changing the sort order
Deleting a sort criteria
Adding a sort criteria
Multilevel sorts
Grouping
Exposed sort fields
Filtering results
The "To Be Published" View for administrators
Filtering by node status
Filtering by content type â compound filters
Filtering by field value
Exposed filters â giving power to your visitors
Exposed filter options
Summary
4. Contextual Filters
Contextual filters are filters in a different place
Adding an image map linked to neighborhood listings
Adding a contextual filter
Finishing the image map
Using default values to "create" options
Adding a block view for unpublished properties
Default filter value options
Finishing up the view and testing
Contextual filter options explained
Options for no value
Default value options
Default value exception options
Value present options
Validation options
Non-permissions-based validation options
Permissions-based validation options
Options inside the More fieldset
Numeric fields
String fields
Glossary mode
URL transformation
Multiple values
Role and taxonomy field options
Null fields
Summary
5. Relationships
Fixing the neighborhood property listing title
Adding a relationship
Relationships often add new fields
What are relationships?
Blue Drop website relationships
Relationship "direction"
Reverse relationships
Automatic reverse relationships
Adding realtor information to the property listings
Adding new fields
Debugging when you forget to specify the relationship
Adding an open house attachment display to the property listings view
Defining what to attach a view to
Adding the relationship
Cleaning up what is displayed
Adding Open House fields to display
Adding exposed filters to the attachment
Other relationship considerations
Picking the right View Type
Lynn's next assignment
Summary
6. Add-on Modules
Adding a rotating carousel to the front page
Install the Views Slideshow Module
Add a new view
Add fields
Adding a filter
Debugging slide rotation
Installing the jquery.cycle library
jquery.cycle options
Mapping content
Creating a view for the map
Adding the geolocation field
Doing away with pagers â creating an infinite page
Creating an infinite scroll property image gallery
Expandable accordions hide and show content
Putting one View inside another
Creating the child view
Creating the parent view
Debugging the configuration
Adding a calendar of open houses
Installing the Calendar and Views Templates modules
Adding a calendar view
Adding a relationship to properties
Final view adjustments
Summary
7. Field Rewrites
Linking to anything
Introducing field rewrites
Linking to content
Excluding from display
Field render as URL options
Changing how fields are output
Open house formatting
Property map enhanced bubble displays
Adding fields to the display
Rewriting several fields into one
Using HTML to format the rewritten field
If-then-else conditional rewrites
No results options
Starting at the end
Going beyond two levels
Other uses for field rewrites
Summary
8. Customizing Views
Display settings
Attachment
Block
Embed
Entity Reference
Feed
Page
REST export
Header, Footer, and No Results Behavior
Pager
Replacing Drupal 7's mini pager
Pager options
Adding No Results and Footer to Available Property Listings
Summary
9. Advanced View Settings
Becoming advanced
Revisiting Header/Footer options
Contextual filters and relationships
Advanced options
Exposed form in block
Using AJAX to update pages
Hiding attachments and enabling contextual links
Changing the SQL queries generated by views
Query settings
Reading from a secondary database server
Developer options
Using aggregation
Aggregation type
Grouping
Making Views go fast
Caching types
Dinner plans
Summary
10. Theming Views
Time to theme
Designing mock-ups for the new site
Changing generated HTML and CSS from the Views UI
Structure of a View's output
The entire View CSS settings
Theme debugging
Row CSS
Field HTML and CSS
When the HTML code needs to change
A quick review of the Drupal 8 theming changes
Drupal 7's PHPTemplate version of views-view.tpl.php
Drupal 8's Twig version of views-view.tpl.php
Twig variables
Enabling theme/Twig debugging
Views templates
Template suggestions
Going live and accolades
Summary
A. Content Types for a Sample Site
Property
Property Owner
Realtor
Open House
County Taxonomy
Neighborhood Taxonomy
Index
![]()
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing, and its dealers and distributors will be held liable for a...