Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough
Jun 22 2021
Jun 22

Like many other things in life, our code needs some discipline too. I’m pretty sure no developer in the world wants to write unclean code. However, unclean code still does exist. It can arise due to various reasons - may be due to business pressure, lack of documentation, lack of interaction among team members or incompetence of the developer. Due action needs to be taken to make the code cleaner and to avoid problems that may come up in the future because of this. Fortunately, we can tackle these issues with a disciplined technique to restructure the code called as Refactoring.

Refactoring is a technique to improve the internal structure of the existing program source code and maintaining its external behavior. It is a step-by-step procedure to improve the code, which will otherwise cost us a lot of time and effort.

Code Refactoring

Disadvantages of Unclean Code

Expanding the source code size by adding new programs to it without refactoring for a long time makes the code messy and unclean. It makes the maintenance and further development on the project very difficult. Unclean code comes with tons of disadvantages:

  1. It increases the maintenance cost of the project.
  2. Adding new feature takes a lot of time and sometimes it become impossible to add.
  3. It slows down the introduction of new people to the project.
  4. It contains duplicate code.
  5. It does not pass all tests.

There are many other disadvantages, but these problems cost a lot of money and time to the organization.

Advantages of Clean Code

Clean and disciplined code has its own advantages:

  1. It does not contain duplicate code.
  2. It passes all tests.
  3. Makes the code more readable and easier to comprehend.
  4. It makes the code easier to maintain and less expensive.

Advantages of clean code are many. The process of turning a messy unclean code into a more maintainable clean code is called Refactoring process.

Refactoring Process

Refactoring should be done as a series of small changes, each of which slightly improves the existing code and allows the program to continue to run without breaking it. After refactoring, code should become cleaner than before. If it remains unclean, then there is no point of refactoring. It is just a loss of time and effort. No new code should be added during refactoring to create new functionality. It should pass all the tests after refactoring.

When to Refactor

Refactoring should be performed when:

  • Adding duplicate code to the project. Because duplicate code is hard to maintain and changes in one place may require updates in many other places.
  • Adding a feature. Refactoring makes it easier to add new functionality.
  • When fixing a bug, you should refactor because it will make the bug discovered automatically.
  • Code review is the last stage of refactoring the code before changes are deployed to production.

Dealing with Code Smells

Problems on the code are sometimes referred to as code smells. These are the problems addressed during the refactoring. They are easier to find and fix.

For example:

  • Large methods and classes which are very hard to work with.
  • Incomplete or incorrect usage of object-oriented programming concept.
  • Code that makes it hard to add any changes.
  • Duplicate and deprecated code in the project.
  • Highly coupled code.

Refactoring Techniques

Refactoring techniques are the steps taken to refactor the code. Some of the refactoring techniques are:

1. The Extract Method

// Problem

function printInvoice() {
    $this->printHeader();
  
    // Print details.
    print("name:  " . $this->name);
    print("amount " . $this->getPrice());
}

// Solution

function printInvoice() {
    $this->printBanner();
    $this->printDetails($this->getPrice());
}
  
function printDetails($price) {
    print("name:  " . $this->name);
    print("amount " . $outstanding);
}

If you have a code fragment that can be grouped, add a new method for that part of code and replace the old code. It makes the code more isolated and removes duplication.

2. Extract Variable

// Problem

if (($student->getMarksinMath() > 60) &&
    ($student->getMarksInPhysics() > 60) &&
    ($student->getMarksinChemistry() > 60) && $this->pass)
{
  // do something
}

// Solution

$mathResult = $student->getMarksinMath() > 60;
$physicsResult = $student->getMarksinPhysics() > 60;
$chemistryResult = $student->getMarksinChemistry() > 60;
$hasPassed = $this->pass;

if ($mathResult && $physicsResult && $chemistryResult && $hasPassed) {
  // do something
}

For large expressions like the one displayed in the problem, which is very hard to understand, different variables can be created for each expression. It makes the code more readable. But this method should be applied with caution. However, it has its own disadvantages. The code will execute even if the condition is false which is not the case in the problem.

3. The Inline Method

// Problem

function printResult() {
    return ($this->getResult()) ? “Pass” : “Fail”;
}
function getResult() {
    return $this->totalMarks > 300;
}

// Solution

function getRating() {
    return ($this->totalMarks > 300) ? “Pass” : “Fail”;
}

When the method body is more obvious, use this technique. Replace the method with method content and delete the method. It minimizes the number of unwanted methods.

4. Inline Temp

// Problem

$mathMark = $student->getMathResult();
return $mathMark > 60;

// Solution

return $student->getMathResult() > 60;

If there is an unwanted temporary variable which just holds the expression result, remove the variable with the expression itself. It helps in getting rid of unnecessary variables.

5. Replace array with object

// Problem

$row = [];
$row[0] = "Virat Kohli";
$row[1] = 70;

// Solution

$row = new Player();
$row->setName("Virat Kohli");
$row->setNumberofCentury(70);

If there is an array with various types of data, replace that with an object. Because fields of a class are easier to document and maintain than arrays with various types of data.

6. Parameterized Method

// Problem

function fivePercentRaise() {
}

function tenPercentRaise() {   
}

// Solution

function raise(percent) {
}

If multiple methods perform similar action on data, then replace all the methods with one method and pass the data as argument(s). It removes duplicate and redundant methods.

7. Separate query from modifier

// Problem

function getInterest() {
    $this->interestAmount = $this->principal * 10 / 100;

    return $this->interestAmount;
}

// Solution

function setInterest() {
    $this->interestAmount = $this->principal * 10 / 100;
}

function getInterest() {
    return $this->interestAmount;
}

If a method is returning value and changing the object, split the two methods. One for modification and another to return the result. It removes the chance of unintentional modification of an object.

Jun 08 2021
Jun 08

Website’s security is never (and should never be) an afterthought. A breached website does not just cause a loss in revenue but also in reputation. A secure website is one that has been developed keeping in mind different ways it could be broken into.

For this, we must ensure that the security checklist is handled before the launch and also after the launch of the site. One of the most important steps to ensure a secure Drupal website is to make certain that users have and maintain strong password policies. Out of the box, Drupal does not enforce a strong password policy. By default, you can choose to set easy (and weak passwords). But this behavior is not recommended especially for users who have content administration and other higher privilege permissions.

And that’s where the Drupal Password Policy module shines. It enables site admins to set strong password policies and enforce restrictions to a website. The Password policy module is a contributed Drupal module that is compatible with Drupal 9 as well.

Password Policy Module

Installing the Password Policy Module

Step 1: Install the Password Policy module using composer or download from here.

$ composer require 'drupal/password_policy:^[email protected]'

Note: Before installing the password policy module, make sure you have installed and enabled the Ctools module.

Step 2: Enable the downloaded module using drush or Drupal UI.

Through the Drupal UI, head to the module listing page. Under the Security tab, you will find the password policy module with submodules. Enable the first Password Policy module and then the submodules as per your requirement.

Security

Configuration

To configure your recently installed and enabled Password policy module, go to Configuration → Security → Password Policy. Here you will add password policies for various roles with different constraints as per your requirement.

Password Reset

Now give a Policy name and set password reset days. If you don't want to the password to expire, set the Password reset days as 0 days.

General Info

After this, you can add constraints and configure it through the Constraints settings tab. Note that the submodule that you added in security modules listing will list in the Constraints dropdown.

Configure Constraints

Let’s implement this with an example for better understanding. I need to add a password policy for an author role that enforces that the password must contain a minimum of 3 characters from the subsequent character types: lowercase letters, uppercase letters, digits, special characters, a minimum of 1 special character and the password length must be a minimum of 8 characters.

Character TypeNumber of CharacterMaximum LengthPolicy Constraints

Once you have configured the above constraints, apply it to the author role.

Apply to Roles

Click on the Finish button to create your new password policy. You have now successfully created a password policy for the author role.

Jun 01 2021
Jun 01

DevOps today is considered to be the most effective approach for software development and deployment.  Software service providers can now decrease development complexities, and continuously deliver top-quality, innovative software. Continuous Integration (CI), Continuous DElivery (CDE), and Continuous Deployment (CD) are some of the key processes that allow speedy deployment and delivery of software without compromising on quality.

CircleCI is one of the simplest continuous integration and continuous delivery (CI/CD) platforms that helps development teams release code rapidly and automate the build, test, and deploy process using Docker containers. It is a reliable platform that works well with languages like Php, Ruby, Python, NodeJS, Java, and Clojure. CircleCI provides built-in support for parallelism that can be accomplished across developer options. It is considered as a scalable option with a better UI.

In this article, we will discuss more about CircleCI, CI/CD and how you can configure your Drupal project on CircleCI.

But First, what is CI/CD?

Drupal Project on CircleCI

Continuous Integration is a practice to merge all developers code into a shared central repository. CI is a coding philosophy and set of practices that drive the development team to implement the changes and check the code into the central repository frequently. Because most applications require the code in different platforms and tools, the team needs to integrate and validate its changes.

Whereas, Continuous Delivery is the ability to get changes of all types including new features, configuration changes, bug fixes, and experiments into production, or into the hands of users, safely and quickly in a sustainable way.

A CI/CD pipeline is a full set of processes that run when you trigger work on your projects or commit your changes on the central repository. Pipelines have your workflows, which coordinate your jobs, and this is all defined in your project configuration file.

Configure your first Drupal project in CircleCI

Step1: Create a repository in Bitbucket

Create Repository

Step2: Push your Drupal application code to the repository. Here are some git commands to help you to commit your changes in Bitbucket.

git init
git remote add origin 
git add 
git status
git commit -m "first commit"
git push origin master

Step3: Login to the CircleCI using Bitbucket

Login CircleCI

Step 4: Set up your Drupal project

Setup Drupal Project

Step5: Setup .circleci/config.yml

CircleCI will find and run the config.yml and interact with the code to orchestrate your build, tests, security scans, approval steps, and deployment. CircleCI treats the configuration as code which is why it has been orchestrated through a single file.

Our current code structure looks like this:

Code Structure

Workflows Configuration

Workflows support several configurations, some of them are listed below:

  1. Sequential job execution 
  2. Parallel job execution 
  3. Fan-in/fan-out in a repo 
  4. Branch-level filtering for job execution

Fan-in/fan-out in a repo is ideal for a more complex build orchestration and for teams who want to run different test suites against commits to getting faster feedback. It allows you to run multiple jobs in parallel that lead up to a singular job and vice versa from a singular job to multiple jobs. 

See the following example of a Drupal startup kit:

Built Artifact

Troubleshooting a failed pipeline job

You can access your build job via SSH in CircleCI very easily. You can run your failed job via SSH. You can debug your failed job and rerun only that failed job. No need to run the entire pipeline.

Check out the following example:

You can click the job and see the details of where it has failed and the reason for the failure.

Deploy Over SSH

You will then get the rerun option where you can rerun the pipeline from the failed job. Also, you can debug the same via SSH.

Deploy Dev
May 25 2021
May 25

One of the ways to engage your visitors is by using various multimedia on your website and Drupal’s Media module provides a fantastic way to achieve that. An additional support was added to the Media module in Drupal 8.6.0 that lets you easily embed third-party videos from an URL into your site’s content called the oEmbed feature.

While having oEmbed support in the Drupal core is great, there are a few key requirements that might still be missing. In this blog we shall try out the oEmbed Providers module that extends the core’s media oEmbed functionality. The oEmbed Providers module is compatible with Drupal 8.8.4 version and above (and also works with Drupal 9!).

oEmbed Providers Module

What is oEmbed Technology?

According to oembed.com, oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.

Basically, oEmbeds allows a website's content to be embedded to another web page. The oEmbed format is supported by the most popular resources with multimedia content - Facebook, Twitter, YouTube, Instagram, Flickr, Vimeo and many more.

Configuring oEmbed Providers on Drupal

Step 1: Enabling the Media and Media Library core module

  • Enable the media and media library core module in your site.
Media Library

Step 2: Install and Enable the oEmbed Providers module

oEmbed Provider

Step 3: Configuring the oEmbed Providers module

  • Once enabled you can visit the configuration form at /admin/config/media/oembed-providers.
  • This module provides several features as listed below by extending core's oEmbed functionality:

         a. Add custom oEmbed providers

            ▪ Core Media provides no option for adding custom providers. The oEmbed providers module lets you do that by navigating to Configuration >  Media > oEmbed Providers > Custom Providers and clicking on Add oEmbed provider.

Custom eEmbed Provider

             • Fill in the necessary details to define a custom oEmbed provider and save the configuration form. Now you will be able to embed videos from this custom provider into your Drupal site. Here, I have given an example of a RadioPublic provider, you can fill in details of providers of your choice.

Add Custom oEmbed ProviderAdd oEmbed Provider

       

     b. Global enable/disable providers

      ▪ The oEmbed Providers module provides an user interface for enabling and disabling providers.

Allowed Provider

   

     c. Modify the providers list URL

        ▪ The oEmbed Providers module provides an user interface to alter the providers URL as the core Media module by default fetches the list of providers from here

oEmbed Provider URL

     d. Disable the fetching of providers list

        ▪ The oEmbed Providers module provides an user interface to disable the external fetch of providers, for instance, when the site uses only custom providers.

External Fetch

   

    e. Provides hook_oembed_providers_alter()

       ▪  The oEmbed Providers module provides a hook_oembed_providers_alter() that lets to alter provider definitions.

Step 4: Adding media to a content

  • Once you're done adding a custom oEmbed provider, you can now embed the videos from that custom provider into your Drupal site.

  • Add a media field to any of your content types and choose ‘Remote Video’ media type.

  • Now provide a video link from your custom provider. Here we have created a RadioPublic provider and saved the content.
Add Media

Okay, that’s it! You can now see the videos from your custom provider being rendered on your Drupal site.

Video Testing

Please Note: Once you get your custom providers working, you can also contribute this to a public oEmbed repository. It contains configuration information (the registry) for oEmbed providers, as YAML files in the providers directory. Once your PR gets merged, it will be listed out in https://oembed.com/providers.json and thus available for all Drupal developers to use with just the core media. Few months back, the YAML for Radiopublic provider (as shown in above example) got merged to the repository and it’s now available for us to use on Drupal. How cool is that?!

See the Drupal.org change record for more details on the oEmbed support and status.

May 11 2021
May 11

If you have a business to run, being active on social media isn't a choice anymore. You need social media to put yourself out there coz that’s where your audience is. There’s an increasing need to connect all the social media platforms with your website. Integrating social media with your website not only helps in an improved user experience, but you're also making it easier for users to share your content within their networks. Drupal, as usual, offers plenty of options to make your site more social. Improved collaboration between your Drupal site’s users means better engagement of visitors with your site.

