Drupal 7 to Drupal 8, A Huge Jump
At the time of writing this, there are approximately 400,000 websites that are still running Drupal 7 and, with end of life approaching in January of 2025, there isn't much time left to make the change. I can only guess that one significant reason for those who haven't yet migrated is due to just how unbelievably (and intimidatingly) different Drupal became after the launch of Drupal 8. There are a million guides on how to migrate nodes, but custom modules are complicated and we need more examples for developers to follow.
Here we are on Drupal 11 now and, if we're being honest, for many the move just seems completely out of reach. It is my goal to help as many of those Drupal 7 developers as I can to become familiar with how to create custom modules within Drupal 8, 9, 10, and 11 so that they are not left stranded in an unsupported framework.
Procedural to Object Oriented
When I got my first job as a PHP developer, it was for a company that worked entirely in Drupal 7 (back when it was the latest release). When Drupal 8 came out, we couldn't fathom why such a drastic change was made... none of us had a lot of experience in object-oriented PHP--which was still relatively new itself--and we had absorbed a lot of misinformation that led us to believe that there was no benefit. "So, what, we stop using arrays and start using objects?", we thought... it's okay to laugh, we seriously had no idea.
It's important to know that you don't have to understand OOP before you understand it. What I mean is that you shouldn't be afraid to just jump in and figure it out as you go. For a lot of people, myself included, "theory" doesn't really do a lot for us... we have to get our hands dirty and watch it break and fail a lot before we understand how it's supposed to work and how it could be useful.
Bottom line: If you've been a mostly procedural PHP developer to this point, don't sweat it. People make a bigger deal out of it than it is, just eat the object-oriented elephant one bite at a time until it clicks.
D7 to D8+: A Series
I will be working on a series of (hopefully short, bite-sized) guides that teach you how to do all the things you did in Drupal 7, but in the new way that you need to do them in Drupal 8, 9, 10, and 11.
Topics I want to cover include, but are not limited to:
- "I just want to make something show up", a guide to your first controller
- Basic module creation
- From hook_menu() to Routes
- MVC principals, a discussion on how you need to develop differently in D8+ than you did in D7
- Services: A new home for your functionality
- Hooks, and why we don't like them
- Things that haven't changed (yet)
- Hooks that just won't die
- Tokens
- Common things you did in D7 and how to do them now, with modern replacements for:
- drupal_set_message()
- drupal_mail()
- Devel / dpm()
- Template files (*.tpl.php), an introduction to Twig for lazy people
- Blocks, an introduction to the Plugin API
- Can I skip straight to [latest Drupal release]?
- I'll just answer this one for you now: Yeah, basically. Don't jump into another EOL product!
- And much more...
The Plan
I'd like to get these guides going and release as quickly as possible, but I do have a day job and other obligations... so we'll see how long it takes, I suppose. In each guide, I want to provide:
- Thorough, easy to understand explanations of what we're covering and why
- References to documentation
- Practical examples using code and descriptive text
- If I am able, a video to go along with it for those who learn better by watching and listening rather than reading... like me.