Menu

Getting Started With Drupal 9: A beginner’s guide

Since its launch on June 3, 2020, Drupal 9 has been the most liked and utilized version in the Drupal software family. Following the footsteps of its predecessor – Drupal 8 – Drupal 9 is also built on the same principles of collaboration and community that made Drupal 8 a great software for the millions. D9 came packing a variety of features and improvements that empowered the websites to offer a higher form of user experience.

In this article, let us explore what is Drupal, Drupal Installation, Drupal custom module development, themes, and what’s new in Drupal 9.

Drupal 9

What is Drupal?

WordPress is the most popular CMS across the globe with 810 million websites in 2023. However, Drupal too holds a place for itself amongst the highest-ranking websites worldwide with a grand market presence holding 3.1% of the top million sites and an even more remarkable 7.5% of the major 1,000 sites.

Drupal’s history is traced back to the year 2000 and found its way as an open-source CMS in 2001. The founder Dries Buytaert originally used it as a message board for his friends to communicate in their dorms.

A quick forward to the present, it is the most popularly used CMS around the world. In the USA, Tesla, Nokia, The European Commission, Oxford University, NASA, Grammy, and many more rely on Drupal. The CMS is widely preferred by government organizations and educational institutions. The examples given here prove the point that it works for many of the advanced sites in the world.

How is Drupal different from its competitors?

The name Drupal is coined from the Dutch word druppel, which means “drop”. The term “drop” signifies the water drop. Like mentioned above Drupal matches the advanced website requirements and also it is considered a developer-friendly CMS. By saying that, it can also be interpreted that Drupal is developer-focused and can be difficult to work on. However, it is the other way around, it is user-friendly and easy to customize.

The other two major popular CMS that equally are tough as Drupal in the CMS market is WordPress and Joomla. While WordPress stands as an easy-to-use solution with a low learning curve, Drupal is really powerful and customizable. Drupal also offers more scalability compared to its rivals when it comes to building large applications.

The 4 Easy Steps To Begin With Drupal

#Step 1:Performing a manual installation

Get a local environment or a site set up to install Drupal. Ensure it has the minimum requirements in order for the software to run without any hiccups. Keep a MySQL database for site usage purposes.

Besides that, download Drupal from the official website Drupal.org or use the command line to obtain the files you require. After the files have been installed on the site, go on to configure the installation. Access the site with a standard URL and get access to the Drupal installation wizard.

Next, start by selecting your website’s desired language; then decide if you would like a Standard or Minimal installation for the site. For those just starting out, the Standard option is usually a great pick as it won’t require any extra tweaking of settings. For the advanced feature, sets go with the advanced installation. The choice made at this juncture is likely to impact the wizard’s follow-up questions, so proceed to make whatever selections you require. If there are any questions and you want the right answers, look no further than the official documentation for guidance. Once all the necessary steps are carried out and every section has been filled, you’ll be able to add Drupal software to your website.

Once you have completed all of it, it’s time to customize your site’s settings and details. This is where you choose the website’s name and create an admin account. After all of this is done, just save the settings – Drupal will now be installed on your site and its homepage will appear. Now comes the fun part: exploring what’s in store with Admin Toolbar at the top which contains several primary options. Let’s dive into creating content for your amazing new site!

#Step 2: Creating Content

Let’s begin with the basics of creating new content with Drupal. There are numerous options for customizing the content types in Drupal CMS, but we will just focus on how to create a single post. In order to do this, select ‘Content’ from the top admin bar. If that option is not visible, click on ‘Manage’ to expand the menu. Head on over to your Content page where you can view all the content currently existing on your site.

#Step 3: Add New Functionality to Your Site Using Modules

What is a Module?

To add new features and keep your website up-to-date with the latest advancements, Drupal modules are invaluable. These collections of files allow developers to create functionalities that can expand a website’s capabilities – simply put, they’re indispensable.

With Drupal modules, you’ll be able to relish all the functionality you need on your site in no time.

Where Are Modules Found?

The most immediate and affordable way to grow Drupal’s functionality outside of the core is to engage contributed modules. Packages of code known as Contributed modules are developed by the Drupal community. These packages of codes can be downloaded and infused into your website absolutely for free.

Drupal’s website provides an extensive array of available modules that are easily accessible for download directly from the module page on drupal.org. The modules come in tar.gz and .zip formats, authorizing the convenient unpacking on your web server post-installation.

How Are Modules Useful?

Packages of code are called modules. The modules are capable of enhancing and extending the functionality of a base Drupal installation. Drupal Core is the referring term for Drupal Package. The D9 comes packing over 70 core modules and 10 themes. These modules can be viewed in the /modules directory.

Not long ago, these core module collections were vetted by the Drupal community prior to Drupal 7’s release and were chosen to include the base functionality most Drupal site administrators would need. In order to access more features, a developer or third-party modules has to be implied to extend the current functions available.

Drupal Modules – The Real source of Drupal Power