Social Media Integration Modules

In this article, we have curated a list of the top 9 social media integration modules in Drupal 9 (also compatible with Drupal 8) ordered by their popularity.

AddToAny Share Buttons Module

With this module, you can harness AddToAny's universal sharing buttons. These buttons are vector and SVG buttons that look great on any background. They're lightweight and scalable to fit even high-PPI screens. It allows for easy integration with your Drupal website and is also optimized to load asynchronously. With a minified script, cached and instantly served from CDN, this module is a great choice to integrate social sharing buttons to a Drupal website.

Drupal Addtoany Share Buttons

Image credits: Drupal.org

ShareThis Module

The ShareThis module has been based on the Drupal 5 Share project and integrates the ShareThis tool on the node types you want to display this on. It is extremely flexible and can be customized using the API. You can place the block anywhere on your Drupal website. It can also be customized to display the number of shares the page currently has. 

ShareThis Preview

Image credits: Drupal.org

Social Media Share Module

This Drupal module lets users share the current webpage to various social media platforms like Facebook (share and messenger), Twitter, LinkedIn, Pinterest, email client, and even Whatsapp. It is also flexible enough to add in more platforms of your choice. The Social media share module also enables you to modify or disable the services from the config page. It can be added as a field in entity and leverage the field API.

Shariff Social Media Buttons Module

The Shariff social media buttons module for Drupal integrates with the Shariff social media buttons library to offer a safe way to add social sharing buttons on a Drupal website. We call it safe because, unlike other social sharing widgets, this module does not leak user's personal data. Also because it does not inject iframes or call external Javascript. Once downloaded, it implements the Javascript library and you can display the buttons as a block or field.

Shariff Module Buttons

Image credits: Drupal.org

Ridiculously Responsive Social Sharing Buttons

As the name very clearly suggests, this Drupal module lets you add social sharing buttons to your website that are ridiculously responsive! They are SVG-based sharing icons, very lightweight, and compatible with most browsers. You do not need to add any third-party scripts to use this module. It can be added as a block or at the end of certain node types. They originally come with share buttons but can be also customized to turn them into follow buttons to enable users an easier way to follow you on social media. It is highly customizable where you can configure which buttons you want to display, the button sizes, number of rows to display, prefix a text (follow/share) that resizes automatically, and more.

Social Sharing Module

Image credits: Drupal.org

Social Auth Google Module

This popular module lets users register themselves and login to a Drupal website via their Google account. The module adds a login path to google (user/login/google) which then redirects users to login to Google. This module is a part of the Drupal Social Initiative and harmonizing the social networking functionality in Drupal is its primary goal. It is based on the Social API that blends authentication with external services - in this case - Social Auth google. 

Social Auth Google

Image Credits: Drupal.org

Social Feed Module

If you want to display a live feed from your social media pages on your Drupal website, this module is just the one for you. The Social Feed module for Drupal 8 and 9 lets you integrate data from your social networking pages on Facebook, Twitter, and Instagram to your website. Configuring this is simple, where you will need to enter the social media platform page name, the App ID, a secret key, and user token, which you will easily find on your social media page. You can display the feeds using the Drupal block system.

Like & Dislike Module

Want to show your users how many of the readers liked and disliked your article? The Like and Dislike module for Drupal enables a like and dislike widget wherever you want to place it on your page. It used the Voting API to store, retrieve and tabulate votes. It works for Bundles and Entity types and comes with a  settings page where you can configure for which bundles you need the widget to work.

Like and Dislike

Image credits: Drupal.org

Twitter Embed Module

The Twitter embed module for Drupal allows you to embed a Twitter timeline or button to your website. You can expose Twitter widgets by embedding them as a block or a field. When you embed it as a block, you can choose to display your Twitter profile, list, collection, or likes from your Twitter page.

Twitter Embed Grid Timeline

Image credits: Drupal.org

May 04 2021
May 04

In today's world, images are an essential part of the modern web. It helps in engaging users as it is a universal language that speaks louder than words. Images are also more memorable than text content and are processed faster by the brain. A research shows that people tend to remember 80% of what they see (visuals) and only 20% of what they read (textual content).

But did you know that on an average, images take up almost 64% of a website’s total weight? If you don’t pay attention to image optimization, you might be losing out on potential customers because your website, although immersive, may be taking too long to load. Hence using optimized images is extremely important for a website. However, image optimization could seem like a nightmare to a content editor who needs to optimize (using external tools) and upload hundreds of images. Drupal’s ImageAPI Optimize module to the rescue! We will be explaining further on this topic and how you can use ImageAPI Optimize in Drupal to automate image optimization. The ImageAPI Optimize module is also compatible with Drupal 9!

ImageAPI

What is Image Optimization?

Image optimization is a process of delivering high quality images in the right format, dimension, size and resolution without compromising on the quality of the image. 

Why use ImageAPI Optimize?

  • Images can contain far more data than required to display. ImageAPI Optimize will provide optimization for those images.
  • The module provides integrations to the optimization tools and web services.
  • It defines the pipelines made up of configurable processors.
  • There are multiple processors available as a contributed module like: imageapi_optimize_binaries, imageapi_optimize_resmushit, imageapi_optimize_tinypng and kraken etc.
  • Each pipeline can be applied to an image to remove the extra metadata or to recompress.

Installing the ImageAPI Optimize module

Step 1 : Download the ImageAPI Optimize and ImageAPI Optimize reSmush.it module using composer.

  
$ composer require drupal/imageapi_optimize

  
$ composer require drupal/imageapi_optimize_resmushit

Note: ImageAPI Optimize reSmush.it is used for integrating the web service which will provide the free API for optimizing images with great quality. Click here to find more on the API. 

Step 2 : Enable the downloaded module using drush or from the drupal UI.

  
$ drush en -y imageapi_optimize

  
$ drush en -y imageapi_optimize_resmushit

Configuration

Creating a pipeline for ImageAPI Optimize:

Let’s first create a pipeline that can be used sitewide to optimize the images. To do that, go to Administration >> Configuration >> Media >> Image Optimize Pipeline

Pipeline Configuration

Configuring the installed processor for the pipeline:

Now let’s configure the installed processor for that pipeline we just created. Go to Administration >> Configuration >> Media >> Image Optimize Pipeline >> Your Pipeline. Now, edit the pipeline and select the processor installed. In this case we are using a Resmush.it processor as shown in the image.

Resmush

 

Allow image styles to use the created pipelines:

By default all the core image styles will be optimized from imageAPI optimize. For new image styles, go to Administration >> Configuration >> Media >> Image Styles >> Your Image styles. Edit the image styles and select the created pipeline.

Optimize Image

Results

ImageAPI optimize module in Drupal provides great compression without compromising on the quality. It provides up to 70% compression for images. Check out an example of the results of an image before and after optimization.

Original

File size : 1.4MB

Original Image

 

Optimized

File size : 116 KB

Optimized Image
Apr 27 2021
Apr 27

Component-driven theming is becoming widely popular today because of various reasons. The most significant being reusability and portability of components. Pattern lab is a front-end framework that uses an atomic design architecture to implement a component-based design. In this article, we will discuss more about Pattern Lab and how you can enhance your Drupal frontend performance with it.

Pattern Lab

What is Pattern Lab?

Think of Pattern Lab as an application that can help you organize your UI components in a pattern-driven approach. It is basically a static site generator that binds together all the UI components together. Pattern lab uses atomic design to accelerate the process of creating modular designs. It starts out really basic and gets more complex as you move up the ladder.

Pattern Driven Approach

Credit: Pattern Lab

Let’s breakdown these visual building blocks:

Atoms: They are the most basic building blocks of your design. For example, UI elements like buttons, search fields, form elements, labels.

Molecules: They are groups of atoms that work together to perform a particular action. For example, a search navigation that involves a combination of atoms like a search button, a search field and a label.

Organisms: Organisms are molecules and atoms grouped together to define sections of the application. They’re more complex and have more interactions. For example, a header, a footer or a related blog post section.

Templates: Groups of Organisms form Templates. They are placeholders for organisms. For example, a blog page template, login page template or a shopping cart page template.

Pages: When you combine a template with real content, you get a page.

Page Template

Credit: Pattern Lab

Why should you use Pattern Lab?

Patten Lab makes frontend developers work an absolute pleasure. This is because it allows rapid design prototyping with demonstrable interface and interactivity.

It allows developers to maintain code consistency, implement and leverage reusable components and allows multiple developers to work at the same time. All of these benefits help in easy maintenance of the code.

In terms of Drupal, frontend developers can start their work independently without the dependency on Drupal development. We can work faster and with more consistency than ever before.

Patten Lab with Drupal

Integrating Pattern Lab with Drupal has many benefits and can improve and fasten frontend development. Thanks to the Drupal community, we now have a contributed theme Emulsify Drupal that comes with inbuilt the Pattern Lab architecture. This reduces the extra development effort of achieving a Pattern Lab integration.

Creating a Heading atom in Pattern Lab

For a better understanding of implementing Pattern Lab in Drupal, let’s take an example of creating a Heading atom and integrating it in Drupal Twig template.

Heading atom directory

Heading atom directory

In the atom directory we will have 3 required files.

_heading.twig : The heading markup will go in this file
_hading.scss : This is for heading style
heading.yml : This is for static data to be passed in twig

Heading atom Twig

Heading Twig

_heading.twig

In Heading twig, we can add the element markup with all the required attributes as variable. We can pass data from yml file or drupal field data with these variables.

Heading.yml / Heading.json

Heading json

heading.json

This is an example of a json file containing static data for the variable available in the _heading.twig file.

Integrating Heading atom in Drupal template with field values

Here, we will be overriding the page template and integrating it with the heading atom.

Barkit Page

Default bartik page-title.html.twig

Heading atom integrated with Page Title

Pattern Lab Heading atom integrated in page-title.html.twig

Here, in page-title.html.twig, instead of the default H1 element we are importing the heading atom as reusable element and adding Drupal field value to the defined variable in the heading atom - heading_level and heading.

Using the same pattern, we can create engaging Drupal websites using Pattern Lab.

Apr 20 2021
Apr 20

There might be instances when you want to restrict access to some pages of your website. It could because you want increased security for the high-risk data that’s lying on the page or you want only your subscribed users to be able to view the content. This functionality is provided in Drupal 8 by a module with an interesting name called the Rabbit hole module. The module is also compatible with Drupal 9! In this article we will be elaborating on the module and how you can implement it in your next Drupal project.

Control Access to Restricted Pages

What does the Rabbit Hole module do?

The Rabbit Hole module provides the ability to control what should happen when an entity is being viewed at its own page. It also controls what happens when someone visits an entity page.

In simple it allows you to easily redirect or prevent users from viewing specific types of entities on your site. You can grant or deny user access to entity types or specific Drupal entities based on user roles. For example: To display paid content to users with a subscription or to allow special user roles.

Some of the entities that it supports are Nodes, Taxonomy Terms, Users, Files, Group and Media Entity

The Rabbit hole module for Drupal 8 provides multiple options to restrict access to specified pages. You can choose to deliver access denied or page not found pages. You can also choose to redirect a page to any path/URL. Or you could choose to display the entity as it is.

Configuring the Rabbit hole module

Here’s how you can configure the Rabbit hole module for an entity type:

Configuring the Rabbit Hole Module

Configuring the Rabbit hole module: Select the required entities

Create a VIP Role

When you create a VIP role, only paid users will be allowed to view the content. Without a paid membership user will be Authenticated user.

  • On the Admin toolbar click on People -> Roles -> Add Role
  • Give the role name as VIP
  • Click on Save 
Creating VIP Role

Creating VIP roles

Create Users

Here let’s create an Authenticated user and a VIP user.

  • Click on People -> Add user
  • Enter the data and select the role as VIP
  • Click on Create a new account 
Create New User Account

Create a new user account

In the same way create another user with the role of Authenticated. After that, the People page will look like this.

All Users

All Users

Create VIP Content Type

  • Click on Structure -> Content type -> Add content type
  • Give a proper name and description for the content type
  • Click on Rabbit hole Settings
  • Keep “Allow these settings to be overridden for individual entities” option as checked. It will allow administering permissions on a node basis
  • Choose the redirect option and enter the URL of the site to which you want to redirect
  • Click on Save and manage Fields.
Create VIP Content Type

Create VIP Content Type

  • Add an image field and place it above the body field on the content type to manage display settings.
  • Click on Save 
Save VIP

Set Access Permissions

Users with a VIP role will have to be able to bypass the Rabbit Hole control. 

  • Click on People - > Roles
  • Click on the dropdown arrow of VIP role and click on Edit permissions
  • Search and Check for the Bypass Rabbit hole action for Content permission. Save the permissions. 
Bypass Rabbit Hole

Create Content

  • Click on Content -> Add content -> VIP content
  • Create a node and hit Save 
Create Content

Create content

Test the Rabbit hole Module

  • Login as an Authenticated User
  • Click on the Teaser title of the VIP content on the Home page)
Testing Rabbit Hole

Testing the Rabbit hole module

  • It will (and should) redirect to the Access denied page.
Access Denied for Authorized User

Access denied for an Authenticated user

  • Now let’s logout and login again but this time as a VIP user.
Login VIP User
  • Go to home page and click on the Teaser title.
Committed to SafetyView Node and Content
  • As a VIP user, you will now be able to see the node and content.
Apr 06 2021
Apr 06

If you are a Drupal website owner, developer, admin or a user, you should already know that Drupal 10 is coming soon - June 2022. And that’s just over a year to go! The advantages of migrating to the most updated version of a software are priceless. More so when you have a community of open-source enthusiasts working towards a single goal of improving Drupal every single day, you must trust that migrating to the latest version of Drupal is going to be one of the best decisions you will make.

If you’re still on Drupal 7, it’s about time to migrate to Drupal 8 (or 9). There are many ways of migrating your website from Drupal 7 to Drupal 8 (or Drupal 9). Here’s a no-frills guide to migrating your Drupal 7 website from a database source.

Migration from Database Source

What is a Drupal Migration?

Migration is a movement of content from Drupal 7 to Drupal 8 (or Drupal 9). This includes configuration (content types, vocabularies, user roles, file types, image styles, etc.) and contents (users, nodes, paragraphs, taxonomy terms etc.)

Drupal 7 to Drupal 9

The ETL Process

