Drupal 10 Development Cookbook - Third Edition

Book description

Build your expertise in developing dynamic web experiences by leveraging all-new capabilities of Drupal 10 Purchase of the print or Kindle book includes a free PDF eBook

Key Features

  • Design your digital experience platform with robust content management and editorial workflows
  • Write custom modules to extend Drupal to meet your requirements by creating customized plugins, entity types, and pages
  • Enhance your Drupal site using modern frontend development build tools

Book Description

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.

What you will learn

  • Create and manage a Drupal site’s codebase
  • Design tailored content creator experiences
  • Leverage Drupal by creating customized pages and plugins
  • Turn Drupal into an API platform for exposing content to consumers
  • Import data into Drupal using the data migration APIs
  • Advance your Drupal site with modern frontend tools using Laravel Mix

Who this book is for

If you are a beginner or an intermediate Drupal developer, looking to jumpstart your journey in application building, then this book is for you. Basic knowledge of web development is required.

Table of contents

  1. Drupal 10 Development Cookbook
  2. Contributors
  3. About the authors
  4. About the reviewers
  5. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Sections
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
    5. Download the color images
    6. Download the example code files
    7. Conventions used
    8. Get in touch
    9. Share Your Thoughts
    10. Download a free PDF copy of this book
  6. Chapter 1: Up and Running with Drupal
    1. Technical requirements
    2. Creating a Drupal site
      1. Getting ready
      2. How to do it...
      3. How it works…
      4. There’s more…
      5. See also
    3. Running your Drupal site locally
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
    4. Using the Drush command-line tool
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
    5. Adding and managing module and theme extensions
      1. How to do it…
      2. How it works…
      3. There’s more…
      4. See also
    6. Managing your Drupal code with version control
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. See also
    7. Successfully deploying your Drupal site
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
  7. Chapter 2: Content Building Experience
    1. Configuring the WYSIWYG editor
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
    2. Creating an editorial workflow with content moderation
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. See also
    3. Creating a custom content type with custom fields
      1. How to do it…
      2. How it works…
    4. Customizing the form display for editing content
      1. How to do it…
      2. How it works…
      3. There’s more…
    5. Customizing the display output of content
      1. How to do it…
      2. How it works…
      3. There’s more…
    6. Using layouts to build landing pages
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
    7. Creating menus and linking content
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
    8. Using Workspaces to create content staging areas
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
  8. Chapter 3: Displaying Content through Views
    1. Creating a blog landing page
      1. How to do it…
      2. How it works…
      3. There’s more…
    2. Creating a block of recent blogs
      1. How to do it…
      2. How it works…
      3. There’s more…
    3. Exposing filters and sorts to users to control listings
      1. How to do it…
      2. How it works…
      3. There’s more…
    4. Contextual filters for filtering by path parameters
      1. How to do it…
      2. How it works…
      3. There’s more…
    5. Adding related data in a view with relationships
      1. How to do it…
      2. How it works…
      3. There’s more…
    6. Providing an entity reference result view
      1. How to do it…
      2. How it works…
    7. Displaying charts using Views
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. See also
  9. Chapter 4: Extending Drupal with Custom Code
    1. Technical requirements
    2. Creating a module
      1. How to do it…
      2. How it works…
      3. There’s more…
      4. See more…
    3. Providing configuration settings for your module
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
    4. Defining permissions and checking whether a user has access
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also…
    5. Hooking into Drupal to react to entity changes
      1. How to do it…
      2. How it works…
      3. There’s more…
    6. Creating an event subscriber to react to events
      1. How to do it…
      2. How it works…
      3. There’s more…
      4. See also
    7. Creating a custom Drush command
      1. How to do it…
      2. How it works…
      3. See also
  10. Chapter 5: Creating Custom Pages
    1. Technical requirements
    2. Defining a controller to provide a custom page
      1. How to do it…
      2. How it works…
      3. There’s more…
      4. See also
    3. Using route parameters
      1. Getting started
      2. How to do it…
      3. How it works…
      4. See also
    4. Creating a dynamic redirect page
      1. How to do it…
      2. How it works…
      3. See also
    5. Creating a JSON response
      1. How to do it…
      2. How it works…
      3. There’s more…
      4. See also
    6. Serving files for download
      1. Getting started
      2. How to do it…
      3. How it works…
  11. Chapter 6: Accessing and Working with Entities
    1. Technical requirements
    2. Creating and saving an entity
      1. How to do it…
      2. How it works…
    3. Querying and loading entities
      1. How to do it…
      2. How it works…
      3. There’s more…
    4. Checking entity access
      1. How to do it…
      2. How it works…
    5. Updating an entity’s field values
      1. How to do it…
      2. How it works…
    6. Performing entity validation
      1. How to do it…
      2. How it works…
      3. There’s more…
    7. Deleting an entity
      1. How to do it…
      2. How it works…
  12. Chapter 7: Creating Forms with the Form API
    1. Technical requirements
    2. Creating a custom form and saving configuration changes
      1. How to do it…
      2. How it works…
      3. There’s more…
      4. See also
    3. Validating form data
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. See also
    4. Specifying conditional form elements
      1. How to do it…
      2. How it works…
    5. Using AJAX in a Drupal form
      1. How to do it…
      2. How it works…
      3. There’s more…
      4. See also
    6. Customizing existing forms in Drupal
      1. How to do it…
      2. How it works…
  13. Chapter 8: Plug and Play with Plugins
    1. Technical requirements
    2. Creating blocks using plugins
      1. How to do it…
      2. How it works…
      3. There’s more…
      4. See also
    3. Creating a custom field type
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
    4. Creating a custom field widget
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
    5. Creating a custom field formatter
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more...
    6. Creating a custom plugin type
      1. How to do it…
      2. How it works…
      3. There’s more…
  14. Chapter 9: Creating Custom Entity Types
    1. Technical requirements
    2. Using custom classes for entity bundles
      1. Getting started
      2. How to do it…
      3. How it works…
      4. See also
    3. Creating a configuration entity type
      1. How to do it…
      2. How it works…
      3. There’s more…
      4. See also
    4. Creating a content entity type
      1. How to do it…
      2. How it works…
      3. There’s more…
    5. Creating a bundle for a content entity type
      1. How to do it…
      2. How it works…
    6. Implementing access control for an entity
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more...
    7. Providing a custom storage handler
      1. How to do it…
      2. How it works…
  15. Chapter 10: Theming and Frontend Development
    1. Technical requirements
    2. Creating a custom theme to style your Drupal site
      1. How to do it…
      2. How it works…
      3. There’s more
      4. See also
    3. Adding CSS and JavaScript to your theme
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more
      5. See also
    4. Using Twig templates in your theme
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more
      5. See also
    5. Delivering responsive images
      1. How to do it…
      2. How it works…
      3. See also
    6. Compiling CSS and JavaScript pre- and post-processors with Laravel Mix
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. See also
    7. Using Laravel Mix to theme your Drupal site with live reloading
      1. Getting started
      2. How to do it…
      3. How it works…
      4. There’s more
      5. See also
  16. Chapter 11: Multilingual and Internationalization
    1. Determining how the current language is selected
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
    2. Translating administrative interfaces
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
    3. Translating configuration
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
    4. Translating content
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
    5. Creating multilingual views
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
  17. Chapter 12: Building APIs with Drupal
    1. Technical requirements
    2. Fetching data from Drupal using JSON:API
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
    3. Using POST to create data with JSON:API
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. See also
    4. Using PATCH to update data with JSON:API
      1. How to do it…
      2. How it works…
    5. Using DELETE to remove data with JSON:API
      1. How to do it…
      2. How it works…
    6. Using Views to provide custom data sources
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
    7. Using OAuth methods
      1. Getting ready
      2. How to do it…
      3. How it works…
  18. Chapter 13: Writing Automated Tests in Drupal
    1. Types of tests
      1. Unit tests
      2. Kernel tests
      3. Functional tests
      4. Functional JavaScript tests
      5. NightwatchJS tests
    2. Installing the PHPUnit test suite
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
    3. Running PHPUnit
      1. How to do it…
      2. How it works…
    4. Writing a unit test
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There’s more…
      5. See also
    5. Writing a kernel test
      1. How to do it…
      2. How it works…
    6. Writing a functional test
      1. How to do it…
      2. How it works…
      3. See also
    7. Writing a functional JavaScript test
      1. How to do it…
      2. How it works…
    8. Writing a NightwatchJS test
      1. Getting ready
      2. How to do it…
      3. How it works…
  19. Chapter 14: Migrating External Data into Drupal
    1. Technical requirements
    2. Migrating from a previous version of Drupal
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Migrating data from CSV file(s)
      1. Getting ready
      2. How to do it…
    4. Migrating data from an HTTP API
      1. How to do it…
      2. How it works…
      3. There’s more…
    5. Writing a custom migration source plugin
      1. How to do it…
      2. How it works…
    6. Writing a custom process plugin for migrations
      1. How to do it…
      2. How it works…
      3. See also
  20. Index
    1. Why subscribe?
  21. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts
    3. Download a free PDF copy of this book

Product information

  • Title: Drupal 10 Development Cookbook - Third Edition
  • Author(s): Matt Glaman, Kevin Quillen
  • Release date: February 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781803234960