As mentioned above, the Drupal CMS is loved and used by millions across the globe. In the USA, it is the first choice for government and educational websites. Supporting the performance of the CMS are the seemingly endless thousands of core and contributed modules that enable developers to implement the perfect modules that satisfy the requirements.

Therefore, what is the best to offer a client whose need is something more specific? Custom modules are the answer to such challenges: they can help customize a Drupal website for any unique need that cannot be accomplished by utilizing existing core or contributed modules.

Beyond the regular needs, if you had to create new boundaries for your Drupal website’s innovation and growth, Drupa 9 Custom modules provide you the flexibility.  Get on to design your own module and craft features tailored precisely to match your business’s evolving needs and objectives.

Drupal 8 has attained its end. With Drupal 10 out in the market, it is the right time to migrate to Drupal 9. But, If you are still in the process of comprehending how to create custom modules in Drupal 8, then these steps will help your journey.

Custom Module Development in Drupal 9 – Let’s Begin!

Step 1: Naming Your Drupal 9 Module

Create a custom module under the‘ web/modules/custom’ folder. Let’s name the folder welcome_module.

Drupal 9 Module

Here are a few pointers to remember prior to assigning a machine name to the module:

  • Never use uppercase letters in the beginning.
  • Intermediate spaces or gaps are forbidden between the words.

Step 2: Seek attention with the info.yml file

Create a yami file in the same folder of your module. This file should be given catchy name, like Hello_module.info.yml, and will be used to recognize with Drupal.

name: Hello Module (The name that appears on the modules page in Drupal) 

type: module – (Declaring that this is a module or theme) 

description: Custom Example Drupal 9 Module (Description of the module) 

package: Custom – (Mentioning that this is a custom module) 

version: 1.0 – (Module version) 

core_version_requirement: ^8 || ^9 – (Drupal version)

Step 3: routing.yml – Creating the routing file

Third step – add a Hello_module.routing.yml file under the “Hello” directory:

To begin, we’ll name this route [hello_module.my_hello].

Afterward, under the path header, enter the URL you wish to link with your route- that’s how people will be able to access it!

You can also include a _controller parameter which points toward a method inside HelloController class and assign a default page title (_title) in defaults. Lastly, specify what permission level is required for someone to view the page – input these requirements within “requirements”.

Step 4: Including The Controller 

To bring your custom module to life, create a folder entitled “modules/custom/hello_module/src/Controller”, and then within it generate a file called “HelloController.php” containing the following information:

Log in to your Drupal platform and activate the module. To ensure it works perfectly, head over to the path you listed in your route document: /the hello/page. If you get a “Page Not Found” error, clear the cache by accessing admin -> configuration -> performance. Verify again, and this time everything should be running smoothly!

Perfect! You’ve effectively constructed your initial custom module in Drupal 9. When you navigate to the /welcome/page URL, you’ll observe a header captioned “Welcome to My Module in Drupal 9” and a markup reading “Welcome to our Website.” printed from your very own module.

#Step 4: Update Theme

Finally, Themes, similar to modules in purpose, concentrate merely on adjusting the look of your website instead of its ability. You can locate free and paid themes from any corner of the internet. But a good place for initiating your search would be the official theme repository.

After downloading the theme of your choice for your website, select Appearance in the admin toolbar. Then, click on Install new theme which will bring you to a similar page as before when installing modules. To finish this step, enter either your downloaded compressed file’s URL or upload it directly onto the screen and install it. Once completed without issue, an affirmation message should appear – signaling success!

To make your new theme visible, head back to the Themes page and scroll down to find it in the Uninstalled themes section. Once you’ve found it, click Install and set it as default – this will activate all of its styles and layouts for your site. If you’d like to see these changes reflected on the front end, simply visit your website!

Congratulations! You have just given your site a complete makeover using this new theme. It doesn’t stop here; continue to customize the look and feel of your website as much as you want. Drupal offers an abundance of capabilities, so if you’re keen on exploring more possibilities with it, we highly advise taking some time to delve into its official documentation for better insights.

Drupal 9 – The New Features

Drupal 9 was largely built on the foundation of Drupal 8, taking advantage of deprecations. Unlike its previous major versions, Drupal 9 is not a radical transformation of the system. In fact, there are merely two main distinctions between it and other major versions:

  1. Updates of dependencies to versions that stay supported.
  2. Removal of Drupal’s own code that was deprecated with removal before Drupal 9’s release.

Besides those two updates, Drupal 9.0 remains the same as its predecessor, Drupal 8.9 – the latest minor release from Drupal 8.

Wrapping Up

And there you have it – how to create a custom module in Drupal 9. Although the process may seem intimidating, breaking it down into these steps makes constructing your own modules much easier. With enough hands-on experience in Drupal and dedication, anyone would be able to build complex modules without any tension. Unleash your creativity with Drupal; there are no boundaries to the possibilities. If you need any, please don’t hesitate to reach out – our team would be delighted to help!

Leave a Reply

Your email address will not be published. Required fields are marked *