Mastering Drupal 8 Views

Book description

Accelerate your development process using Drupal 8 Views with this advanced, practical guide

About This Book

  • A practical, step-by-step guide with illustrative examples to give you a clear understanding of Drupal 8 views

  • Get the only book on the market that talks about Drupal 8 views and their importance for developers

  • Get an understanding of how views work and how they help to create modular applications

  • Who This Book Is For

    This book is for web developers, web designers, and website administrators who use Drupal 8, have some basic knowledge of managing and developing apps with Drupal, and who want to get an advanced, practical knowledge of views and how to leverage them in Drupal 8 applications.

    What You Will Learn

  • Create displays of content that are automatically updated when you add new content

  • Show maps and rotating image carousels on your site

  • Combine content to create composite displays using the same data in different ways

  • Use fields from more than one content type to create powerful views of multi-table data

  • Modify the field data being displayed, combining it in different ways or changing the HTML that might be normally generated

  • Add headers and footers above and below a views display

  • Make the output of your view look exactly like the designer specifies

  • Change the order in which a list of content is displayed, limit the content shown to only certain content types or values

  • Filter content using values passed to the view in the URL, making a single view work different ways

  • In Detail

    Learn how to build complex displays of content—all without programming.

    Views were used on more than 80% of all Drupal 7 sites; now they are part of the Drupal 8 core. While most site builders and site owners are aware of views, they don't understand how to take full advantage of their power to create many amazing pages and blocks. If they use views, they might build 10 different view displays with different filters, without knowing that a contextual filter would require only a single display.

    Using our sample company, we'll take its existing content and evolve an ever more complex and powerful website for that company, starting with adapting the administration the user sees and moving on to making complex pages of information for site visitors.

    Style and approach

    This is the only advanced resource that will show you how to create, customize, and manage views in the Drupal 8 development environment. This has become more important since Drupal 8 has made views part of its core architecture.

    Table of contents

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

    Product information

    • Title: Mastering Drupal 8 Views
    • Author(s): Gregg Marshall
    • Release date: May 2016
    • Publisher(s): Packt Publishing
    • ISBN: 9781785886966