No matter what your source or destination is for a migration, a Drupal migration will follow the ETL process or the Extract – Transform – Load process. The first step is the Extraction step where the data is extracted from the source plugin. The next step is the Transformation step where the extracted data is processed according to the requirements by the process plugin. And lastly, the Loading step where the data is loaded into the storage by the destination plugin.

Process Plugin

Migration Plugins and Modules

    1. Source plugin

A set of data, called row from the source. They help fetch data from the source like a database, CSV, XML or JSON.

    2. Process plugin

Row data will be processed and transformed as required. It describes how the destination is to be built from the source data.

    3. Destination plugin

Once processed, the transformed row is saved to the destination in the Drupal site.

Modules Required

  • Migrate Module – Contains APIs to migrate content and configuration to Drupal 8.
  • Migrate Drupal Module – Helps in migrating content and configuration from a Drupal source site to Drupal 8.
  • Migrate Drupal UI Module – A user interface to perform the migration.
  • Migrate plus Module – Provides capabilities to transform source data and APIs for grouping migrations.
  • Migrate tools Module – A contributed module that offers extended drush commands to manage Drupal 8 migrations. 
  • Drupal upgrade – A contributed module used to create the migration YML scripts.

Groundwork Before Diving In

Now that we have a fairly good understanding of some of the basic migration concepts and have installed the basic modules needed for the migration (as discussed above), let’s look at a few simple steps to follow before actually commencing a Drupal 7 to Drupal 8 migration:

  • Audit the Drupal 7 site for contributed modules. Many of the fields in the Drupal 7 content types will depend on contributed modules. So, we will need to check for those modules and install the same in Drupal 8 or Drupal 9.
  • Install the contributed modules if it is not incorporated in Drupal 9 core.
  • Install the supportive core modules like revisions, translations, etc. if needed.
  • Have the Drupal 7 database and files accessible by the Drupal 9 instance.
  • Select the method of migration Bulk or Individual carefully based on the complexity of the site.

Connecting to the Drupal 7 Database

Now we will need to connect to the source database of the Drupal 7 website. For that, we will need to add the source database information in the Drupal 8 or Drupal 9 settings file.

Go to settings.php file of your Drupal 8(or 9) site and add the database with migrate key and run this command:

  
drush migrate-upgrade --configure-only --legacy-db-key=migrate --
legacy-root=https://www.drupal7.com/

Or you could also directly configure using this URL:

  
drush migrate-upgrade --configure-only 
--legacy-db-url=mysqli://[email protected]:33067/drupal7_db --
legacy-root=https://drupal7.com/

The above commands will generate migration YMLs based on the Drupal 7 configuration and contents. It will not start the migration as we added the option “--configure-only”.

Drupal 7 to Drupal 8 Migration - Bulk import

To perform a bulk migration on all configurations and contents to Drupal 8 or 9, you will need to execute these commands :

  
drush migrate:import --tag=Configuration --execute-dependencies

This will run all the configuration migrations by running the dependencies at first.

  
drush migrate:import --tag=Content --execute-dependencies

This command will run all the content migrations by running the dependencies at first. Please Note: The migration order is important.

Please Note: The migration order is important.

Drupal 7 to Drupal 8 Migration - Individual import

Sometimes, you might not want to migrate ALL of your content of configurations at one shot. You can then opt to migrate them individually. However, you will need to keep in mind to migrate them in order.

  1. Configuration: User roles, vocabularies, content types, image styles, fields, field instances etc.
  2. Content: Files, paragraphs, Users, terms, nodes, etc.

Migration Tools drush Commands

The Migration Tools module (as discussed previously) is a contributed module that gives you some tools and commands that will help you during a migration. Some of the commands include:

  • drush ms - Migration status
  • drush mim - Migration import

                      Imports the data from Drupal. We can also run the import with a limit. For example: drush mim --limit=10

  • drush mr - Migration rollback
  • drush mmsg - Migration message

                     Shows the captured message (error or notice) after the migration import.

Mar 30 2021
Mar 30

Drupal 8 brought about significant architectural changes offering modern techniques to build digital experiences. REST API was one of them and it came shipped in Drupal 8 core. A RESTful API is an API that conforms to the architectural style of REST (representational state transfer). It accesses and uses data via HTTP requests to GET, PUT, POST and DELETE data types. 

In this post, you will be learning more about exposing your API in Drupal 8.

HTTP methods used in REST API

GET : This method is used to read the data from server.
POST : This method is used to create data on a server.
PATCH : This method is used to update the data on the server.
DELETE : This method is used to delete the data from the server.

Exposing API in Drupal 8

The above image describes how REST API requests and gives the response to a client. Initially the client sends the request using HTTP methods. REST API interacts with the database and sends the response in JSON or XML formats.

Now let’s see how it take place in Drupal.

Drupal Modules to Expose your API

Mentioned below are some Drupal core and contributed modules that can help in exposing your APIs in Drupal.

    1. HAL

The HAL module is specifically for JSON or XML, and it provides the serialization plugin.
    
    2. HTTP Basic Authentication

The HTTP basic authentication module provides an authentication plugin which allows us to control access to our API resources based on the HTTP method.

    3. RESTful Web Services

The RESTful web services module handles the resources plugin system as well as defining initial resource routes. A good example of resource plugin can be found in the DB log module which provides an API endpoint for watchdog entries.

Resource plugin is responsible for retrieving the data from the database.

    4. Serialization

The serialization module is responsible for deserializing and serializing request response data.
    
    5. REST UI

Rest UI is a helpful module which exposes our RESTful web services configuration via the admin UI. This way we can configure our API endpoints by editing the YML files.

REST Response - How It Works

REST Response

This image describes the pipeline of the REST response.

According to the image, first the client sends a request, and the request goes to the request handler. The Request Handler is responsible for accepting the request.

The request handler interfaces with the REST module and is responsible for the requests. The requests are then sent to deserialize to normalize the data. 

Then deserialize sends to the request handler. The request handler matches the up the resource with the appropriate resource handler. 

Again, request is sent to the Resource plugin. The resource plugin takes the data from incoming request and retrieves the valid information from the database.

Then the resource plugin returns the data to the request handler and again acts with the serializer before sending as response.

How to configure the REST API in Drupal using Core Modules:

Here are 4 easy steps to configure REST API in Drupal using core modules:

Step 1: Initially, you need to install the core modules which are HAl, Http Basic Authentication, REST Web Services, and serialization module.

Step 2: Next, you need to download the REST UI module and you need to enable the module.

Web Services

Step 3: Next, you need to configure the REST API endpoints as required. To configure, go to Configuration -> REST -> then click on edit of the content row.

REST Resources

Step 4: When you click on edit, you will get the edit window. Configure as required then save the configuration.

Configuration

Example:

If you want to get the response of a particular node, you need to send the request using the postman app with URL - hostname/node/nodeid?_format=json. (If you don’t have the Postman app yet, you can either download it from here or get the web version.)

Postman
Mar 23 2021
Mar 23

There maybe times when you do not want certain pages of your website to look like the rest. You might want a different theme, a unique menu or a distinct layout altogether. That’s when you will want to create Micro-sites. Micro-sites are small sites that can be subsets of your main site or have a completely different domain/subdomain. Mainly used for discrete marketing campaigns, events or products, micro-site marketing is a great tool to promote focused campaigns.

With Drupal 8 (and 9) you can build micro-sites within your existing setup using the Group module. You can have a separate set of users, permissions, and pages within that setup. Let’s learn more about this amazing module and how you can create micro-sites using the Group module.

Micro Sites in Drupal

Creating micro-sites using the Group module for Drupal

The latest version of the Group module was released in Drupal 8.8 and is compatible with Drupal 9 as well. It enables you to build discrete collections of content and users on your Drupal site. You can also setup access control for these collections. Group module is not only useful to create micro-sites but can be used whenever a site needs to create content that needs to be accessed only by certain user groups.

Installing the Group Module

Follow the below steps to install the Group module for Drupal 8 (or 9).

Step 1: Use this command to install the module

  
composer require 'drupal/group’ 

Step 2: Enable the Group and Group Node module

Working with the module

Once the module is installed you will see Groups in the administrative menu.

Groups

Under Groups, you need to create a Group type for your micro-sites. Group types are basically types of divisions for your website. In our case the group-type is a Micro-site.

Add Group Type

After adding the group type you can add fields to your micro-site. You will see 3 extra tabs in this group type - Content, Roles, Permissions.

Add Field

In the same above image, you can see a content tab where you can add content types to your micro-site (these are content types that we have created in our main site).

Configure Contents

Now, you can also create separate roles for the micro-sites.

Group Roles

After adding a separate role to the micro-site, you can add permissions to that particular role by clicking on Edit permissions. You can set the permissions as per your requirement.

Group Role Permissions

Next, you have a permission tab where you can add permissions to anonymous users and other micro site members. After configuring your group type, you can now add the group to that particular group type.

Group Type Permissions

Now while editing your group you will see many other tabs apart from View, Edit and Delete.

Edit Micro Sites

Now, go to the Members tab where you can add members to the group. These are the members who can perform actions on this particular group. (Note: by default, admin will be a member of the group. You can disable this functionality in the group type configuration.)

Micro Site Member

Go to the Nodes tab to add content to the group.

Micro Site Nodes

All entities: This lists all the nodes and users in that particular group.

Micro Site Entities

Adding menus to Micro-sites

Install Group Content Menu using this command then enable the module.

  
composer require 'drupal/group_content_menu'

After installing this module, you will see Group Content Menu types under Structure. Create a group content menu type for your micro site.

Group Menu Type

Place this menu type in the block layout where you want to display it.

Add Custom Block

Configure the block to display in the micro site.

Configure Block

Now in the group type content tab you will get the Group menu. Install that to display menus in your micro-site.

Group Menu

Now you should be able to see group menu in your groups.

Group Menus

In group menu you need to create a name for the Menu set.

Site Menu

After adding the menu set, you can now add menus.

Add LinkEdit Micro Sites

Now clear your cache and check the group. The menu will be displayed wherever you have placed it in your block layout.

Micro Site Description
Mar 16 2021
Mar 16

When Layout Builder was introduced in Drupal 8.6 and stabilized in Drupal 8.7, it created a drift in the page building mechanism being used in Drupal’s ecospace. Layout builder gave tough competition to other tools like Paragraphs, Brick, Panels, and Display Suite. Its unique ability to drag and drop components and preview them real time was a real concession for a page builder tool and for the authors.

However, despite being a prodigious tool for building pages it has its shortcomings when used for enterprise applications which requires a better authoring capability, restricted selections, quick access, and more importantly granular permissions for different user roles.

In this article, I will be covering 10 Drupal contributed modules which can be used in conjunction with the brilliant Layout Builder module that will make the tool more fascinating and authoritative. To add to this awesomeness, all these modules and compatible with Drupal 9 too!

Drupal Layout Builder

The modules are divided into certain categories:

  • Styling - Ability to provide access to the editor to choose from a style library which can be applied to sections and blocks.
  • Authoring experience - Enhance the authoring experience of the editors which they will love.
  • Reusability - Provision to reuse components or sections on different pages to reduce page building time.
  • Quick Access - Provide quick access to the editors to perform certain actions thus saving time.
  • Permissions - Give restricted access to editors or other user roles based on their access.

Layout Builder Styles

The Layout Builder Styles is a powerful Drupal module that allows you to add styles to the blocks and sections right from the UI. It can be used to provide the authors the capability to choose from a list of preset styles defined in the backend.

Large Padding

A "style" is just a representation of one or more CSS classes that will be applied. Additionally, for blocks, a block template suggestion is added for the selected style.

The styles are basically configuration entities which contain the CSS classes. The classes being added in the configuration must be defined in the frontend theme stylesheet for them to reflect on the frontend when applied to a particular section or a block. There is a provision available for having multiple styles which can be applied to a single block or section.

Since the styles are stored as configuration, they can be easily exported to configuration files using Drupal configuration management.

However, you must be responsible while adding styles as you are giving a powerful capability to the authors to alter the styles of the components being placed in a page. If not planned properly, things might go south with conflicting styles.

Layout Builder Component Attributes

The Layout Builder Component Attributes module provides similar provision to authors but with more options and it is only for the blocks being placed in a Layout.

Add Attributes

 

Oftentimes, authors need to add certain data-attributes or certain CSS Classes/IDs to a block to render the data in a certain way. There are modules available for such cases like Block attributes and Block class but they either lack the support of Layout Builder or need patching to work. The Layout Builder Component Attributes module gives the options to add these details as attributes to the blocks right in the Layout Builder UI out of the box.

The modules provide options ID, Class(es), Styles [inline styles to the block], Data-* attributes. These attributes can be added to 1) the block (outer) element, 2) the block title, and 3) the block content (inner) element. The options are configurable for each element types i.e. if you don’t want the ID field to be available for block titles those can be unchecked in the modules configuration form at

“/admin/config/content/layout-builder-component-attributes”

Layout Builder Modal

Drupal’s Layout Builder Modal module modernizes the UI and authoring experience for the block configuration forms or creation forms (in case of inline blocks). The form displayed on the off-canvas dialog sidebar can get really cumbersome because it is very narrow. Especially if you are dealing with complex fields, rich text fields, media references, etc. The off-canvas dialog greatly reduces the usability and is not ideal for such situations.

Add Block

The module opens the forms in a popup window where there is a good amount of breathing space and increased usability. There are configurations available where you can set the width and height of the modal popup window. You can also select which theme to use for the modal content where you can either choose the default enabled themes (Olivero in case of the above screenshot) and the good old Seven administration theme. Currently, Claro is not supported but there is work  going on in this front to make Claro available as an alternative.

Overall, the module greatly enhances the authoring experience for editors and the usability of Layout Builder.

Layout Builder Library

Let’s consider a situation where the editors need to quickly set up a page where they need to show certain content block components based on certain criteria e.g., selection of particular taxonomy terms. Now, this can be done in a hard way that editors create a landing page and then create the same layout again and again for multiple pages with the same content but different conditions. Or else, use the Layout Builder library module.

Library Module

The Layout builder library modules provides the site administrator with the capability to create predefined layouts for each entity-type and bundle combination. Now, these layouts will be available to the site editors while creating the Landing page content. This will make the task much easier and faster where the editors will not have to redo the same task repeatedly. The module also provides granular permissions to restrict editors to create their own bespoke layouts but give them the ability to customize layouts on a per-content-item basis.

Section Library

Similar to the situation above mentioned where editors might need to choose from existing layout from a library, there can be a circumstance where editors will have to reuse certain sections from Layout Builder on multiple pages. This is where the Section Library comes into play. With the module, editors can create their own mini layouts which they can reuse on other pages. This allows them to create pages faster without again, repeated doing the same stuff.

