Book Image

Drupal 10 Development Cookbook - Third Edition

By : Matt Glaman, Kevin Quillen
Book Image

Drupal 10 Development Cookbook - Third Edition

By: Matt Glaman, Kevin Quillen

Overview of this book

This new and improved third edition cookbook is packed with the latest Drupal 10 features such as a new, flexible default frontend theme - Olivero, and improved administrative experience with a new theme - Claro. This comprehensive recipe book provides updated content on the WYSIWYG (What You See Is What You Get) editing experience, improved core code performance, and code cleanup. Drupal 10 Development Cookbook begins by helping you create and manage a Drupal site. Next, you’ll get acquainted with configuring the content structure and editing content. You’ll also get to grips with all new updates of this edition, such as creating custom pages, accessing and working with entities, running and writing tests with Drupal, migrating external data into Drupal, and turning Drupal into an API platform. As you advance, you’ll learn how to customize Drupal’s features with out-of-the-box modules, contribute extensions, and write custom code to extend Drupal. By the end of this book, you’ll be able to create and manage Drupal sites, customize them to your requirements, and build custom code to deliver your projects.
Table of Contents (17 chapters)

Exposing filters and sorts to users to control listings

The Views module supports exposing filters and sorts on a view display for users to interact with to adjust the results. This can be done to allow users to filter by text or adjust the ordering of the results. In this recipe, we will modify the view used to create a blog page. We will add an exposed search filter and allow the user to sort articles from newest or oldest.

How to do it…

  1. Go to Structure and then Views. This will bring you to an administrative overview of all the views that have been created.
  2. Find the Blog view that was created in the first recipe and click on Edit.
  3. Click on Add in the Filter criteria section of the form.
  4. In the dialog that opens, we need to make sure we only modify the row format for this display. In the For drop-down menu, select This page (override) so that the changes are only for this page display and not the block display created in the previous recipe.
  5. Select...