Learning Drupal 9 as a framework (The Book + project code)
Minimum price
Suggested price

Learning Drupal 9 as a framework

Your guide to custom drupal. Full project code included.

About the Book

[disclaimer: this book is for developers, not site builders!]

*2021 & 2022 best sold Drupal book on Leanpub.com!*

*4.6 author rating on Teachable (stefvanlooveren.teachable.com)*

*Updated for Drupal 9.4*


  • 235 pages of expert guidance through the drupal 9 system
  • +2400 lines of ready-to-use code snippets, full project code included
  • Learn advanced concepts of drupal, symfony and object oriented PHP
  • Build a real platform, not just separate tutorials
  • Experienced coder from another framework? This guide will suit you

This course will teach you advanced concepts of drupal 9, Object-oriented PHP and Symfony components. After the course, you’ll be able to build robust and scalable software solutions of many kinds.

In this hands-on course, a drupal expert with 10 years of experience will give you a deep dive in the power that Drupal core has to offer. 

Advanced topics like custom entities, entity forms, access control, events, caching, workflows, and many more are discussed while building an actual software. 

With +2400 lines of custom code, the author offers you powerful and ready-to-use snippets for your next drupal projects. 

Fun fact: you’ll not even be using nodes at all but only custom entities.


This is a coding book for programmers. At least one year of experience as a

developer with drupal or a related framework is required. You must be able to install

drupal on a local server with PHP > 7.4.

About the Author

Stef Van Looveren
Stef Van Looveren

Hi, I'm Stef. A full-stack software developer living near Antwerp, Belgium.

For the last eight years, I've been building websites in Drupal and Angular for government and enterprises.

More about me at


Table of Contents

    • Foreword 3
    • Part 1: Drupal developer essentials 4
    • Composer 6
    • Basic composer commands 8
    • Comparing with drupal 7 and earlier 9
    • Patching with composer 10
    • Git best practices 12
    • CLI tools 14
    • Development & Debug 19
    • Xdebug 21
    • Webprofiler 23
    • Configuration management 26
    • Basic configuration management 26
    • Creating custom configuration settings 30
    • Different configuration per environment 34
    • Scenario A: Install a module on development, but not on production. 35
    • Scenario B: disable caching on development, but not on production. 36
    • Scenario C: enable a module on both development and production, but ignore its configuration. 37
    • Reading configuration objects in your code 39
    • Part 2: Project code and set-up 40
    • Seed data 40
    • Project set-up 44
    • Part 3: Custom entities 101, CRUD operations, workflow states and access 50
    • Content entities 51
    • Building our first content entity 52
    • Securing access of our entities 57
    • Adding the create/edit/delete forms (CRUD) 62
    • Views integration of our custom entity to add a listing 68
    • Getting up-to-speed: making the entity fieldable 74
    • Media field with library 81
    • Adding fields to the custom entity via the UI 86
    • Adding workflows and moderation to custom entities 91
    • Change entity access based on workflow states 94
    • Adding views plugins: custom fields and operation links 95
    • Adding a custom controller for direct publishing 104
    • Building an overview page 108
    • Adding a custom views filter based on moderation state 113
    • Optimize the entity teaser with custom variables for twig 119
    • Adding css to views 122
    • Adding a user-friendly multistep form for entity creation 126
    • Add custom actions to the form 133
    • Conditional fields in the Form API 139
    • Updating our data seeds 141
    • Part 4: building the application. Storing, validating and rendering data 144
    • Add dynamic menu links with Menu plugins 144
    • Building the offer page with twig: theming a custom content entity 147
    • Adding a dynamic bidding form to our page with an advanced block plugin 149
    • Adding site-wide css and javascript 159
    • Adding a code-only bid entity 163
    • Saving the bid entities on form submission 167
    • Form validation based on highest bids 169
    • Add dynamic variables to our entity teaser 172
    • Validating the entity with constraints 175
    • Displaying all bids in a dynamically rendered table 178
    • Integrating the core revision system into the bidding process to raise a bid 184
    • Deleting a bid with a core dialog pop-up 190
    • Part 5: Transitions, Events, Caching and user registration 197
    • User notifications on transition events 197
    • Update entire view with custom ajax callback 200
    • OO in practice: deletion of bid and notification entities when an offer gets deleted 205
    • Caching in-depth 207
    • Caching of views pages 208
    • Caching of custom entity pages 209
    • Use of cache contexts and cache tags for caching custom blocks 211
    • Use of cacheable dependencies in render arrays 213
    • Invalidate cache of another entity after saving 217
    • Dispatch custom Events with an EventSubscriber to redirect users 219
    • Customize the user registration process with a RouteSubscriber 223
    • Finishing up the platform 232

    The Leanpub 60 Day 100% Happiness Guarantee

    Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

    Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

    You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

    So, there's no reason not to click the Add to Cart button, is there?

    See full terms...

    80% Royalties. Earn $16 on a $20 book.

    We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

    (Yes, some authors have already earned much more than that on Leanpub.)

    In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

    Learn more about writing on Leanpub

    Free Updates. DRM Free.

    If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

    Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

    Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

    Learn more about Leanpub's ebook formats and where to read them

    Write and Publish on Leanpub

    You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

    Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

    Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

    Learn more about writing on Leanpub