Drupal 8 Module Development

Learn to create and customize impressive Drupal 8 modules to extend your website's functionalities
Preview in Mapt

Drupal 8 Module Development

Daniel Sipos

3 customer reviews
Learn to create and customize impressive Drupal 8 modules to extend your website's functionalities
Mapt Subscription
FREE
$29.99/m after trial
eBook
$10.00
RRP $35.99
Save 72%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Drupal 8 Module Development Book Cover
Drupal 8 Module Development
$ 35.99
$ 10.00
Unity 2017 Game Development Essentials - Third Edition Book Cover
Unity 2017 Game Development Essentials - Third Edition
$ 39.99
$ 10.00
Buy 2 for $20.00
Save $55.98
Add to Cart

Book Details

ISBN 139781782168775
Paperback566 pages

Book Description

Drupal is an open source web-based content management system (CMS) that can be used for building anything from simple websites to complex applications. It enables individuals and organizations to build platforms that engage users and deliver the right content at the right time.

Drupal 8 is an exciting new development in the Drupal community. However, the differences from the previous version are substantial and this can put quite some pressure on Drupal 7 developers that need to catch up. This book aims to help such developers in getting up to speed with Drupal 8 module development.

The book first introduces you to the Drupal 8 architecture and its subsystems before diving into creating your first module with basic functionality. Building upon that, you will cover many core APIs and functionalities available to module developers.

You will work with the Drupal logging and mailing systems, learn how to output data using the theme layer and work with menus and links programmatically. Then, you will learn how to work with different kinds of data storages, create custom entities, field types and leverage the Database API for lower level database queries. Moreover, you will learn about the Drupal 8 access system and caching layer as well as the APIs used for data processing (queues and batches).

You will further see how to introduce javascript into your module, work with the various file systems and ensure the code you write works on multilingual sites. Finally, you will learn how to programmatically work with Views, write automated tests for your functionality and also write secure code in general.

By the end of the book, you will have learned how to develop your own custom module from scratch that can help solve a small problem or even provide complex functionality. And who knows, maybe you’ll even contribute it back to the Drupal community.

Table of Contents

Chapter 1: Developing for Drupal 8
Introducing Drupal (for developers)
Developing for Drupal 8
Summary
Chapter 2: Creating Your First Module
Creating a module
Using services in Drupal 8
Blocks
Working with links
Event Dispatcher and redirects
Summary
Chapter 3: Logging and Mailing
Logging
Mail API
Tokens
Summary
Chapter 4: Theming
Business logic versus presentation logic
Twig
Theme hooks
Theme hook suggestions
Render arrays
Assets and libraries
Common theme hooks
Attributes
Theming our Hello World module
Summary
Chapter 5: Menus and Menu Links
The menu system
Rendering menus
Working with menu links
Defining local tasks
Defining local actions
Defining contextual links
Summary
Chapter 6: Data Modeling and Storage
Different types of data storage
State API
Tempstore
UserData
Configuration
Entities
TypedData
Interacting with the Entity API
Summary
Chapter 7: Your Own Custom Entity and Plugin Types
Custom content entity type
Drush command
Summary
Chapter 8: The Database API
The Schema API
Running queries
Summary
Chapter 9: Custom Fields
Field type
Field widget
Field formatter
Field settings
Using as a base field
Summary
Chapter 10: Access Control
Introduction to the Drupal access system
Defining permissions
Checking the user credentials
Route access
Entity access
Block access
Summary
Chapter 11: Caching
Introduction
Cacheability metadata
Placeholders and lazy building
Using the Cache API
Summary
Chapter 12: JavaScript and the Ajax API
JavaScript in Drupal
Ajax API
Summary
Chapter 13: Internationalization and Languages
Introduction
Internationalization
Content entities and the Translation API
Summary
Chapter 14: Batches, Queues, and Cron
Batch powered update hooks
Batch operations
Cron
Queues
Summary
Chapter 15: Views
Entities in Views
Exposing custom data to Views
Custom Views field
Custom Views filter
Custom Views argument
Views theming
Views hooks
Summary
Chapter 16: Working with Files and Images
The filesystem
Stream wrappers
Managed versus unmanaged files
Using the File and Image fields
Working with managed files
Our own stream wrapper
Working with unmanaged files
Private file system
Images
Summary
Chapter 17: Automated Testing
Testing methodologies in Drupal 8
PHPUnit
Registering tests
Unit tests
Kernel tests
Functional tests
Functional JavaScript tests
Summary
Chapter 18: Drupal 8 Security
Cross-Site Scripting (XSS)
SQL Injection
Cross-Site Request Forgery (CSRF)
Summary