Templates Library

The key difference between this module and the Layout Builder Library module is that the latter builds a full-page template and is config-based. The Section Library is content based so the content editor can create templates on the fly without import/export configs, also it builds templates for the section or multiple combined sections (page) templates.

There is no overlapping between the two modules, and you can use both at the same time.

Layout Builder Direct Add

One of the key features of Layout Builder is the ability to add inline blocks which are one off non-reusable blocks specific to a page. Now if the pages in your system mostly depend on these inline blocks as components, the Layout Builder Direct Add can save some editor's time by saving a few clicks.

Configure Section

The module simple replaces the “Add Block” button with a quick dropdown button to the block types available in the system with a “More” option which opens the off-canvas dialog sidebar. When an editor selects any of the block types from the list it directly opens the block form to create that component.

Layout Builder Operation Link

This small module is a good to have feature for a site. To access the Layout Builder UI for an entity an editor needs to visit the page and then click on the Layout tab in the taskbar. The Layout Builder Operation Link adds a Layout option the dropdown button to contents in the content overview page.

Show Column

The layout option will show up for all the entity type bundles where Layout Builder is enabled. This link saves content editors a click/page load when they want to access an entity's layout page directly without loading its edit page first.

Layout Builder Restrictions

Out of the box, Layout Builder will list out all the blocks available in the system provided by various plugins and modules, fields are available as blocks and there are inline blocks options to create one-off blocks. Apart from that all the layouts provided by other modules and the theme also lists out when a section is being placed. This can be a little confusing and overwhelming for editors and poses a usability problem since the number of blocks can quickly grow in an enterprise application.

Default Restrictions

Layout Builder Restrictions solves this problem by providing a configurable layout with options that are needed. These options will be present whenever Layout Builder is enabled for any entity display. The module configurable UI for allow-listing/deny-listing blocks and layouts. Sites can allow all options from a certain provider, or restrict all options by provider, or specify individual allowed blocks & layouts. Site administrators can allow/deny those blocks that are useful for editors to build the pages and only those blocks and layouts will be available for the editors to choose from.

Layout Builder Advanced Permissions

Although Drupal provides a powerful permission system for user roles, there can be possibilities of more granular permissions based on the roles. The situation may arise when there are multiple user roles interacting with the system and pages.

Advanced Permissions

The Layout Builder Advanced Permissions module gives that capability to the site administrators to provide restricted permissions to use based on their role. These permissions are global which are applied across all entity types where Layout Builder is enabled. To take things further and restrict access on a cruder level, Layout builder lock will come handy which will be covered in the next section.

Layout Builder Lock

As mentioned above, the Layout Builder Lock will provide a cruder access for users. It allows administrators to lock sections of a default layout so users can't perform certain actions when overriding the layout for an individual entity.

Administrative Label

 

These lock settings will be available when the module gets installed and will be available for all sections. There are global permissions available to manage the access of the lock features. These are advanced editorial features which should be added and used very responsibly. Locking out a section, or any component inside a section means that the section will have very limited access for changeability.

Quick Recap

  1. Layout Builder Styles - allow site builders to select from a list of styles to apply to layout builder blocks and layout builder sections.
  2. Layout Builder Component Attributes - allows editors to add HTML attributes to Layout Builder components (blocks).
  3. Layout Builder Modal - lets you add and configure existing blocks in a modal in the Layout Builder UI.
  4. Layout builder library - provides a layout library allowing content editors to pick from a list of predefined layouts.
  5. Section Library - create reusable templates for single or multiple sections.
  6. Layout Builder Direct Add - replaces the "Add block" link with a drop-button that lists custom block types.
  7. Layout Builder Operation Link - adds a 'Layout' operation link to Layout Builder-enabled content on Drupal administrative pages.
  8. Layout Builder Restrictions - set which blocks and which layouts should be available for placement in Layout Builder.
  9. Layout Builder Advanced Permissions - allows to control in details access to the Layout builder page by providing a more granular permissions set.
  10. Layout Builder Lock - allows administrators to lock sections of a default layout so users can't perform certain actions when overriding the layout for an individual entity.
Mar 09 2021
Mar 09

Different Drupal developers have different techniques to backup their Drupal websites. In this article, we will be talking about two of my go-to methods to backup a Drupal 8 or Drupal 9 website. One with the help of the Backup and migrate Drupal module. And the other way is with Cron jobs using CLI. 

Data loss can be brutal and devastating, no matter who or what caused it. The good news is that it can be prevented by taking regular backups of your site. Sometimes, backups are done every day and sometimes, occasionally. The regularity depends on various factors like the size of your Drupal site or how often you update the website. Luckily, Drupal 8 and 9 provides you with easier options to backup and restore your website with the help of the Backup and migrate Drupal module and via CLI.

Automated Backups on Drupal

Using the Backup and Migrate Module for Drupal 8 and 9

The backup and migrate module can backup both database as well as files. It can also backup the entire Drupal application folder. The module also has an encryption feature which requires you to download an additional library called the Defuse PHP encryption library-

  
composer require defuse/php-encryption

Steps for usage:

  • Install the Backup and Migrate module.
  • Create a private directory and assign with writable permissions (similar to what we’d give to the files folder).
  • Set the path of private directory in settings.php file so that the module can use it for storing the backups.
Backup and Migrate Module

UI for the Backup and Migrate Module

Once you install the module, head to Administration -> Configuration -> Development -> Backup and Migrate. You will see 5 tabs:

Backup – where you can do quick backups. Once you click on Backup now, you will be able to see it in the Saved Backups tab.
Restore – where you can restore the earlier backups
Saved Backups – will have the list of all the backups you have taken so far
Schedules – where you can schedule your backups
Settings – contains general settings and options for this module

Schedules:

This is one of the most important features of the module. The module provides an automated scheduler where you can schedule your backup. This runs automatically during every cron run. You can add as many schedules as you want, to take backups of the database, public or private files directories or the entire site.

Viewing All Schedules

Viewing all the Schedules

Configuring the Schedule

Here is where you can add or edit the schedules. You can give a name for the schedule. There’s an option to enable or disable the scheduler. Select one of the various backup sources like the database, public or private files, directories, or the entire site. Or add your own in the Settings tab. If you are backing up both the database and files, you can have different backup destinations configured for each of the backup type. This means you can have a different destination for the database backups, a different destination for the file backups, and such. The module also provides configurations for adding more destinations of your choice in the Settings tab. The Frequency option lets you specify how often you want a backup to take place as a cron job. You can select options from hours, minutes, days, and weeks. The Numbers to keep option allows us to specify the number of backups we want to keep. It automatically deletes the older backups once it reaches the limit that you set, thereby solving memory and storage problems. 

Configuring Schedules

Configuring the Schedules

Adding Backup Source

Adding your Backup Source

Are there any limitations?

Sadly, yes. As per my personal experience, I’ve noticed that when the database size grows, I do run into Time-out errors. And this is a problem because on certain servers, we cannot increase the maximum execution time for the database to execute. The other issue that I have faced is memory issue. It may run out of memory in some cases depending on the configuration of the server or the database size or the size of the backup. When we run into such issues, we can use the CLI method.

The CLI Method to Backup 

In the command-line interface method, we can perform backups using these two methods:

  • Using Drush in combination with the Crontab
  • Using Native commands and Crontab depending on what we need to backup.
     

Using Drush and Crontab

Scenario: Scheduling a database backup at 3 a.m. every morning –

Format:

  
0 3 * * *  -r  sql:dump --result-file=.sql --gzip

Example:

  
0 3 * * * /var/www/html/drupal_demo/vendor/drush/drush/drush -r 
/var/www/html/drupal_demo sql:dump --result-file=/var/www/html/drupal_demo/db-dump-`date +%d%m%Y%H%M%S`.sql --gzip

Using Native commands and Crontab

Scenario: The same one - scheduling a database backup at 3 a.m. every morning -

Format:

  
0 3 * * * mysqldump -u  -p  | gzip -c > .sql.gz

Example:

  
0 3 * * * mysqldump -u drupal -p drupal_demo | gzip -c > 
/var/www/html/drupal_demo/db-dump-`date +%d%m%Y%H%M%S`.sql.gz

Scenario: Scheduling a Files backup at 5 a.m. every morning -

Format:

  
0 5 * * * tar -czvf .tgz 

Example:

  
0 5 * * * tar -czvf /home/ubuntu/backups/drupal_demo-files-`date +%d%m%Y%H%M%S`.tgz 
/var/www/html/drupal_demo/web/sites/default/files/

Mar 02 2021
Mar 02

Drupal considers menus, custom blocks and taxonomy terms as content (although it really isn’t going to be used as content). While importing or exporting these so-called content, you might run into issues such as getting only the configurations exported/imported but not the entire block (or menu or taxonomies). Or sometimes when you try to export a menu, the menu items are often missing. The Structure Sync module in Drupal 9 (and Drupal 8) comes in handy to import or export menus, taxonomy terms and custom blocks via the configuration. 

This helpful module reduces the burden of creating the same content in different places and allows for complete syncing between environments. With the Structure Sync module, you can also perform partial imports or exports to blend well with specific environments. The module lets you synchronize content using Drush commands and admin UI, both. Instead of importing and exporting content like menus and vocabularies manually, the Structure Sync module automates the process and saves a lot of time.

Structure Sync Module

Installing the Structure Sync Module

The Drupal 9 Structure Sync module is a contributed module that can be easily downloaded here or with the help of composer.

Using Composer:

  
composer require drupal/structure_sync

drush en structure_sync

Implementing Structure Sync with an example

Here, for the sake of the explaining the usage of this module, I will create two Drupal 9 instances.

  1. Drupal9.local  
  2. Techx.local

Let’s create a Custom block in the Drupal9.local instance. We will be exporting this block using the Structure Sync module.

Custom Block Local

Let’s create a custom block called “Copyrights”, which I will be adding to the footer block of my page layout.

Custom Block Footer

Here in the below screengrab, you can see the Copyrights block created and placed in the footer.

Screengrab

Now comes the interesting part of exporting the footer block that I’ve just created. Let me first push this custom block normally (without using the Structure Sync block) with the push command and then take a pull from the other instance (techx.local).

Git CommitGit Pull

And now when you check if the Copyrights custom block has been moved to the techx.local instance or not, what you get is a broken block. Here, the configuration got exported but not the block.

Structure Sync Custom

To avoid these ugly situations, we will now use the Structure sync module. Now that you have already installed the module, navigate to /admin/structure/structure-sync. Next click on the Custom blocks tab since we will be exporting a custom block.

Export Custom Block

Here, under Export, you will find a list of your custom blocks. Select the ones that you need to export and then click on the Export custom blocks button. Once you hit export, it becomes a part of the configuration. Now go to your configuration and type the command “drush cex” to export all configurations.

Drush Cex

Here in the above screengrab, you can see that structure_sync.data is now a part of your config management. To get the entire block, you will now need to import it from the “techx.local” instance. For that, first you need to run the command “drush cim”. This will import all the configurations into that instance.

Drush Cim

Now, in the techx.local instance, navigate to /admin/structure/structure-sync/custom-blocks and click on import custom blocks (safely).

Custom Block Import

You will now find the custom blocks from the “Drupal9.local” instance have been successfully imported into the “techx.local” instance. Notice that you have three options to import –

  1. Safely - this is a safe option as it imports only those custom blocks/taxonomies/menus in config that were not previously there.
  2. Full - this will import all the custom blocks/taxonomies/menus regardless if they have already existed before. It deletes any custom blocks/taxonomies/menus that are not in config.
  3. Force - Be careful while using this one. The force option will not check for any existing blocks, menus or taxonomies. It deletes all custom blocks/taxonomies/menus in the system and creates new ones.

For this example, I will be selecting the Import custom blocks (safe) option.

Importing Custom Blocks

On successfully importing the custom blocks, you will now be able to see the “Copyrights” custom block that has been completely imported in the techx.local instance.

Successfully Importing Custom Block

Drush Commands

If you are not a UI person, you can use these commands to perform successful export and import using the Structure sync module.

The available Drush commands are:

  • drush em (export menus)
  • drush im (import menus)
  • drush eb (export blocks)
  • drush ib (import blocks)
  • drush et (export taxonomy terms)
  • drush it (import taxonomy terms)
  • drush ea (export all)
  • drush ia (import all)

While importing blocks/menus/taxonomy using drush it prompts you these options:  

Import Style

Select the number mentioned in the boxes to make your choice.

We can use the same steps to export and import Menus and Taxonomy terms as well. One thing that you do need to keep in mind is that when you are exporting / importing menus, blocks or taxonomies, the entire content gets imported/exported. For example, you cannot selectively choose some of the menu items in that menu to be exported/imported. 

Feb 23 2021
Feb 23

Project Management is easy. It is like riding a bike. Except the bike is on fire. You are on fire. Everything else is also on fire.

A whole set of easy-looking tasks with enormous responsibilities to take care of - Yes you guessed it right, we are talking about "Project Management" - a task which seems easy to everybody else but to the one who is doing it. While the main intention of project management is to complete the project with less struggle and to deliver it within the budget and on time, not everybody has an idea about how much planning, strategizing, and communication it involves.

The other day I was curious about what Drupal.org has to say on project management. Nothing less than a bible for all Drupal developers, I was sure to find something of my interest for Drupal project management, & I was not surprised to find a set of Drupal Project Management Tools (a suite containing several components, structured as Drupal modules) But what left me wondering was, are these tools and project modules enough to achieve a Drupal project's goal. As a Drupal project manager, tools are just not enough to bring the scope of a Drupal project to completion. From Drupal website design to development and maintenance, there is a lot more to Drupal Project Management and it is certainly not one of those tools.

Drupal Project Management - What no one is talking about

Preparation

Irrespective of your approach or methodology and the type of project to be handled, Drupal requires preparation. From objectives or goals to the time frames, you need to be quite clear with what the client requires and this is possible only if you and your client are on the same page. Inputs from your team who are experts in Drupal will be your trump card in the process of planning and preparation. This will not only enable you to come up with better time frames, but you would also be able to know the prerequisites, interdependencies, and work conditions.

Never fail to miss critical inputs irrespective of how small they are to the Drupal project. You might end up missing something valuable.

Communication - Keep it Open

Always keep the communication lines open. It might be from your team, the client, or even the end-user, every input is important. Though the inputs might not be from a Drupal expert, it might still be something that you could have missed or you don't even have a clue about. This type of open communication makes managing your Drupal project easy as the success entirely depends on this. Good communication allows you to discuss challenges, roadblocks, and risks associated with your Drupal project, which in turn helps you focus better on your goal.

