4 Videos Showing How to Build a Drupal 8 Module

build a drupal 8 module

Building modules in Drupal 8 is surprisingly easy.

With just four files, you can register the module with Drupal 8, create functionality, control permissions and add a menu link to the module.

In these four videos, taken from the “How to Develop Drupal 8 Modules” class, we’re going to show how easy it is to build your first module.

All you need is a Drupal 8 site and you should be able to follow along in just a few minutes:

Video 1. Create the required module files

In this first video, you’ll set up the folder and basic files needed to register your module.

Video 2. Add your first hook

In this video, you’re going to implement your first hook. This hook will allow us to alter a form before it’s rendered.

Video 3. Add routing

Now that you’ve created a module, it’s time to make it visible. In this lesson, you’ll build a FirstController.php and a routing.yml file. This controller will create a page with a URL and the access permissions.

Video 4: Add a menu link

In this lesson, you’ll create a new file called .links.menu.yml. This file will define the menu link so that it appears on your Drupal site.


  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Article Rating
Notify of

Newest Most Voted
Inline Feedbacks
View all comments
Alexander  Rapp
Alexander Rapp
7 years ago

Thanks! Very nice tutorials!

Abdul khader
Abdul khader
7 years ago

hi sir ,, how to add url link in drupal custom module ?

7 years ago
Reply to  Abdul khader

Hi Abdul,
I’d recommend you take our module development course [url=https://www.ostraining.com/class/d8-dev/]https://www.ostraining.com/…[/url]

6 years ago

I absolutely love the way you conduct this tutorial. It really clarify me how to create custom module and how all those functions work. Many thanks!

6 years ago
Reply to  Akataa

Thanks for the positive feedback, Akataa
The full class is here if you need it: [url=https://www.ostraining.com/class/d8-dev/]https://www.ostraining.com/…[/url]

banayan media
banayan media
6 years ago

hi sir. how to create module with textfield in admin panel .

just like we are giving site name in admin panel and it display in our site.

4 years ago

Thank you! These are special extensions of the current Drupal features that help to maximally customize the solution being created on the basis of this platform. 

Would love your thoughts, please comment.x