What You Will Learn

  • Write a Drupal 8 module with custom functionality and hook into various extension points
  • Master numerous Drupal 8 sub-systems and APIs
  • Model, store, and manipulate data in various ways and for various purposes
  • Display data and content in a presentable and secure way
  • Learn about the theme system and render arrays

Authors

Table of Contents

Chapter 1: Developing for Drupal 8
Introducing Drupal (for developers)
Developing for Drupal 8
Summary
Chapter 2: Creating Your First Module
Creating a module
Using services in Drupal 8
Blocks
Working with links
Event Dispatcher and redirects
Summary
Chapter 3: Logging and Mailing
Logging
Mail API
Tokens
Summary
Chapter 4: Theming
Business logic versus presentation logic
Twig
Theme hooks
Theme hook suggestions
Render arrays
Assets and libraries
Common theme hooks
Attributes
Theming our Hello World module
Summary
Chapter 5: Menus and Menu Links
The menu system
Rendering menus
Working with menu links
Defining local tasks
Defining local actions
Defining contextual links
Summary
Chapter 6: Data Modeling and Storage
Different types of data storage
State API
Tempstore
UserData
Configuration
Entities
TypedData
Interacting with the Entity API
Summary
Chapter 7: Your Own Custom Entity and Plugin Types
Custom content entity type
Drush command
Summary
Chapter 8: The Database API
The Schema API
Running queries
Summary
Chapter 9: Custom Fields
Field type
Field widget
Field formatter
Field settings
Using as a base field
Summary
Chapter 10: Access Control
Introduction to the Drupal access system
Defining permissions
Checking the user credentials
Route access
Entity access
Block access
Summary
Chapter 11: Caching
Introduction
Cacheability metadata
Placeholders and lazy building
Using the Cache API
Summary
Chapter 12: JavaScript and the Ajax API
JavaScript in Drupal
Ajax API
Summary
Chapter 13: Internationalization and Languages
Introduction
Internationalization
Content entities and the Translation API
Summary
Chapter 14: Batches, Queues, and Cron
Batch powered update hooks
Batch operations
Cron
Queues
Summary
Chapter 15: Views
Entities in Views
Exposing custom data to Views
Custom Views field
Custom Views filter
Custom Views argument
Views theming
Views hooks
Summary
Chapter 16: Working with Files and Images
The filesystem
Stream wrappers
Managed versus unmanaged files
Using the File and Image fields
Working with managed files
Our own stream wrapper
Working with unmanaged files
Private file system
Images
Summary
Chapter 17: Automated Testing
Testing methodologies in Drupal 8
PHPUnit
Registering tests
Unit tests
Kernel tests
Functional tests
Functional JavaScript tests
Summary
Chapter 18: Drupal 8 Security
Cross-Site Scripting (XSS)
SQL Injection
Cross-Site Request Forgery (CSRF)
Summary

Book Details

ISBN 139781782168775
Paperback566 pages
Read More
From 3 reviews

Read More Reviews

Recommended for You

Drupal 8 Development Cookbook - Second Edition Book Cover
Drupal 8 Development Cookbook - Second Edition
$ 35.99
$ 10.00
Drupal 8 Development: Beginner's Guide - Second Edition Book Cover
Drupal 8 Development: Beginner's Guide - Second Edition
$ 35.99
$ 10.00
Drupal 8: Enterprise Web Development Book Cover
Drupal 8: Enterprise Web Development
$ 69.99
$ 10.00
Mastering Drupal 8 Book Cover
Mastering Drupal 8
$ 39.99
$ 10.00
Mastering Drupal 8 Book Cover
Mastering Drupal 8
$ 39.99
$ 10.00
Unity 2017 Game Development Essentials - Third Edition Book Cover
Unity 2017 Game Development Essentials - Third Edition
$ 39.99
$ 10.00