Time Management

The bad news is time flies. The good news is you are the pilot - Michael Altahuler

Time management is the most important factor of a Drupal project. But before you even jump into the pit and start juggling multiple tasks to ensure you manage everyone else's time, you better be good at managing your own time! And the good news in a Drupal project is that everything can be broken into smaller tasks for you and your team. Irrespective of its size, breaking down your project into smaller tasks helps your team to visualize and focus in a better manner. Keep it simple and keep it real.

Take Feedbacks Seriously

Never be reluctant to receive feedback from anybody related to your Drupal Project. Feedbacks are the step to improvement & we all need people who can give us such feedback. Feedback helps you realize your mistakes and learn ways to tackle them going further. Such constructive criticism helps in stabilizing the project before it goes off the deck completely. What is better than staying one step ahead from yesterday and performing in a superior way?

Transparency: Key to Success

You need to ensure that there is a high level of transparency between your client, the core team, and the extended project team. One way of doing this is by keeping them proactively in a loop. This corroborates trust-building and open communication between the team members. For example, if there is a delay in your Drupal project, let the client know about it! Never end up in a place where they come looking for you.

Add some Spice

Coming together is a beginning, keeping together is progress, working together is a success. - Henry Ford

Teamwork is by far the best possible way to handle any hassles in your Drupal project. Bond with your team, take a day or two out from the busy schedule to do something fun. Research has proved that such activities help people work more efficiently on a project. As a matter of fact, Drupal development companies around the world conduct Drupal cons and Drupal meetings to create a bonding between developers from around the globe.

Know Your Tools

While all the above-mentioned points play a major role in Project Management, you still need to know your tools/modules in order to successfully deliver your project.

The most popular tools in the market are the ones that help you break down your project into various tasks and sub-tasks. Most of the tools provide additional capabilities or features required for better project management.

Some of these tools include Jira, Trello, Redmine, Zoho, etc.

Drupal offers quite a few modules that can play a major role in assisting Project Management. Though Drupal 8 does not quite yet provide a suite of tools, the list includes some good modules.

Feb 16 2021
Feb 16

A good content management system should not only focus on the way your content is presented to the user. It should give you the flexibility to manage the content publishing workflow smoothly and effectively. Many times, teams must work together with the content teams to churn out content regularly. Without a structured editorial workflow, where content moves from one state to the other, managing a publication process becomes tedious and chaotic. Enter the Content Moderation module for Drupal 9.

The Drupal 9 Content Moderation module gives complete flexibility to content editors and marketing teams to manage their editorial workflows effortlessly. The module works in conjunction with the Workflows module to manage and create different workflow states and transitions. The Content Moderation module was first introduced to Drupal 8 as an experimental module in Drupal 8.2. It was based on the contributed “Workbench Moderation” module. With Drupal 8.5, a stable version was released and is now a Drupal core module! On a sidenote, did you know that 88% of the top 1000 Drupal projects are now Drupal 9 compatible? If you’re still on Drupal 8 (or 7), what are you waiting for? Migrate to Drupal 9 today!

Content Moderation

What can you do with the Drupal Content Moderation Module?

Here’s why you should be implementing this amazing module for all your content workflow needs:

You can have different states for your content workflow – Draft, Published, Archived (much improved from the previously Published and Unpublished states).
Create and add your own state to the list! It could be a Needs Work, a Ready to publish, or any state that is required by your business process and editorial workflow.
When you create your own state (or edit an existing one), you can choose if you want to publish the content soon after entering that particular state. Or/and you could also choose to make it as the default revision.
You can create a transition to define what to do when the content moves from one state to another. 
It allows for granular permission control for every state and transition.
You can select the content types that you want to apply the workflow to (Article or Basic page by default).
In addition to the default editorial workflow, you can create your own customized workflow too!

Implementing the Content Moderation Module

As previously discussed, the Drupal Content Moderation module is available in core (since Drupal 8.5). However, you will need to enable the module by navigating to /admin/modules. Next, click on Install. 

Content Moderation

Enabling the Content Moderation Module

Once the module has been enabled, go to Configuration -> Workflow -> Workflows. Here you will be able to see a default workflow called “Editorial”. Or if you have added multiple workflows, you can see a list of them in this page. Click on Edit to make changes to the existing workflow.

Default Workflow

Editing the default Workflow

Label: You can add or modify the name of the workflow.
States: By default, there are three states - Draft, Published and Archived. You can click on the “Add a new state” button to create your own state like “Needs Work” or “Needs a Second Review”.

Adding a New State

Adding a new state - Needs Work

Transitions: Transitions tell the content editors what to do after a change of state. In addition to the pre-existing transitions like “Create New Draft”, “Publish”, “Archive”, etc., you can also create your own transition to handle more complex workflows. For example, if you have just created a new state for “Needs Work”, you could support this state by adding a transition called “Move to Needs Work” from a “Draft” state to “Needs Work” state.

Adding a New Transition

Adding a new Transition

This Workflow Applies To: You can choose to apply this workflow to your custom block types (Basic blocks) and content types (Article and Basic page).

Custom Block Types            Content Types

Workflow Settings: When you create new content, you can choose to default a state in the form. By default, the state is always “Draft”.

Track it with Content Revisions

Now with all of this information, you know that your marketing and/or content team can create and move content from one state to another effectively with the Content Moderation module. But how would you know who made that change, when did they make it or was it even made? Yes, content revisions to the rescue! With the revisions feature in the content moderation Drupal 9 module, you can not only see who made the changes and why, you can also revert to the previous changes (if there are more than one revision).

Content Revisions

Content Revisions

Access Control with Permissions

Having a content workflow and moderation system for a one-person team or a team where each member has admin privileges, is never a great idea. The permissions and access control feature for the Drupal 9 content moderation module gives granular control to a team of multiple content authors and editors. For example, you would want only a content author and editor to be able to use the Create New Draft transition. While a content editor can be the only one to be permitted to use the Publish transition.

To setup permissions for different users, navigate to People -> Permissions.

Permissions
Feb 09 2021
Feb 09

Are you among those who are still wondering if your web application really demands a front-end framework? With names like React, Angular, Vue, Backbonejs, Emberjs and jQuery hitting the tech market, choosing the best front-end framework for your Drupal website is another added conundrum. Read on to find answers to these popular questions that can help you make a better decision in choosing the best front-end framework for your Drupal website.

Front End Frameworks for Drupal

Why do you need a front-end framework?

Today's world is a close reality to something I dreamt of as a child. A world run by devices, the technology they use and their potential to change the future. New interfaces and devices have brought in sweeping changes to transform the web as we know it. Technologies like Artificial Intelligence and IOT have started to establish and make an impact in the digital world. This impact has changed the way we perceive a future with seamless, feature rich websites.

However, while newly web-enabled devices continue to dominate, we have evolved the way we develop for the web. Though the content remains the same, delivering this content differs from one to another based on requirements and complexities. The next generation of user-experience is here and websites are expected to function seamlessly and instantaneously.

With such requirements, it is tough to stick with the old solutions. While it isn’t impossible to build a complex yet awesome UI/UX with plain HTML and CSS, implementing one a front-end framework does reduce some bulk and messiness off as your front-end grows. Not surprisingly, most of the bigwigs like Airbnb, GitHub, Forbes, Netflix, Pinterest, PayPal, etc., who offer outstanding user-experiences, implement popular front-end frameworks like React, Angular and Vue.

Headless Drupal and Front-end frameworks

While Drupal can handle the backend beautifully, it isn’t as flexible in terms of its front-end capabilities. The need for modern, intricate, dynamic and application-like front-end interfaces gave rise to headless Drupal or decoupled Drupal as we know it. In a headless Drupal architecture, developers have the flexibility to build the front-end on their own without using Drupal. While Drupal still serves as a backend repository, front-end frameworks can talk to the database via API calls.

But how do you pick the right front-end framework for your Drupal website? While every framework has its own set of pros and cons, the choice largely depends on the needs and business requirements for the project. Let us discuss in detail.

AngularJS

The most preferred front-end framework on the list, Angular JS, is a developer's favorite when it comes to interfacing with Drupal. It lets you create feature-rich dynamic web applications and allows Drupal to work more efficiently, resulting in a dynamic, secure and a gripping Drupal website. Backed by Google itself, this open-source framework allows you to do handle your user's browser without having to fetch data from your server.

Things Developers Love about Angular

  • Extremely light weight and extensible with a wide scope of features.

  • An interactive framework, a result of which is great functionality like the two-way binding, which allows user actions to immediately trigger application objects.

  • Developers love HTML and the fact that AngularJS uses plain HTML templates that can be easily re-used, modified or extended, allows them to build interactive feature-rich web applications.
  • With a client-side nature, AngularJS does a great job in handling cyber-attacks as any data looking to breach the security cannot get anywhere near the server.
  • Immense community support which provides answers, tutorials and used cases, with well-developed documentation.

Drupal & AngularJS

With the user expectations growing with each passing day, decoupled Drupal or headless Drupal as it is commonly known, is gaining more popularity these days. The idea is to take advantage of Drupal's flexibility and powerful back-end capabilities while using a front-end framework to handle the client-facing interface. What better option than the interactive AngularJS to do the talking to the browser while Drupal takes care of the feature filled back-end.

Also, AngularJS does a great job in offloading Drupal from some of its logic and helping Drupal function effectively at the back-end. By moving display logic to the client-side and streamlining the back end will result in a site that performs better and faster.

VueJS

Created by former Google employee Evan You, this incredibly adoptable JS has quickly gained recognition among developers. A JavaScript library for building modern web interface, it provides data-reactive components with a simple and flexible API.

Things Developers Love about Vue

  • With a subtle learning curve and a component model, Vue stands on the shoulders of giants to provide benefits of reactive data binding and composable view components with a simple API.
  • A combination of React's best - Virtual DOM and Angular's best - two-way binding, allows VueJS to perform efficiently and improve the performance of the websites.
  • Real-time monitoring of the progress in development with a built-in state management is an added advantage.
  • Vue JS follows a component-oriented development style with modern tooling and supporting libraries. With a simple-to-use syntax, people who are using it for the first time find it easy to adopt.
  • VueJS is one of the top trending JS frameworks on Github.
  • It is highly supported by an awesome community and adoption within the PHP community which does a great job of maintaining good documentation.

Drupal & VueJS

Vue allows developers to request and store Drupal content as data objects using the official Vue-Resource plugin.

In combination with Vue, Drupal can exhibit its magic at the back end while the compelling features of the JS handle the client side. The component system in Vue is one of its most powerful features that allows large-scale application building which comprises small and self-contained reusable components.

ReactJS

ReactJS is more of a library than a framework, used to build user interfaces that work on a concept of reusable components and aim to solve the issues created by the slowness of the DOM by replacing it with the virtual DOM structure. An open-source project maintained by Facebook, ReactJS is the go-to option for some of the biggest corporations for a fast and seamless client-side user experience.

Things Developers Love about React

  • By nature, ReactJS is very readable and easy to understand thus making it easier to understand how components render from their source files.
  • ReactJS does a great job in combining HTML and JavaScript into JSX, which is a great asset for developers as the complexity between HTML and JS is eliminated.
  • With Virtual DOM, React can easily process large amounts of data in an efficient manner by monitoring the lightweight virtual DOMs.
  • Rendered extremely fast, ReactJS is a great option to build speedy public facing apps and sites that are smooth and offer a best in class UI experience.
  • A ton of proper documentation, invaluable tools, add-ons and more which are available to developers, courtesy of constant contribution by Facebook towards the development of React.
  • It is highly supported by an awesome community and adoption within the PHP community which does a great job of maintaining good documentation.

Drupal & ReactJS

A hybrid approach to use React for dealing with the UX complexities while relying on Drupal for handling the content can be an added advantage which easily allows consistent mapping of Drupal and React components.

With Drupal, one of the major weaknesses that hinder its performance is the way it consumes and displays the structure of content to the end user. This goes out of hand when the user interactions are complex and even the combination of Twig with JQuery is not good enough to match the complexities. However, integration with a modern library such as React provides all the necessary modern mechanisms that do a great job in building seamless, rich user experiences.

Feb 02 2021
Feb 02

The Robots.txt file is a very underrated on-page SEO factor. Not everybody realizes the value it brings to the table. The Robots.txt file is like an access control system that tells the crawler bots which pages need to be crawled and which ones don’t. It is a rule book for your website which is read by the various web spiders before it attempts a crawl on your website.

There are tons of amazing Drupal SEO modules in version 9 and 8 that help make our jobs easier and boosts SEO ranking. And one of them is the RobotTxt module. The RobotsTxt module in Drupal 9 (and 8) is a handy feature that enables easy control of the Robots.Txt file in a multisite Drupal environment. You can dynamically create and edit the Robots.txt files for each site via the UI. Let’s learn more about this utility module and how to implement it in Drupal 9.

RobotsTxt module for Drupal SEO

But how does Robots.Txt help with SEO?

So, Robots.Txt files restrict crawlers from crawling some pages. But why wouldn’t you want all your pages/files to be crawled, right? Why do you need to have any restrictions whatsoever? Well, in this case, the more isn’t always merrier.

  • Without a Robots.txt file, you are allowing web spiders to crawl all your webpages, sections and files. This uses up your Crawl Budget (Yes, that’s a thing) – which can affect your SEO.
  • A crawl budget is the number of your pages crawled by web spiders (Google bot, Yahoo, Bing, etc.) in a given timeframe. Too many pages to crawl could decrease your chances of being indexed faster. Not only that, you might also lose out on indexing the important pages!
  • Not all your pages need to be crawled. For example, I’m sure you wouldn’t want Google to crawl your development / staging environment web pages or your internal login pages.
  • You might want to restrict media files (images, videos or other documents) from being crawled upon.
  • If you have a reasonable number of duplicate content pages, it is a better idea to add them to the Robots.Txt file instead of using canonical links on each of those pages.

How to Install and Implement the RobotsTxt Module in Drupal 9

The RobotsTxt Drupal 9 module is great when you want to dynamically generate a Robot.Txt file for each of your website when you are running many sites from one codebase (multisite environment). 

Step 1: Install the RobotsTxt Module for Drupal 9

Using composer: 

  
composer require 'drupal/robotstxt:^1.4'

Step 2: Enable the module

Go to Home > Administration > Extend (/admin/modules) and enable RobotsTxt module.

Generates Robots.txt File

 

Step 3: Remove the existing Robots.txt file

Once the module is installed, make sure to delete (or rename) the robots.txt file in the root of your Drupal installation for this module to display its own robots.txt file(s). Otherwise, the module cannot intercept requests for the /robots.txt path.

Remove Robots.txt file

Step 4: Configure

Navigate to Home -> Administration -> Configuration -> Search and metadata -> RobotsTxt (/admin/config/search/robotstxt), where you can add in your changes to “Contents of robots.txt” region. Save the configuration.

Contents of Robots.txt

Step 5: Verify

To verify your changes please visit https://yoursitename.com/robots.txt

Verify Robots.txt File

RobotTxt API

If you want to implement a shared list of directives across your multisite environment, you can implement the RobotsTxt API. The module has a single hook called  hook_robotstxt(). The hook allows you to define extra directives via code. 

The example below will add a Disallow for /foo and /bar to the bottom of the robots.txt file without having to add them manually to the “Contents of robots.txt” region in the UI.

  
/**
* Add additional lines to the site's robots.txt file.
*
* @return array 
*   An array of strings to add to the robots.txt.
*/
function hook_robotstxt() {
  return [
   'Disallow: /foo',
   'Disallow: /bar',
 ];
}

Jan 26 2021
Jan 26

What’s common between Universities and Drupal? Both are powered by communities and both fuel community-based initiatives. In this article, we will look at some amazing educational websites built on Drupal and why they choose Drupal as their CMS.

Did you know every Ivy league school website is built on Drupal while 71% of the top 100 Universities around the world use Drupal? Numbers speak volumes about a good CMS, but we have many more reasons to prove that Drupal is the best CMS for educational websites. Read on to find out.

This list has been curated with information obtained from https://www.drupal.org/case-studies

Top 7 Remarkable Education Websites Built on Drupal

Why do top universities rely on Drupal

Top universities like Stanford, MIT, Oxford, and others alike, choose Drupal as their Content Management System. Universities are built on large communities – there’s the student community, the teaching staff community, the community of departments, the management, and other working staff. Being a community-driven CMS, Drupal helps knitting all these communities together. Drupal addresses issues in a way that streamlines information between each of its communities. 

  • Drupal allows for scalability to accommodate the ever-growing communities and varied web projects associated with them. The CMS is also well-known for dealing with a large user-base and high-traffic websites which is great for universities with a growing student base.
  • Drupal empowers educational institutes to build varied flexible solutions – from intranets to complex web applications to simple static web portals.
  • Drupal’s multi-site approach lets universities easily manage and create independent websites from a single codebase.
  • Features like multilingual, mobile-responsiveness, effective workflow management, access control, and others are now out-of-the-box with Drupal 8, thus making it an ideal choice for educational institutions.

Some Remarkable Education Institute Websites built on Drupal

1. George Washington University

Known best for producing some great leaders in every domain, George Washington University (GWU) relies on Drupal to create an engaging web presence for them. 

Why Drupal was chosen:

  • Drupal’s multisite feature now allows them to spin up new sites faster than ever before. 
  • Accessibility – GWU is committed to web accessibility and so is Drupal.
  • Responsive Web Design – The GWU website is completely responsive on all devices.
  • Ability to build scalable features and functionalities with customizable layouts.
  • GWU expected a reliable digital experience platform. And Drupal delivered.
George Washington University

 

2. University of Oxford

The prestigious University of Oxford has been at the top of the world university rankings for five years in a row. They offer over 250 different programs with a student population of over 24,000.

Why Drupal was chosen:

  • The open-source nature of Drupal worked out well for them financially and also meant that they will not have to depend on one company for all their development needs.
  • A global community of driven developers working towards making Drupal better every day.
  • To collaborate and work better with other units of the university who were already using Drupal.
  • Drupal’s list of quality case studies, including the White House, turned out impressive enough to make the final call.
University of Oxford

 

3. Rutgers University

Rutgers is New Jersey’s state university and is one of the highest-ranked public universities in America with over 71,000 undergrad and grad students. They moved their website to Drupal more than 10 years ago.

Why Drupal was chosen:

  • They wanted a design that looked great on all devices.
  • To deliver a consistent user experience among their various school locations.
  • Distinguish between their different schools yet provide a unified experience.
  • Allowed for fast and easy admission application at different university locations.
Rutgers University

 

4. Bookshare

Although not a university, we had to mention the Bookshare website because it does a fantastic job at imparting knowledge to the visually challenged and people with learning difficulties. There are different formats of accessing the books – audio, large-sized printed, or braille.

Why Drupal was chosen:

  • Web accessibility – They needed to have the highest level of compliance (AAA) to ensure accessibility by the visually impaired.
  • Multilingual capabilities – Bookshare is made available to people across the world and is currently available in 7 different languages (and counting), thanks to Drupal’s multilingual feature and translation modules.
  • To support deep integration with their existing APIs.
Bookshare Website

 

5. Georgia Tech Professional Education

Georgia Tech Professional Education is one of the many academic units of Georgia Tech, serving more than 36,000 learners globally. Georgia Tech is one of the top 10 universities in the US.

Why Drupal was chosen:

  • Its ability to integrate with various third-party marketing and communication tools.
  • Data security to protect student information.
  • Improved performance with smart caching.
  • To provide a user-friendly, easy to navigate and access website.
Georgia Tech Professional Education

 

6. UChicago News

The University of Chicago News office focuses on publishing new content ranging from student academic information to current affairs. They publish over 1000 stories every year that are later picked up and published by other media and publishing firms.

Why Drupal was chosen:

  • To improve website performance and speed during peak traffic events.
  • Powerful and smooth migration of their heavy websites with over 20,000 content nodes and over 10,000 taxonomy terms.
  • To be able to accommodate their growing number of pages, content types, and access control levels.
  • Easy creation and management of content with an effective workflow system in place.
University of Chicago News

 

7. University of Minnesota

Founded in 1851, this top university has more than 50,000 students enrolled in its programs. University of Minnesota is one of the very few universities that can boast about having a medical school, an engineering school, a law school, an agricultural school, and a veterinary school – all in one campus! They had 600 sites that needed to be migrated to Drupal, each of them heavy in terms of storage size with millions of monthly visitors.

Why Drupal was chosen:

  • They needed a flexible CMS that could handle their humungous number of visitors and content with ease.
  • To be able to quickly create new sites from standard design and features – using Drupal install profiles.
  • To build a centrally maintained, yet independently distributed platform that can be used across departments, satellite campuses, organizations, staff, etc.
  • To offer a secure platform with an extremely low tolerance for failure.
University of Minnesota
Jan 19 2021
Jan 19

“Update before you get outdated”. 

PHP 8 is here and is now supported in Drupal 9.1 and its dependencies! November 2020 saw the big release of PHP 8. We call it a big release because of the exciting new features and optimizations it comes loaded with (which we will be talking about shortly). 

Drupal 8.9 and 9.0 are however marked incompatible with PHP 8. They are still compatible with PHP 7.3 and PHP 7.4 – which happens to be the last major PHP update. PHP 7.4 will stop receiving active support from the community from November 2021. And thus, updating your website to Drupal 9.1 will be a good idea now.

Drupal 10, which is scheduled to release in June 2022, will mandate compatibility with PHP 8. Read on to find out about the amazing features PHP 8 has to offer and how you can check if your Drupal version is compatible with PHP 8.

Drupal 9.1 Compatibility with PHP 8

 

What’s new with PHP 8 (Notable Changes)

    1. JIT Compiler

JIT stands for just-in-time compilation. Starting from PHP 5.5, Zend VM became part of PHP. But 8.0 introduced JIT to address some long struggling PHP performance issues. For better performance PHP was based on OPCache using OPCode. This is precompiled code given to the processor as commands. However, it is not very native to the machine language. On the other hand, JIT provides actual machine code with a mechanism to work together with OPCache. JIT does not work automatically. We need to configure this in the php.ini file.

    2. The null safe operator

You must be familiar with the null coalescing operator (??) which worked as:

  
$value = $var1 ?? $var2

It checks for the null value of $var1 and returns it. If it is not null, it returns $var2. But it does not work with method calls. Here, the null safe operator comes into the picture.

  
$value = $obj->getData()?->getValue();

Here you can call the getValue() method; even if no method $obj->getData() returns null, the code will not crash. It will return null. On the other hand, using the null coalescing operator:

  
$value = $obj->getData()->getValue() ?? null; 

..will throw an error.

    3. Named argument

PHP 8 allows you to now pass named arguments to functions. It does not depend upon the argument order. Instead, you can pass the argument name.

  
function named_arg_example(String $arg1, $string $arg2, $string $arg3) {}

named_arg_example(
      arg1: ‘arg1 value’,
arg3: ‘arg3 value’,
arg2: ‘arg2 value’,
);

    4. Match expression

Match expression is like the switch statement, except that it does not require a break statement.

  
$value = match($check) {
0 => ‘Value is zero’,
  1, 2, 3 => ‘Value is non zero and less than 4’’
}

There are many other great new features added to PHP 8 like the constructor property promotion, Attributes, Constant type errors for internal functions, Saner string to number comparison, etc. More details can be found here.

How to perform a Compatibility Check with PHP 8 on Drupal

You can use this method to check if your version of Drupal is compatible with PHP 8 or not. For that, you will need to first make sure you have the required package – phpcompatibility. For more information on this, visit here.

Next, you should already be having Drupal installed. If not, you will need to install Drupal 9 in your system. Using composer to install Drupal is the recommended way. For information about composer installation please refer this document

STEP 1: Drupal Installation

Use this Composer command to install recommended version of Drupal

  
composer create-project drupal/recommended-project [my_site_name_dir]

You will need to change [my_site_name_dir] with the folder name you want to install Drupal into.

STEP 2: Installing the required Package

After installing Drupal, you will have composer.json in your Drupal root directory. Open it in text editor and add the following code:

  
"require-dev": {
    "phpcompatibility/php-compatibility": "*"
},

If you already have require-dev section in your composer.json file, just add

"phpcompatibility/php-compatibility": "*"  to the list.

Next, you need to provide location info to the PHP code sniffer by adding the following lines to composer.json

  
 "scripts": {
    "post-install-cmd": "\"vendor/bin/phpcs\" --config-set 
installed_paths vendor/phpcompatibility/php-compatibility",
    "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set 
installed_paths vendor/phpcompatibility/php-compatibility"
}

And then run:

  
 composer update --lock

It will install phpcompatibility and other required packages.

STEP 3: Compatibility Check

Now, use this command to check PHP compatibility for the project 

  
vendor/bin/phpcs -p [directorypath] --standard=PHPCompatibility 
--runtime-set testVersion [php version] --extensions=[file extensions] 
--report-full==[path/to/report-file]

You need to replace the directory path with the directory path that the test will run on. In our case it is ‘.’ because we want to run the test in current directory (All Drupal files and folder). You should also replace the [php version] with the version you want to check compatibility with - which in this case will be 8.0. Replace the [file extensions] with file extensions like php, module, inc, install, etc. The report-full gives you the flexibility to store the report log in a file. So you will need to provide the path for the log file.

So, for our case, the command will be: 

  
vendor/bin/phpcs -p . --standard=PHPCompatibility --runtime-set 
testVersion 8.0 --extensions=php,module,install,inc 
--report-full==./drupal9-php8-compatibility.txt

It will take a few minutes and you will get a drupal9-php8-compatibility.txt file, where you can check the reported log.

Jan 12 2021
Jan 12

The term Drupal invokes different feelings among different people, based on their professional background or on what they have heard or learned about the CMS. Over the years, Drupal CMS has evolved from a simple tool for hobbyists to a powerful digital experience platform for global enterprises. While Dries describes Drupal as a platform for "ambitious digital experiences", it is commonly referred to as a content management framework that allows for extensibility & scalability through the addition of various user-created modules that build upon its core framework.

Since Drupal 8 and its adoption of continuous innovation, new features and modern libraries are being added with every bi-yearly release. Drupal 9 is out already with its first feature (minor) release of Drupal 9.1.0 last month and we are already seeing the fulfillment of some of Drupal 9's strategic initiatives. With Drupal, promises are always delivered. And this is something every organization, big or small, looks for in a CMS. 

Still confused about moving to Drupal 8 now or Drupal 9 later
 

Drupal for everyone - ease of use

Popularity

Drupal is one of the most popular CMSes currently available & is the preferred choice for government agencies, large associations, non-profits & numerous Fortune 500 companies. Currently, over 1,738,777 websites around the world are built on Drupal. 

This graph compares the trend for the term "Drupal" with another popular CMS "Joomla" over a period of 3 years & it clearly depicts the growth of popularity of Drupal.

image

But why do large enterprises prefer Drupal? Is it as "easy to use " as they say? Let us find out.

Features for Everyone

One of the toughest challenges that Drupal adopters face, whether they are new site owners or novice developers, is trying to figure out what is difficult & what is easy with Drupal. Most of their questions revolve around the ease of use that Drupal as a platform brings to the table. Let us look at some of the basic (yet important) features that Drupal CMS provides to website owners.

Installation

For Drupal installation, more than the “technical knowledge”, you will rather than just need to know how to connect through FTP and install databases. Once you are ready with your prerequisites for the Drupal 8 installation, it will hardly take you minutes to complete the entire set up. The installer performance has been improved by 20% in Drupal 9.1.0 which makes installation faster and easier. Would you believe me if I say that the installation time of Drupal CMS for a new user with knowledge of general installation of other systems might be less than “One & half minute??”

image

Maintenance and Upgrades

One of the main focus areas for Drupal 9.0.0 was to improve its upgrade experience. And so it has. Upgrading to a major version is also as easy as upgrading to a minor version. This has been clearly witnessed on the Drupal 8.9 to Drupal 9 upgrade. 

Drupal CMS ensures that the maintenance and upgrades are easy to handle by the site administrators. The procedures for updating your website include backing up the website and then replacing the files using a web update interface.

Backing up the website takes minimal effort as the site administrator can back up the whole website by downloading only one file which contains the assets of the website.

Drupal also notifies the site admin every time an upgrade is required, thus ensuring that the website never misses an opportunity to stay up-to-date. However, if the administrator does not wish to change the version, Drupal CMS also provides security updates for the previous versions. For example, even though Drupal 9 has released June 2020, Drupal 7 still continues to receive support from the community.

Community Strength and Contribution

The unofficial tagline of Drupal - “Come for the Software, stay for the Community” speaks volumes about the strength of the community. Functioning well since 2001, the Drupal Community is known for its dedicated bunch of developers and contributors who use, build, teach, document and market the best practices in Drupal. You can find their amazing works on Drupal.org.

Usability

Drupal CMS allows administrators to access any page or a section of the page in visitor mode by clicking on edit. While the core does not include a WYSIWYG editor, you can still get it in the form of a module, replacing all the other editor integration modules. Drupal CMS allows easy editing of pages or sections of a page by creating a simplified experience for the editors and administrators.

Scalability

Drupal CMS is highly scalable with high traffic handling capabilities. Its web pages are cached indefinitely as the default setting configuration, but can also be manually cached for a specific time. Moreover, functionality area blocks can be cached, thus allowing better traffic handling capabilities for your websites.

Whether it is the extreme traffic spikes on certain occasions or the constant web traffic, Drupal handles all of that with utmost ease. Did you know that the digital experience of Australian Open 2019 was powered by Drupal? Like Dries said “When the world is watching an event, there is no room for error!”

Web 2.0 Features

Drupal CMS is an excellent community platform provider and It outperforms all other options in this particular area. The platform allows a website administrator to set permissions for site visitors to comment on any content of website.

Drupal also facilitates administrators to set permissions on who can edit, create or delete various content types. It can be an article, pictures, videos or any other media files, everything managed by the admin.

Security

Security is a major concern for web properties these days and Drupal leaves no stone unturned to ensure that your website is secure from any possible security breach. Security updates are published on drupal.org and the users are provided a notice every time a new update is released. Drupal’s active community is alert and any security loopholes are remedied very quickly. They also provide references to guide the user in making a site more secure. 

When it comes to security, Drupal wins hands down when compared to other opensource CMSes in the market today. Check out these statistics below which compares the number of sites that have been compromised by these popular CMSes in 2016. Drupal accounts only for 2% of the hacked websites according to this research.

Drupal security comparison

User Roles and Workflow

The greatest asset of Drupal CMS is its ability to create any number of user roles and assign different permissions. While Drupal’s core includes two default set of roles, anonymous user and authenticated user, it allows you to create multiple user roles depending upon the content types. Also, granular permissions to each user can be assigned based on content section using the taxonomy function.

image

How Does Drupal Make Things Easy?

  • Advanced Control of URL: Drupal provides a precise control over URL structure of a page. Each content item which is called node in Drupal can be given a custom URL. Also, the path auto module can automate custom URL structure for each content type.
  • Custom Content Types and Views: Using Views and the Content Construction Kit (CCK), Drupal allows you to create new content type without having to write a single line of code! Yes, any number of custom content types can be created and displayed in many different ways without any code! Some examples of content types that you can create are forum posts, tutorials, blog spots, news stories, classified ads, podcasts, videos and more.
  • Themeing and PHP Template: PHP knowledge for themeing? No, not anymore! Themeing in Drupal can be done with absolutely no PHP knowledge. Drupal CMS uses PHP template theme engine by default.
  • Hook System: This system in Drupal enables you to hook in new modules easily. This hook system is invoked when a particular activity is performed in Drupal. This approach allows Drupal core to call at specific places certain functions defined in modules and enhance the functionality of core. They make it possible for a module to define new urls and pages within the site (hook_menu), to add content to pages (hook_block, hook_footer, etc.), to set up custom database tables (hook_schema) and more.

I completely agree with Dries when he said that Boris nailed it!

Drupal sucks less - Dries Buytaertimage

Jan 05 2021
Jan 05

Marketers are constantly on the lookout for ways to boost website engagement and increase interactivity.   Various third-party integrations and tracking tools are tried and tested to see what works best for the business. But over time, keeping a track of all these snippets/tags/integrations that are hardcoded on the website can get tedious and messy. And that’s where Google Tag Manager comes in. In this article, you will learn about how to integrate Google Tag Manager with your Drupal 8 website.

Integrating Google Tag Manager with Drupal 8

What is Google Tag Manager and how can it help?

Google Tag Manager is like a toolkit. It has all the tools you need meticulously organized in one place. Tools like Google Analytics, Adwords, personalization tools, A/B testing tools, Remarketing, Native advertising pixels, and much more. All the integration tags can be stored in Google Tag Manager for better access and management. How can it help, you ask?

  • Marketers find it greatly beneficial as they don’t have to depend on developers to add and modify integration tags on the website. They can easily do it themselves.
  • Better organization of tags can help marketers’ access and manage their integrations easily.
  • Updating tags don’t require you to change them on multiple web-pages. 
  • Test if your tags get triggered on any event/action in the preview mode.
  • You can even check for formatting or security issues before deploying it to live.
  • Provides an extra layer of data security.

Integrating Google Tag Manager in Drupal 8

Drupal 8 integrates seamlessly with Google Tag Manager and installing it is also a breeze. This module is also compatible with Drupal 9! Now that we know how useful Google Tag Manager is, let’s move on to integrating it with your Drupal 8 website.

STEP 1 – Install the module

You can download the Google tag Manager module here.

Or run this command through composer with this command :

       
composer require 'drupal/google_tag:^1.4'

Install the GTM module

STEP 2 – Configure the Module

In the admin toolbar, go to Configuration-> System -> Google Tag Manager

Configure the GTM module


STEP 3 – Open Container Page

Once you click on Google Tag Manager, you will see a container page like this –

Open container page


STEP 4 – Add a Container

Click on the Add container button. This is where you will add the Container ID that you had created previously when you signed up with GTM. If not done already, go here to signup and create a container ID for yourself (shown in the below steps).

Add a container


STEP 5 – Create a Container

Under Account setup, give the Account name and your Country name.

Under Container setup, give the Container name and select the target platform as per your requirements.

Click on the Create button.

Google Tag Manager-Create n account


Step 6 – Get the Container ID

Once done, you will be able to see a popup screen that will display the code snippet that needs to be pasted in the head section. Look out for the Container Id which will look like an alphanumeric word and begins with “GTM”. Here it is “GTM-MXQN9XL”. Copy this code to your clipboard.

Tag Manager Code - get the container ID


Step 7 – Insert the Container ID

Head back to your Drupal setup where you had to add the container ID. Give a name for your container in the Label field and paste the previously copied container ID in the Container ID field. Save the configuration.

Insert container ID


Step 8 – And we’re all set!

To verify if the installation of Google tag manager has been successful in your Drupal site, go to the home page of your website and do an “Inspect Element”. If it has been installed properly, you should be able to see it within the <head> tag.

Check if GTM module is properly installed
Dec 29 2020
Dec 29

As I sit down to write this piece, I can only think of Coco Chanel’s quote, which will give you a gist of this article. “The best things in life are free. The second best things are very, very expensive”. In this article, we are going to compare Drupal - the powerful free and open-source content management framework, with other proprietary CMSs like AEM, Oracle WebCenter, and SiteCore.

The choice between a proprietary CMS and an open-source CMS usually depends on the organization's requirements for features, budget for technology spend, traffic, and support expectations. While there are tons of advantages and disadvantages of each of these CMSs, take a look at the below table for a few of their features.

  Proprietary CMS

  Open-source CMS

Built and maintained by a single company Developed and maintained by a community Source code is private Publicly available source code Acquired by paying a license fee. Pay per
customization and additional users Zero license fee. Pay per resource/agency for customizations. Slower support and new updates  Fast and easy support and frequently updated releases because of the large community. Closed development and lack of clarity on the code Transparency in terms of code quality and bug fixes


If you have been assigned the arduous task of choosing a good CMS that can meet all your business needs, it might be hard to convince into a free, open-source CMS like Drupal. Mid to enterprise-level organizations normally believe that quality comes with a huge price tag. But that is not always true and absolutely invalid with a CMS like Drupal. 

Drupal and other CMS comparison

Ease of use and customization

Choosing a CMS just because it is popular isn’t a great idea. You will need to find a CMS platform that is able to conform to your business model and grow with it. It should be tailored to support the business needs of your organization and also easy to use. One of the most important reasons for going with a CMS is to ensure easy updating of content.

AEM – Is a Web Content Management System that lets you build and manage multiple websites with ease. For content authors and web administrators, it is very helpful as the interface is similar to MS Word. It has some cool drag-and-drop features that make it easy to use even for a non-technical person. The authoring experience is very intuitive and slick. Installation and setup tend to get a bit tedious and finding a developer to help you out with it is comparatively difficult and expensive. AEM is based on Java and hence any customizations will need highly experienced developers.

Oracle WebCenter Sites – Lets you easily create and manage targeted and interactive online experiences while optimizing customer engagement. Content editors have the capabilities of previewing the content without leaving the platform. With very limited drag-and-drop capabilities, the admin user interface does not provide many options for configurations and seems very outdated. Customization possibilities are immense if you have skilled engineers with substantial experience in application server, ADF, and of course Java and the web. Managing the code in the JSP files can seem to get a bit difficult as the tags and scriptlets are blended together.

SiteCore – Is a .NET based Web Content Management System with which you can store, manage, analyze, and update your website content in a single platform. Comes loaded with tons of features for organizations looking for personalization, analytics, A/B testing, marketing webforms and more. It allows multiple content authors to edit and authorize content at the same time. The user interface for content authors and admins is very user-friendly and lets you drag and drop various reusable elements onto a page including JS widgets, images, text, and videos. It is very customizable too which is great for businesses with unique requirements. However, finding a certified Sitecore developer is not an easy task and also very expensive.

Drupal – Drupal is an open-source content management framework that lets you create and manage powerful websites. It has great features to use out-of-the-box itself or can be easily customized with thousands of freely available modules to suit every business requirement. There's tons of room for scaling and customizing a Drupal website. The learning curve is a bit steep and finding Drupal talent was not very easy. However, this has changed since Drupal 8 and its adoption of continuous innovation and modern frameworks like Symfony and object-oriented programming structure. Drupal 8 also provides a very clean and user-friendly content authoring experience with its WYSIWYG and drag-and-drop interfaces. There are a plethora of free themes to choose from that are easily customizable.

Features and Integrations

Your ideal CMS should provide you with everything your business needs out-of-the-box but that’s wishing for a little too much. Look for a CMS that can provide you with maximum features where you don’t need much third party integrations to do your job. Or a CMS that can easily integrate with external modules and integrations needed for your business.

AEM – AEM has some exciting features like a drag-and-drop UI for content authoring, a well arranged visual site-map, layout manager, calendar views for projects and tasks, re-usable content via Experience fragments, Touch UI, template editor, publication management, activity map integration, side-by-side page preview, assets search functionality, exclusive check-in check-out, user-profile integration, online revision clean-up, Mobile content services, etc. For extensive customizations, AEM allows for easy integrations with Adobe Marketing Cloud’s components like Adobe Analytics, Adobe Target (continuous assessment of content to be more relevant for more conversions), Adobe Scene7 (media management, web publishing, and enhanced web experiences made easy), Adobe Dynamic Tag Management (an intuitive tool for marketers), Adobe Search & Promote (to control and optimize search results) and Adobe Campaign (easily manage email delivery content). In addition to this you can also integrate AEM with third-parties like Amazon web services, Salesforce, Silverpop engage, Youtube, Facebook, ExactTarget, etc. However, AEM is not as tightly integrated with other third-party modules as it is with Adobe products.

Oracle WebCenter Sites – With features like Document management (Document preview, version control, image editing, watermarking, video editing, document collaboration, etc.), records management, file sharing, searching abilities (by metadata and keyword), workflow management, create-customize-extract forms, advanced security features (audit trails, role-based access, 259- bit encryptions, etc.) Oracle WebCenter Sites also allows for integrations with Wordpress, Outlook, Sharepoint, MS Office, CRM, ERP, Social media, Calendar Apps, etc. However, integration with other components is not very simple and needs skilled developers for the same.

SiteCore – Some of SiteCore’s features are made for sales and marketing executives, like Advanced editorial experiences, multilingual websites, personalization, AB testing, highly configurable security features, search engine optimization, analytics, print experience manager, web forms for marketers, marketing automation, social media marketing tools, etc. Sitecore’s Connectors ensure that your website integrates with third-party solutions easily and fast. Like SiteCore commerce connect, SalesForce, MS Dynamics 365, MS Dynamics CRM, Adobe In- Design, Google +, Visual Studio, FaceBook, Twitter, Brightcove and many more. All in all, SiteCore is a great tool when businesses need tons of integrations.

Drupal – A powerful set of out-of-the-box features and access to countless freely available add-on modules, makes Drupal the most preferred CMS. It comes with out of-the-box features like intuitive content authoring, rich text editor, easy approval routing process, storage and management of assets, search functionality, granular security features, thousands of templates to choose from, mobile-first approach, search engine optimization functionality, flexible taxonomies, multilingual, user role management, dashboards & reports, API integrations and much more. Some add-on modules that are almost absolutely necessary for most Drupal websites are CTools (set of APIs that assist other modules), Views (organizes Drupal content), Token (creates re-usable patters across your website), PathAuto (helps generate SEO keyword rich URLs), Webform (used for accepting any kind of forms), CKEditor (provides a WYSIWYG editor), etc.

Drupal also seamlessly integrates with almost any third-party solution available like CivicCRM, Salesforce, Marketo, Sharepoint, Alfresco, Magento, Ubercart, Payment gateways, Disqus, Wepay, HER/EMR systems, Google analytics and apps, LDAP, Opigno, Mailchimp, Wordpress, Joomla, Surveymonkey and the list can just go on. Being an open-source content management framework having over a lakh of active contributors, there really isn’t a feature or integration that Drupal does not already have. For extremely unique and specific business functionalities, of course, you can easily hire a Drupal developer.

Pricing and Support

Robert Genn, a renowned Canadian artist once quoted "A high price may be part of the mystique in selling difficult art". You should be able to get true value for the price you pay for a CMS. Being expensive doesn't make it fit for "enterprises".

AEM – According to Gartner Inc., AEM is one of the more expensive CMSs in the market, almost twice the price of its closest competitor. The total implementation cost comes close to $2m including licensing. There is a lack of experts who can implement and support AEM for your website while the Adobe support team pushes you into buying more service contracts or products to be able to help you further.

Oracle WebCenter Sites – The power and flexibility of Oracle WebCenter Sites does not come cheap. According to Oracle, the licensing costs is currently $100,000 per processor. Additionally, the first year of Oracle support is about $20,000. Having an excellent support with experienced staff and 24/7 support is great but covers only the core product. Any customizations or extensions will not be covered by support and you will need to hire not-so-easily-available developers.

SiteCore – SiteCore’s licensing fees starts at $40,000 with $8000 fee for every additional year. Implementing costs starts at $65,000 while support and other fees cost about $10,000 per year. SiteCore users have had issues with technical support for the CMS lately.

Drupal – The best and the most notable feature of Drupal is that it is Free! There are absolutely no setup costs or licensing fees and is free to download and use. Being an open- source content management system, you have full access to documentation and support forums that is provided by a community of volunteers. Most of the contributed modules are free too! Of course there are development costs if you need customizations for your business requirements and hosting charges. Drupal’s network of dedicated and helpful contributors are continuously working on issues and improvements that can help users immensely. Drupal developers are not difficult to find and hire either if you need customized support capabilities

Popularity with customers

Yes, popularity does not always guarantee quality but it is enough proof that there is a heavy demand for the product and it is selling well. The below figures are based on a latest report by BuiltWith as of December 2020.

AEM – AEM has powered over 106,125 websites.

Oracle WebCenter Sites – About 6,111 websites currently use Oracle WebCenter Sites.

SiteCore – 130,079 websites are powered by SiteCore CMS.

Drupal – Drupal hands down wins in the popularity category by powering 1,542,941 websites till date.

Dec 16 2020
Dec 16

We all know Drupal as this robust, flexible, and dependable CMS platform but not many realize its abilities when it comes to SEO. SEO can be one of the most influential factors for the success of an organization or a business. Did you know that 93% of online experiences start with search engines and 51% of all website traffic is attributed to organic searches (source)?! 

When people from around the globe search for your product or services, you want to appear as high as possible on the search engine ranking. Improving your SERP (Search Engine Results Page) ranking is now more important than any other marketing strategy. Ideally, Drupal SEO is about making your website easy for both your visitors and the search engine crawlers to understand. Thus, your SEO strategy begins long before your Drupal website is built. With an effective long-term perspective, its amazing collection of Drupal SEO modules, its flexibility and customization options and not to forget, the loyal community working towards the betterment of the open-source platform, Drupal tops the CMS chart. Drupal 8 (and 9) offers some exemplary modules that can boost your Drupal 8 SEO and SERP ranking.

With our SEO for Drupal guide, you don’t have to go too far in search of Drupal SEO modules, features, and tips to boost your website ranking. 

Lay your Foundation

With Drupal 8, most of the required SEO best practices are already embedded into the core of the platform and with a little knowledge of SEO and some must-have configurations, anybody can possibly boost their website’s SEO to drive more traffic. But before you jump right into the tools and other configurations on Drupal 8, sit back and think about the basics which you need to get right for your website's success.

Things to remember -

  • With your website goals in sight and your visitors' interests in mind, sit down and form a proper pre-SEO strategy, to begin with. 
  • Know your audience before you begin with your Drupal 8 SEO strategy. Once your audience set is established, shooting targeted content will be easier.
  • Pay attention to every detail that goes into your On-page SEO (content, improve keyword ranking), Off-page SEO (backlinks), and Technical SEO (site architecture, UX, clean code). 
  • Website performance and site speed directly contribute to a website’s SEO ranking factor. This is not just true because of Google’s algorithm update for speed but also because a slow loading website hampers user experience.
  • Yes, come 2019 and Google has changed the way SEO used to work previously. The focus is more now on the value you bring to your users – mainly through content. Hence, getting your Content strategy right is very crucial for a good website ranking.
  • Google favors websites that make it easy for users to navigate and access irrespective of the device. With Drupal 8, you can be assured of a responsive website because of its Mobile-first approach. 
  • Remember that SEO works differently for different businesses. There is no one-size-fits-all when it comes to crafting an SEO strategy for your Drupal website.

Top 5 Drupal SEO Modules to Optimize your Website

With Drupal 8 and the continuous innovation approach, it has adopted some of the best-in-class technologies thus making it more future-proof. More importantly, it has made content authoring more powerful and easier at the same time. One of the great things about Drupal 8 is that it is "SEO ready" right out of the box. Drupal 8 has hundreds of Drupal modules to choose from to boost the SEO of your website. Let's make your job easier by laying out some top Drupal SEO modules that help enhance your SEO efforts on your Drupal website.

1. Metatag Module

We all know what a significant role does meta data play in improving the overall SEO of a website. It’s the hidden information that is seen and understood by search engine crawlers that gives them an overview of what your page is all about. The Drupal Metatag module (previously Metatags) lets you create and modify different meta data elements of your website. 

Meta-Module

The Metatag module plays an extremely important role in improving your website’s Drupal SEO ranking. Take a look at this article to set up and install the Drupal Metatag module.

2. Pathauto Module

It is proven now that websites with a more organized, user-friendly and keyword rich URL have a better click-through rate (CTR). And a better CTR means a better SERP ranking. The Drupal Pathauto module lets you easily automatically generate URL or path aliases for different kinds of content.

pathauto-module

         Pathauto Module

You can even create bulk URL aliases automatically when you have tons of content that needs to be converted to user-friendly URLs.

3. Simple XML Sitemap

Sitemaps are essential for any website to let the search engine bots know which of its pages needs to be indexed and on what priority. The Simple XML Sitemap Drupal module allows you to automatically generate XML sitemaps for your Drupal website. The sitemaps generated follow the latest Google standards. 

Simple XML Sitemap

The Simple XML sitemap module also supports multilingual content by creating hreflang sitemaps and image sitemaps.

4. Google Analytics Module

In our recent post on the Google Analytics Module, we discussed how you can add the module to your Drupal website and also create custom reports for better performance of your website. Though the Google Analytics Drupal SEO module does not have any direct effect on your SEO for Drupal or does not improve your search engine ranking, it plays a major role in providing the necessary information that can amplify your Drupal 8 website's SEO success. By tracking your visitors, their behavior and interests within your site, you can change or add new strategies to drive more traffic and increase conversions. You can also use the GA Reports module that can provide you with a graphical representation and details reports about your Drupal website.

drupal google
        Google Analytics Module

5. Redirect Module

Google certainly does not like spammy duplicate content on a web page. Such content can have a negative impact on your SEO efforts and as a result, can harm your rankings on the search engine. On Drupal, while you are happy creating clean URLs with the alias system, you should note that there is a small problem arising. With the creation of new URLs, the default URL still exists and the search engines do not see it as a good sign.

global-redirect.

      Redirect module

The Global redirect module helps in rectifying this problem by verifying the existence of an alias for a URL and letting you manually redirect it to the same. The Redirect module also plays a role in checking the URL implementation and permission or the access required to the nodes and URLs. You can also install the Redirect 404 submodule that will log all the 404 errors and lets users create redirects for those often-requested pages. Another submodule that can be used alongside this module is the Redirect Domain that lets you redirect between different domains.

6. Real-time SEO for Drupal

This is an extremely cool module that lets you edit your SEO elements (meta data) like in real-time! No more worrying about how much description and content is too much or too less. Or wondering what it may look like in the search engines. It is like a What-You-See-Is-What-You-Get editor for SEO. It works in co-ordination with the Metatag module to offer some absolutely stunning features.

real time SEO

7. Drupal SEO Checklist module

If you are a ‘To-do-list’ person who is in love with organizing things, this Drupal SEO module is for you. The Drupal SEO Checklist module is one of most significant Drupal SEO modules and something you absolutely need. This Drupal module does not directly affect your SEO and improve the SERP but will provide critical information on the changes to be made on the site. The Drupal SEO Checklist module checks your entire Drupal website for proper search engine optimization against SEO for Drupal best practices and tells you what to do. It provides a detailed report on what needs to be done to improve the performance of your Drupal website.

seo-checklist
          Drupal SEO Checklist

The SEO checklist module keeps a track of how tasks have been taken care of, what has already been done (with timestamps) and what needs to be attended to. If a task needs you to install a module, it provides with a link to download it as well. This data provides a report that can be used for further monitoring. However, this module is only supported in Drupal 8 (and 7) but not compatible with Drupal 9 yet.


In addition to these Drupal modules, there are many other Drupal SEO modules such as the Page Title module which allows the page title to be set, the Meta tag module which equips you with complete control of meta tags on your Drupal website, and the XML Sitemap module to create a search engine readable, dynamic sitemaps.

Some Additional Tips to Improve your Drupal site's Ranking

Just to let you know, while you were reading this blog:

  • More than a million Google searches were made.
  • Close to 20,000 Facebook posts were posted.
  • More than 1000 blogs were posted on the internet.

The internet is noisier than ever now, and it doesn't seem like it is going to stop anytime soon. SEO at its beginning stages was all about cramming your website with keywords and let the crawlers do their magic. But over time, SEO has blossomed with Google introducing some amazing algorithms and updates to curb the black hat SEO practices.
Right now, for a successful Drupal 8 SEO campaign, you need to study your visitors, their behavior and interests on your website and curate the content accordingly to stay ahead of the curve. You don't want to be in the midst of a content gap which can create problems for your website's conversions. With this study, you have a real opportunity in hand to develop fresh content for your Drupal website and optimize it for the searches on the search engine.
 

Nov 03 2020
Nov 03

As a developer, you will come across several situations when you need to import data from external sources. Sometimes you will need to import data from more than one source into your Drupal 9 website. The Feeds module in Drupal is a simple, no-fuss module that enables even non-technical users to import content from different data sources. What makes it simpler than other Drupal modules like the Migrate module, is that the entire import process is done through Drupal’s UI. It delivers content to you the way you want it as soon as it is available.

Many websites import RSS / XML feeds from third party sites. In this blog, we are going to get a news feed imported through this 3rd party API that provides data in json format with the help of the Feeds module in Drupal 9

drupal-9-feeds-module

Installing the Drupal Feeds Module

The Feeds module for Drupal 9 lets you import data from different formats like CSV, XML, JSON, RSS, etc. into nodes, users, and taxonomy terms via the UI.
 
1.  Install the Drupal Feeds module (Here we will be using composer)

       
composer require 'drupal/feeds:^[email protected]'

2.  Here, we are using JSON feeds for importing data. So, we require a JSON parser which will need us to install one more module which is the Feeds extensible parser. The best way to install this module is by using composer because it downloads all required libraries. (You can also skip the first step if you're downloading using composer as the Drupal feeds module will be a dependency for the feed_ex module).

       
composer require 'drupal/feeds_ex:^[email protected]'

Note: If you're not using composer to install then the libraries required by this module can also be installed with the Ludwig module. Install the Ludwig module and then go to /admin/reports/packages for further instructions.

3.  Enable the feeds and feeds_ex (Feeds Extensible Parsers) module either by using drush or through UI.

Feeds Module

Configuring and Implementing the Feeds Module

Here, we are going to import the data from https://newsapi.org/ website articles (Topics related to “Top headlines from TechCrunch right now”) which is exposed in JSON format shown in the below screenshot. 

To get this news data we need to login to the website and get an API key. Next, select the topics for which you wish to import the data to your website.

feed module configuration

Looking at the API, let's create a content type where our data needs to be imported.

Creating a Content Type 

Here, I have created a new content type called “News”. Choose the field type according to your JSON for which data needs to be migrated. 

content type-feed module

In the above screenshot, we have chosen simple fields for importing the data like Author which is Text(plain) field for the importing data from JSON key author. 

JSON Key Author

As you see in the above screenshot, we have added the Feeds item field of type Feed and chosen the feed type accordingly. We will be learning how to create a Feed type in the next section below.

Creating a Feed Type 

Follow the below steps to create a feed type.

  1. Navigate to Feeds overview page (/admin/structure/feeds). You can see all the Drupal feeds listed on this page.feed type - feed moduleI have already created 2 feeds. Here I am going to be using News feeds. You can create your own feed type by clicking on Add feed type. 
  2.  When editing the feed type or adding a new feed type, we will see the below options.
feed modules
  • The Fetcher settings option shows where you’re importing the content or fetching the content from.
     It provides 3 options to choose from,
  1. Directory :- Import the content from a file or a series of files already on your website.
  2. Download from URL :- Import the content from url (Which we will be choosing in our case).
  3. Upload file :- Import content from a file.

Based on the Fetcher selected, we will have to configure the Fetcher settings. For the secondary option of fetcher settings, we have the below list of settings.

  • Auto-detects feeds
  • Use PubSubHubbub 
  • Always download
  • Request time out

Configure secondary settings accordingly.

Configure - feed modules

•    Parser lets you configure the format of the feed. Here we have many options to choose from like CSV, HTML, OPML, JsonPath (which is our setting), etc. Choose the one from the dropdown menu according to your feed format.
 
Based on the parser selected, we will have to configure the parser settings. In our case, we don’t have any parser settings for parsers of type JsonPath.
 
•    Processor settings show configurations of the type of content the feed will create.

Similarly, we have a secondary settings option for the processor as shown in the image below.

feed modules

Configure your secondary settings according to the requirement.
The below screenshot shows the primary settings of fetcher, parser, and processor.

feed modules


3. Mapping sources to target

The help text says base query to run, which shows the root or base of the data to be targeted for the Drupal feeds import as content. In our example, we have configured it as “$.articles.*” because our data resides inside the article key. Look at this path documentation to configure yours.

  • Field Mappings

Now, we can configure the Feeds module to decide which value pulled in from the JSON should map to which field on the Drupal news content type.
 
These targets are the Drupal data fields and are pulled in based on the processor you select when creating the feed type. You can also configure other settings for the particular mappings of the fields like Language, filter format (applicable for text formatted fields), unique (unique identifier used to track if the content is new or existing one), etc.
 
For example, if we want to import the JSON feed news article content title as Drupal news content title field then the target will be the Drupal Title field and the source will be JSON news article title key as shown in the below screenshot.

JSON Feeds

Here we are using the mapping configuration as shown in the below screenshot.

feed modules

You can also clone the feed type using the Entity clone Drupal module that is also supported in Drupal 9.

Creating a Feed

To create a feed, navigate to content -> Feeds tab -> add feed -> select the feed type

feed modules

I have already created one for News. To create a new feed, click on the + Add feed button and configure the feed as required. For our blog, we have configured as shown in the below screenshot.

feed modules

After the configuration, click on Save and Import. This will import the Drupal feeds as content. When the data is getting imported, you will see the processing status as shown in the below screenshot.

feed modules

Once the JSON data gets migrated to content, we can see the content added to the news content type as shown in the screenshot below.

feed modules

Now, let’s compare the imported content with feeds.

feed modules    Source Content from the techcrunch articlefeed modules      Drupal feeds import - Feeds module

For more detailed information you can refer to this guide.

Additional modules to extend the Feeds module 

•    Feeds Tamper module helps you modify and update the source data before it gets imported to your website.
•    Feeds extensible parsers contains a set of parsers like XPath XML & HTML, JSONPath JSON & JSON lines parser, etc.
•    Feeds Import Preview module lets you see the content in your source before importing it.
•    Commerce Feeds module helps you in importing products to your Drupal Commerce site.

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web