Feeds

Author

Mar 17 2020
Mar 17

Drupal 8 custom modules can range from being super simple to highly complex, depending on the need for the customization. The true power of Drupal can be unlocked with custom modules in Drupal 8. Irrespective of the complexity of a custom module, following some best practices can help you create more efficient custom modules. So, let’s get started!

Recently, I was looking for a module in Drupal and something just crossed my mind. In the Drupal world, when you are looking out or considering solutions, the first thing you might hear is, "there is a module for that!". While there are close to 70 core modules in Drupal, it is the additional contributed modules built by the Drupal community that extends the platform's functionality. And with Drupal 8, there is a completely different architecture and modernized approach towards CMS, with a shift towards object orientation to improve the overall efficiency and software quality. Creating a Drupal 8 Custom Module to further extend Drupal’s capabilities is not the same as it was in Drupal 7.  

What is a custom module in Drupal 8? Why create one?

A Drupal 8 custom module is basically a module that is made up of customized functionalities. The Drupal custom module could start with a contributed module that needs small customizations or a completely new Drupal 8 module with new sets of non-existent functionalities custom fit to the project. Or sometimes, a migration from Drupal 7 to Drupal 8 will call for a custom module because the Drupal 7 module isn’t available in Drupal 8. A Drupal 8 custom module is essentially built to extend the core functionality of Drupal, which by itself comes with built-in set of core modules. 

Regardless of how your experience has been with the previous versions of Drupal, module development in Drupal 8 has its own set of challenges. To give you a fair idea, there are some differences between Drupal 7 and Drupal 8, the key ones being that Drupal 8 requires the latest version of the PHP 7 to run and it uses Symphony, a PHP framework that relies on Object Oriented Programming. Nonetheless, Drupal 8’s new approach is a futuristic approach and has opened doors to a wider set of developers who are well-acquainted with OOP and MVC concepts.

Also, there are changes in the way a module is built and there are certain best practices to keep up with the community standards. Let us talk more about this.

Change in the Drupal 8 File Structure

One important point to remember is that in Drupal 8 modules development the file structure is quite different from the one in Drupal 7. Custom modules in Drupal 8 are stored in the /modules directory, unlike in Drupal 7 where this directory was reserved for the core modules. The core Drupal 8 modules now go into the /core directory.
Next up, to let Drupal 8 know that your custom module exists, you need to create an .info.yml file which provides the meta data. This process is similar to the one used for Drupal 7.

name - This key is to provide a name for your custom module.
type - This key defines the type of the extension (module/theme/profile).
description - This key provides the detailed description about the custom module (displayed on the module list page).
package - This key specifies the package in which the module should be included.
version - Specifies the version of the module. 

If your file looks something like 'blogexmple_module.info.yml', the syntax will be as follows-
name - blogexmple Module
type – module
description - A simple demo module
package – Custom
version - 1.0
core - 8.x


Use of Configuration before code

Having to rewrite the code every time you make any changes is quite a task. Instead of hard coding a class into a theme, set the values in the configuration and apply it with the code. This ensures easy and faster ways to code and results in high quality modules. With reusable codes being the norm in writing quality software, configurations in the code ensure advanced functionality and "easy to modify" features.


Use What Drupal Offers


Once you have built your module, you should know that Drupal comes with various built-in admin functionalities to store and display module data and settings. The module settings page can be defined with hook menu. This hook enables modules to register paths in order to define how URL requests are handled. With the drupal_get_form page callback usage, all you must do in the callback function is define and return the settings that are to be stored.


Too Many Cooks Spoil the Broth

Having worked on large scale Drupal sites for a long time, Drupal developers would have learnt that hundreds of modules can work their magic together to produce an effective large-scale project. But when working on enterprise Drupal websites, it is important to note that avoiding a single poor module has greater effects than avoiding 30 well-developed Drupal modules (in an attempt to use lesser modules). Developers then tend to favor programming their own modules over reusing existing modules. The higher the number of custom modules you write for a project, the more work it takes to maintain and modify your Drupal site later. Instead, consider publishing your modules on Github. This allows you to avoid usage of a large collection of custom modules and instead encourages you to create reusable code that has the required configuration.


Environment & Coding Standards

Development environment is an important influence as it ensures that a Drupal project runs without any hassle. Drupal development companies ensure that the entire team works in an exact same development environment for an efficient workflow.

While working in such an environment, one of the biggest issues to handle is to make sure that the code is clean and maintainable. Drupal developers need to make sure that their code is readable and makes sense to everyone they are working with. And this doesn't apply only to the team members or to anyone from your organization, but also to the larger Drupal community itself. With community involvement being an essential part of Drupal development and a key aspect in distributed teams working together efficiently, following the coding standards helps in achieving a project's goals and objectives.

Mar 03 2020
Mar 03

Web accessibility is ingrained in Drupal’s values and principles. Starting with Drupal 7, the web accessibility initiative has progressed to great extents through Drupal 8. Why is website accessibility so significant? How does Drupal 8 ensure website accessibility? Let’s dive in to answer all your questions.

The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. - Tim Berners Lee, Inventor of World Wide Web.

The internet as we know it today is 11315 days old! Originally conceived to meet the demand for automatic information sharing between scientists in universities and institutes around the world, the internet today is an integral part of more than 3 Billion people in the world. For various reasons ranging from social networking to collecting information for projects, internet today is arguably the most powerful resource known to mankind.

Over the years, the boom in chat-bot and machine learning applications has led to businesses crafting their online presence in the form of websites and using artificial intelligence for a better customer experience. This is not surprising, given the fact that in recent years, chat or messaging has taken over social media to be the "go-to" option for users who want to contact a business.

But have you ever stopped to think, can everyone access the web?

It is 2018 and I wonder, why is web accessibility still less, well, accessible? As a business, the competitive market pushes you to reach as many people as you can to promote your brand. More the barriers lower the chances of reaching potential customers. This basically is the concept behind web accessibility: to eliminate the barriers the audience face.

What is Web Accessibility?

Generally, people refer web accessibility with screen readers or visual disabilities. However, the range of topics that it covers is vast and includes more than that. For example, having an appropriate screen contrast for a person to see the screen on a sunny day is a use case for someone with a normal vision rather than for someone with a disability.

The World Wide Web Consortium has introduced some guidelines to achieve certain levels of accessibility to ensure that a website is as useful as possible. Published in 1999 as version 1.0 and later in 2008 as version 2.0, the WCAG 2.0 is generally accepted as the standard to measure when talking about web accessibility and the information you present to a user.
 

web_accessibility

The Importance of Web Accessibility

With the internet's growing importance in people's life, if what you want to convey (your content basically) is not easily accessible to everyone, you’re turning away your audience before they even get to the door. For example, something as simple as a broken hand or a temporary blindness can make it difficult to navigate the web.

While the fact that web accessibility is not only for those with disabilities is quite resonant, businesses need to know that the flexible and responsive design of a fully accessible website is a benefit to everyone. Web accessibility standards are built to promote inclusion and Drupal is setting a benchmark when it comes to supporting and fostering inclusion.

importance_of_web_accessibility

How does Drupal help?

Drupal CMS, a web based SaaS provides the ability to organize a manage an organization's web content in a systematic manner. The guidelines of the World Wide Web Consortium are divided into two - ATAG 2.0 that addresses the authoring tools and the WCAG 2.0 which addresses the web content and is widely used by developers and accessibility evaluation tools. Drupal CMS, as a platform, has been built to adhere to both the guidelines. While the accessibility initiative started with Drupal 7, Drupal 8, addresses some of the best accessibility features.

Drupal 8 Accessibility Features and Modules

The most advanced version of Drupal allows your website to be far more likely to be accessible, to assistive technologies and the users who depend on them, than ever before. Drupal 8 extends accessibility with various core and contributed modules. 

Better Contrast

Poor contrast level is often cited as the most commonly overlooked feature by the developers. However, in Drupal 8, the core themes have higher contrasts, thanks to the Drupal's accessibility maintainers. With improved contrasts, users suffering from colour-blindness can easily websites. Also, this feature is an added advantage when visiting a website under bright sunlight in a portable device like a mobile phone or a tab.

Forms

Errors while filling forms is one of the most common factors that affect the user interface. With the new standards, identifying these errors becomes much easier. By using a better form validation error verbiage, Drupal 8 provides an option to turn on this feature that improves accessibility related to the display of form errors. For example, a visually impaired person can now easily identify what errors he might have made when filling in a web form.

Buttons instead of links

A common practice among many website owners is to use anchor texts as "call to action" instead of buttons. From a semantic standpoint, it is more logical to use a button rather than anchor texts as these user interface elements are action oriented. Thus, Drupal 8 has called for this measure to use buttons rather than links. This new standard set by Drupal 8 can be handled without becoming heavily dependent on WAI-ARIA that can be useful in identifying the purpose of some elements.

Other Drupal 8 Accessibility Features 

Alt text (Alternative text) usually refers to the words that are used to describe a particular image. Though not visible or rendered on the page, these alt texts are used by tools like screen readers and is a great asset to web accessibility. This feature which is set to ‘required’ by default in Drupal 8 helps visually impaired audience to know what the image is all about with the help of the text.

TabbingManager is a feature that constrains tabbing and guides non-visual users to important “tabbable” page elements. This is useful for users who prefer to use the Tab key on the keyboard rather than the mouse.

The Aural Alerts feature is a Javascript function that passes an assertive or a polite message/instruction to the aural users if there are any changes made on the page (which would otherwise go unnoticed on screen readers).

Layout Builder Module

Layout builder is one of the most powerful and popular Drupal 8 modules that is widely used by content builders. It offers easy and powerful page-building capabilities allowing site builders to build custom pages, create and override reusable templates, granular customizations and much more. It has been stable since the release of Drupal 8.7 and is in core. 

As part as Drupal’s commitment to inclusion and accessibility, Layout Builder meets all the guidelines set in the WCAG 2.0 AA (needed to meet the AA level of the Web Content Accessibility Guidelines). Only once it passed the “accessibility gate”, the module was released as a stable version. And this was a commitment that was made and duly fulfilled by the Drupal community.

CKEditor Accessibility Checker Module

The CKEditor Accessibility Checker module is a contributed Drupal 8 module that allows you to test the accessibility level of the content within the CKEditor. It not only detects the problem areas in website accessibility; it also helps you solve them for better accessibility conformation. It leverages the Accessibility Checker plugin from CKEditor.com to perform these functionalities.

ckeditor_moduleImage Source: Drupal.org

SiteImprove Module

Siteimprove is a Drupal 8 contributed module that provides a plugin to connect your Drupal website to the Siteimprove intelligence platform. Siteimprove is a Digital Presence Optimization software that provide amazing insights that can not only help in improving web accessibility compliance but also helps improve website traffic, content quality, performance and more.

Text Resize Module

This is a contributed Drupal module for web accessibility and is widely used in Drupal 7 and Drupal 8 projects. It allows users to increase or decrease the font size of a web page with a click of a button. It helps visually impaired users to a great extent as they are able to adjust the size of the text that suits their eyesight.

text_resize_module Image Source : Drupal.org


 

The Future of Web Accessibility in Drupal

Over the years, Drupal has taken some great steps forward to achieve web accessibility through several of its major releases and is one of the leading implementations of the web accessibility standards. With web accessibility being one of the major factors contributing to the user interface and the ability of a business to reach the maximum audience, several strategic initiatives for Drupal core is sure to shape the future of how people interact with a website. Some of the noteworthy ones include:

  • Application-like interfaces and various UI interactions that are presented without full-page refreshes: sliding panels, autofocus, live result filters, drag-and-drop, pop-up success messages, live previews, wizard-like progress steps, and role impersonation.
  • Automated testing using headless browser drivers.
  • Supporting more interaction modes, such as MS Windows' high-contrast mode, and speech-driven control.
  • End-user testing for accessibility
  • The theme component library initiative which involves much refactoring of how Drupal produces output.
Dec 31 2019
Dec 31

In 2018, The Open Source Initiative celebrated its 20th Anniversary, a milestone and a huge success for the global non-profit dedicated to raising awareness and adoption of open source software. Since its inception, the open source movement has gained tremendous momentum in corporate computing. In the recent years, open source has entered the government sphere as well.

One such popular open-source platform is Drupal. Developed by Dries Buytaert in 2001, Drupal became a sensation when it was used to build a network for the Democratic primary campaign of Howard Dean in 2003. Since then, Drupal has come a long way and now more than 100 countries use Drupal for their government websites.

Steve Nichols, CTO of Georgia Technology Authority, which runs more than 65 state government websites, recently talked about how shifting to a Drupal platform helped him manage the government websites in a better way. Earlier, these government websites were running on two different versions of proprietary software - Vignette 6 and Vignette 7. But as the functionalities increased, it became very cumbersome and expensive. Soon they started looking out for other options, and all the evident choices pointed to open source CMS, and the most obvious and the strongest among all the contenders was Drupal.

When they dug a little deeper, they found out that many key federal government sites were being powered by Drupal, and that is when they decided upon to narrow down on the Drupal CMS.

So why exactly do these government websites opt for a Drupal CMS among the plethora of options? Why is the most obvious choice Drupal? Let us know a bit more about what makes Drupal so special!

Drupal's Market Share

In the present world, with more than 150 federal government sites running on Drupal platform, it is kind of obvious that the Drupal CMS has an enormous market share when it comes to the government websites and the public sector in general.

Nasa Website build with drupal cms

The list contains big guns like NASA, Department of Health, Department of Education, Transportation, Defense and Homeland Security. When Drupal platform is being preferred by some of these big government sites, it is not surprising to see that many other private and media companies are inclining towards Drupal CMS for their own websites.


Drupal's Adaptability Features

A few years back, the energy department's website, energy.gov got into a lot of trouble. The website faced low traffic, high bounce rate, and to make it worse, the entire website was built on the basis of an internal office structure which made it quite impossible to navigate. It needed immediate attention, and that is when the organization decided to migrate their website to Drupal.

One of the greatest strengths of the Drupal CMS is its ability to integrate with any other solutions and services. Even a proprietary CMS such as Sharepoint, is likely to coexist with Drupal and other open source platforms. The modular system that a Drupal CMS works on, allows it to adjust easily based on the type of deployments.

Security

While the typical stereotypes about open-source platforms is that they are quite vulnerable to threats, Drupal has a track-record of being one of the most secure open-source CMS. Well-equipped to handle cyberthreats, the Drupal community does a great job to work together and ensure that they eliminate any threats before they affect the users.

Drupal consists of several security modules, making it one of the most reliable platforms amongst several others. Some of these modules include, Login Security, Password Policy, Captcha, Security Kit etc.

Multisites - An Easy Task

Governments tend to have multiple websites, in multiple languages in order to handle various sections of their administration. Irrespective of whether the government has just a couple of websites or few hundreds, the task of building each one of them individually and maintaining them is going to be a tough job.

Drupal CMS makes it easier with its multisite feature, allowing the developers to copy the site's code base and create as many new websites as required. Thus, by leveraging the features and functionalities of an already existing website, the need to build every single site from scratch, is eliminated.

Additionally, Drupal also offers out of the box Content and Entity Translator modules which help content authors to translate pages, individual fields, elements and more. Thus, multiple sites in multiple languages is an easy feat with Drupal CMS.

Say Hello To DeGov

DeGov is the first of its kind Drupal 8 open source distribution that focuses on the needs of government organizations only! DeGov offers a comprehensive set of customized functionalities which are commonly used only for those applications that are necessary for government websites.

With the ability to release federal and state portals, internet sites for ministries, authorities, municipalities and more, DeGov distribution allows web pages and group-specific portals to be created easily, without any hassle.
Learn more about DeGov here.

Nov 22 2019
Nov 22

Accept it, your inbox is infested with Spam and you cannot do anything about it. They’ll just crawl into your website and send you those annoying emails through your contact forms or comments section or just about anywhere they can sneak in through. Sure, you can "Mark" them as Spam. But is that really going to help in keeping all those creepy crawlies at bay?

There are two types of spam – Spambots, which are basically scripts designed to collect email addresses and then spam them , and Human Spammers, who are actually sitting on computers just to spam you. We can protect ourselves from Spambots to a certain level but getting around Human spammers is extremely tricky.

Thankfully, Drupal 8 provides you with plenty of solutions and Drupal modules to protect your website from Spambots. Let us take a look at some of them and see which Drupal 8 modules suit your needs the best.

Capture them with CAPTCHA

We have all come across a CAPTCHA test at some point or the other and though it may seem annoying as a visitor, this can be a very useful tool to a site administrator. It is that fuzzy image of some text that you have to fill in a web form and if you’re a legitimate user you can go ahead with submitting your details. This challenge-response test is a decent way to keep some Drupal spam away, but it isn’t too difficult for them to find a way out either. Thus, using it as a stand-alone solution is not a very good idea. Installing the Drupal 8 Captcha module is as simple as configuring it. 

CAPTCHA Keypad 

Taking it up a notch in Drupal spam prevention with the use of CAPTCHA  is another Drupal module that  provides an alternative CAPTCHA security. CAPTCHA Keypad increases the complexity of a CAPTCHA , making it really difficult for the spammers. This module allows the users to make use of a keypad (which can be configured to shuffle the keys, as required) to enter the CAPTCHA. 

Complicate it with ReCAPTCHA

Drupal reCAPTCHA module makes it more complex for the spambots by using the reCAPTCHA services offered from Google. Built for the sole purpose of security, Drupal  reCAPTCHA module also aims at improving the user experience by allowing the users to complete the test with a single click or a tick mark. 

The Drupal reCAPTCHA module offers a choice to provide checkbox, asking the users if they are a robot or not. Despite the fact that this module makes it easier for the users, it still is a hard nut to crack when it comes to Drupal spam prevention. 

Lure them spammers with Honeypot

Honeypot, as the name suggests, acts as a trap to deter spam bots from posting harmful data into your website. Drupal 8 Honeypot module basically adds a hidden field to your web form which is seen only by spambots. So if the hidden field in your form is filled, then you know it’s a spambot and discard the form. Drupal Honeypot also allows you to set a timer for filling the form since if it is a spambot, they can fill those forms in no time! Let’s say, if you set a timer of 5 seconds to fill your contact form, you will know when a spambot is doing so as us humans would most definitely take longer.

AntiSpam by CleanTalk

Developed by CleanTalk, Drupal Antispam module is another module that tests the user in such a way that the users see no tasks that are required to be solved from their end. Drupal Antispam module does a great job if you have your own list of spam email addresses and IP-addresses that you have detected. 

Using a series of tests that filter the spambot registration & the spams in the comments section, Drupal Antispam module ensures that the spam checks are not visible to any of the website users. This ensures a better and more comfortable engagement with the site, eliminating the extra time spent on completing additional registration forms. 

Antibot

Another Drupal module that boasts of a "NO end user interaction" is Antibot. This light weight module aims to prevent robotic submissions on a Drupal website, with minimal user interactions and zero involvement of API keys and other third party integrations. 

Implementing two major criteria, the Antibot module includes a Javascript interaction test and an analysis for the usage of keyboard and mouse. Also, it also enables caching of the forms, which makes it a lot quicker than other modules like Honeypot. 

Mollom

Developed by Dries Buytaert, the founder of Drupal, Mollom was an intelligent web service that identified potential spam content and decide if the post is legit or not. Using machine learning techniques to block spammers from posting malicious content, Mallom was one of the most used modules for Drupal spam protection. However, on April 2, 2018, Mallom officially announced its end of life. If you are using the Mollom module, it is advised to disable the same and switch to an alternative.

Aug 13 2019
Aug 13

When the open-source Accelerated Mobile Pages (AMP) project was launched in October 2015, Google AMP was often compared to Facebook's Instant Articles. Nonetheless, both of the tech-giants share a common goal – to make web pages load faster. While AMP can be reached with a web URL, Facebook’s Instant Articles aimed only at easing the pain for their app-users. Teaming up with some powerful launch partners in the publishing and technology sectors, Google AMP aimed to impact the future of content distribution on mobile devices.

Fast forward to today, and Google AMP is the hottest thing on the internet. With over 25 million website domains that have published over 4 Billion AMP pages, it did not take long for the project to be a huge success. Comprising of two main features; Speed and Support to Monetization of Objects, AMPs implications are far reaching for enterprise businesses, marketers, ecommerce and every other big and small organizations. With great features and the fact that its origin as a Google Initiative, it is no surprise that the AMP pages get featured in Google SERP more prominently. 

What is AMP?

With the rapid surge in mobile users, the need to provide a website-like user experience does not just cut it. Today mobile user’s come with a smaller attention-span and varied internet speeds. Businesses can cater to each of these challenge with a fast-loading, light-weight and an app-like website with Google AMP.

AMP is an open-source framework that simplifies the HTML, streamlines CSS rules, restricts use of Javascript (can use AMP’s component library instead) and delivers pages via a Google AMP cache (a proxy-based Content Delivery Network).

Why AMP??

Impacting the technical architecture of digital assets, Google's open source initiative aims to provide streamlined web pages to mobile browsers and other apps.

It is Fast, like Really Fast

Google AMP loads about twice as fast as a normal comparable mobile page and the latency is as less as one-tenth. Intended to provide the fastest experience for mobile users, customers will be able to access content faster, and they are more likely to stay on the page to make a purchase or enquire about your service, because they know it won't take long.

An Organic Boost

Eligibility for the AMP carousal that rests above the other search results on Google SERP, resulting in a substantial increase in organic result and traffic is a major boost for the visibility of an organization. Though not responsible for increasing the page authority and domain authority, Google AMP plays a key role in sending far more traffic your way.

ROI

The fact that AMP leverages and not disrupts the existing web infrastructure of a website, makes the cost of adopting AMP much lesser than the competing technologies. In return, Google AMP enables better user experience which translates to better conversion rates on mobile devices.

Drupal & AMP

With better user engagement, higher dwell time and easy navigation between content benefits, businesses are bound to drive more traffic with AMP-friendly pages and increase their revenue. The AMP module is especially useful for marketers as it is a great addition to optimize their Drupal SEO efforts.

AMP produces HTML that makes the web a faster place. Implementing the AMP module in Drupal is really simple. Just download, enable and configure!
Before you begin with the integration of AMP module with Drupal, you need -
AMP Module : The AMP module mainly handles the conversion of regular Drupal HTML pages to AMP-complaint pages.

Two main components of AMP module:

AMP Module : The AMP module mainly handles the conversion of regular Drupal HTML pages to AMP-complaint pages.
Two main components of AMP module:

AMP Theme: I'm sure you have come across AMP HTML and its standards. The one that are responsible for your content to look effective and perform well on mobile. The Drupal AMP theme produces the mark up required by these standards for websites looking to perform well in the mobile world. Also, AMP theme allows creation of custom-made AMP pages.

AMP PHP Library: Consisting of the AMP base theme and the ExAMPle sub-theme, the Drupal AMP PHP Library handles the final corrections. Users can also create their own AMP sub-theme from scratch, or modify the default ExAMPle sub-theme for their specific requirements.

How to setup AMP with Drupal?

Before you integrate AMP with Drupal, you need to understand that AMP does not replace your entire website. Instead, at its essence, the AMP module provides a view mode for content types, which is displayed when the browser asks for an AMP version.

Download the AMP Module

With your local prepped up, type the following terminal command:

drush dl amp, amptheme, composer_manager

This command will download the AMP module, the AMP theme and the Composer Manager module (suppose if you do not have the Composer Manager already).

If you have been a user of Drupal 8,  you are probably familiar with Composer and its function as a packaging tool for PHP that installs dependencies for a project. The composer is used to install a PHP library that converts raw HTML into AMP HTML. Also, the composer will help to get that library working with Drupal.

However, as the AMP module does not explicitly require Composer Manager for a dependency, alternate workflows can make use of module Composer files without using Composer Manager.

Next, enable the items that are required to get started:

drush en composer_manager, amptheme, ampsubtheme_example

Before enabling the AMP module itself, an AMP sub-theme needs to be enabled. The default configuration for the AMP module sets the AMP Theme to ‘ExAMPle subtheme.’

How to Enable AMP Module?

The AMP module for Drupal can be enabled using Drush. Once the module is enabled, the Composer Manager will take care of the downloading of the other AMP libraries and its dependencies.

drush en amp

Configuration

Once everything is installed and enabled, AMP needs to be configured using a web interface before the Drupal AMP pages can be displayed. First up, you need to decide which content types should have an AMP version. You might not need it for all of them. Enable particular content type by clicking on the “Enable AMP in Custom Display Settings” link. On the next page, open the “Custom Display Settings” fieldset. Check the AMP box, then click Save.

image

Setting an AMP Theme

Once the AMP module and content type is configured, it is time to select a theme for AMP pages and configure it. The view modules and the field formatters of the Drupal AMP module take care of the main content of the page. The Drupal AMP theme, on the other hand, changes the mark-up outside the main content area of the page.

Also, the Drupal AMP themes enables you to create custom styles for your AMP pages. On the main AMP config page, make sure that the setting for the AMP theme is set to the ExAMPle Subtheme or the custom AMP subtheme that you created.

Drupal-theme

Jul 23 2019
Jul 23

Yes, you read that right. Having to take your application offline for updates or while launching a newer version is a daunting task and a real pain. True that you can mitigate this with scheduled downtimes, but that is not something that will bring make the customers happy. Some sites actually lose thousands of dollars every minute they are down!  Should deployment or upgrading your application be the real reason behind your loss? 

Blue Green Deployment is one of the mainstays of deployment strategies that conquers the limitations of traditional approach to application deployment. How much do you know about Blue Green Deployment? How is Blue Green Deployment in Drupal implemented?

What is Blue Green Deployment?

Blue-Green Deployment is a technique for releasing applications by shifting or moving the traffic between two identical environments running two different versions of an application. 

In a brief, there is a version of an application, lets call it "blue version" in production. And then, there is a router that is used to route the traffic to the app. Now you need another version. the "green version" with some more goodies added, to be deployed. However, you also want to ensure that while this deployment is happening, a user can still look at your application, press a button or do whatever he wants, without your application going down! More like secretly deploying the "green version" while the "blue version" handles all the traffic in the meantime, before eventually swapping out the connections. 

blue_green_deployment

 

With near zero downtime release and rollback capabilities, the fundamental idea of the Blue-Green Deployment is to shift the traffic between two identical environments that are running two different versions of the application. While the current version of the application is represented by the Blue environment, the green one is staged running a different version. 
 

Why Blue-Green Deployment? 

One of the major challenges with automating the deployment process is the cut-over itself, i.e moving the application from the final stage of testing to the live stage. And this has to be taken care of quickly in order to minimize any sort of downtime. This is exactly what blue-green deployment does. With two production environments (as identical as possible in nature), at any given point of time, one of them is live. And as you prepare for a new release, you do all your testing on the other environment which is not live. Once you are ready to roll, all you have to do is switch the router so that all your traffic is directed towards your latest release & the other environment just goes idle. 

Also, Blue-Green deployment provides one of the most important features, a rapid rollback. Suppose if anything goes wrong with your latest release, you just have to switch back the router. While there might still be an issue with the lost transactions when the faulty environment was live, you could also design it in a way that both of your environments are fed with the transactions and one acts as a backup for the other one. 

How Blue-Green Deployment? 

Now that we know about the two environments of Blue-Green Deployment, let us look at some of the best practices to implement the same. 

  • Load Balancing over DNS Switching

Keep in mind that while switching environments, make your domain to eventually point to different servers. Instead of going to the DNS records & making changes in DNS management interface, use load balancing. 

The problem with making changes in the DNS records will just result in a long traffic trail. This means that while some of your users will still be served by the old environment, you won't even have full control on where your traffic is routed to. 

However, load balancers will allow you to set your new servers up immediately and you wouldn't have to depend on the DNS mechanism. This way, you will have full control on the traffic and you can be absolutely sure that all the traffic is routed to the new environment. 

  • Rolling Update

DO NOT switch all your servers at once. Execute a rolling update instead. That is, instead of switching over to the Green servers from the Blue ones all at once, work with an integrated environment. Add one new server, retire an old one. Repeat until every new server is in place. This will reduce your downtime by a huge margin! 

  • Environment Monitoring

While monitoring the live environment is obvious, you do not want to end up being caught off guard by not monitoring the other environment. Yes, the monitoring of the other environment is less critical. However, since the same environment can act as both states, you will need an easier way to switch the alerting between the two. Set up different API tokens for the two environments reporting back, or programatically change the alert policy on the environment when its role is changed/switched. 

  • Automation

Manual set of actions will just increase your work. Instead, script every action in the switch process. Automating the switch process will result in a quicker, easier and safer implementation of Blue-Green Deployment. 

Blue Green Deployment for Drupal Websites

Problems

  • During code deployments, Drupal needs to run database updates to operate and this is a major problem since the Drupal updates sets the website in maintenance mode and your users are greeted with this beautiful white screen. 
Drupal MaintenanceSource : drupal.org

If the deployment fails, then a rollback is only possible by restoring the database from dump, considering the database schema may have been modified. This means downtime! 

Solution: Blue Green Deployment! 

Let us look at some of the infrastructure overview to implement Blue Green Deployment with Drupal. Any kind of ops in Drupal requires Nginx and a php server (to mainly run Drupal), we need a database, a file storage, some cache, and the stack is designed in a way that it is highly available. 

With Blue Green Deployment, you need to deploy a new stack with a new codebase and copy all of your database and the different states from the previous codebase, preferably using Drush. 

infrastructre overviewSource: Drupal Con Seattle 2019

Once the two different stacks are set up, the staging stack has to be tested independently from the production stack. Basically, you need your users to go to the stack (production stack) and test out the version of the website that is deployed. And when the other version (the staging stack) is ready, you just need to flip the versions. Now the users are being directed to the new stack and the older version is available for testing. 

Blue Green Deployment with Docker

Deployments in Drupal is not easy. While you have to make sure that the code is deployed, composer dependencies are handled, schema updates are up-to-date and all the caches are cleared, you also need to ensure that the "responsive website" is up and running. And what happens if there is a problem and the deployment fails? Do you rollback? Or stop the deployment? 

The phrase you are looking for, is Blue Green Deployment

During Drupal deployment, Docker ensures an easy shift between applications, and makes it easy to build and run different versions of the same. On the EC2 instance, there is always a set of raised docker containers of blue and green, and nginx works as a reverse proxy server. Blue green deployment with Docker allows a user to build a Drupal website which runs parallel in the two different environments.


Blue Green Deployment with AWS 

While historically, blue green deployment was not the first choice to deploy software on-premises because of its high cost and complexity involved, containers have changed this perception for good. 

Containers ease the adoption of blue green deployment because of their easy package and consistent behaviour as they switch between environments. And to change the configuration of a container, you just have to update its dockerfile and rebuild and redeploy the container in place rather than updating the software. 

Amazon ECS performs these rolling updates when you update an existing Amazon ECS service. The rolling update for ecs blue green deployment  involves replacing the existing version of the container with the latest one. This number of containers that the Amazon ECS adds or removes during the update is controlled by adjusting the maximum and minimum number of healthy tasks allowed during the service deployments.Once the update the service's task definition is updated with the latest version of the container image,  Amazon ECS automatically starts replacing the old version of the container with the latest one. 

AWS blue green deployment

 

Blue green deployment with AWS ECS will also provide optimization benefits since you are not tied to the same set of resources. That is, when the performance envelope of the application changes from one version to the other, you simply launch the new environment with the optimized resources (can be fewer in number or a completely different set of resources). 

Blue green deployment in AWS also fits well with the continuous integration and deployment workflows, keeping a check on their complexities by allowing deployment automation to consider fewer dependencies on an existing environment. 

This solution allows the users to easily manage the deployment and scalability of web platforms without wasting any time. This deployment helps in configuring a high-availability environment that will run a Drupal website without any problems.
 

Jul 16 2019
Jul 16

Great vision without great people is irrelevant - James Collins 

As Collins describes in his book - "Good to Great,” we often expect the good-to-great leaders to begin their quest for greatness by setting a new vision and strategy. Instead, they first get the right people on the bus, the wrong people off the bus, and the right people in the right seats. Then, they figure out where to drive it! 

Hiring a professional team of experts is a common challenge faced by most companies in today's world. And the process of hiring gets tougher when you want to hire a team of talented individuals in the open-source industry, particularly in the Drupal community.  

While there are a plethora of Drupal agencies with developers - all working with, in, for Drupal, the real challenge is narrowing down to find the right partner to suit the needs of your organization, long or short term.

With fierce competition and the never-ending challenges, how do you hire a Drupal developer or a team of experts who is the right fit for the project?

Be sure of what you need

Need someone with expertise in building multisite websites with multiple Drupal codebase & custom theming? Say it! Or, if you need someone with experience in creating custom modules and specializes in building Enterprise websites? Say So! 

Since different drupal project types demand different talents, it is very important that you understand the key process involved in the project development when you hire a drupal developer

Before you reach out to a Drupal agency, it is essential that you know the scope of the project for which you need the Drupal developers for. This will lead you to the most important elements to be considered before the start of the project. The limitations of the budget and the timeline. 

The nearly impossible task of getting quality work done by meticulously following the timeline set before the start of the project is something that should always be in the back of your mind. Add to it the budget constraints, and the bracket narrows further down. 

However, most Drupal companies offer a productive staff augmentation services that will allow them to scale in tandem with your business needs and these constraints can be handled by the right Drupal partner. 

Know Your Drupal Partner

From the front-end & back-end Drupal developers to the DevOps personnel and the QA testers, it is very important that the Drupal agency has the right team. 

Your project will have various tasks that will require more than one skill set, and if your Drupal partner and its team of experts can't handle the requirements, it will pose a serious threat to the development efforts. 

Thus, it is better to consider the experience levels of the team you want to hire, how long have they worked on Drupal and how familiar are they with the previous versions of the CMS. An experienced team of Drupal experts will know what goes where and their skill set will always play a vital role in crunch situations.   
 

A part of the Drupal Community?

As an open source platform, Drupal does a phenomenal job in encouraging its individual members and teams to actively contribute to the betterment of the platform. Thousands of developers strive to improve Drupal and it is important to see how big of a role is the Drupal agency you pick, is playing an active role in encouraging its developers to be a part of the community. 

Acquia Certified - An added advantage
 

Started in early 2014, Acquia has a certification program for Drupal developers looking to improve their proficiency in the particular field. An Acquia Certified resource stands apart from the plethora of drupal professionals out there. Having a certified member in the team will act as an added advantage as his proficiency and expertise will play an essential role in the  amelioration of the project development workflow. 

Support & Maintenance? 

While Drupal offers constant updates for security & other vulnerabilities, it is important that your Drupal partner is accessible when you need these upgrades the most. You do not want to end up being stranded when you face glitches in an already deployed project. Most agencies offer Drupal support & maintenance services to ensure a smooth, secure and a seamless performance of your website. 

Not Just Drupal

Web application development with Drupal may also require your Drupal expert to be proficient in third party application integration to meet some of your end requirements. Hire a Drupal developer with expertise in,

  • Integrating with other third party applications, such as  CRM, ERP, marketing automation, logistics applications etc. which you may need to meet your business requirement. 
  • Data visualization and analytics tool that can be used along with Drupal in order to measure application/website efficiency.
  • Javascript frameworks to handle decoupled Drupal in case you choose that route.
     
Jun 17 2019
Jun 17

If you look around on the Internet, you can see that a very large number of services use APIs.  A mobile application of an ecommerce website uses an API; Anything with a social login uses an API;  even the ads that you see on the Internet use APIs!

By creating an API for your service, you enable third-party developers to create applications based on your service. For example, the social newspaper Frrole uses the Twitter API to generate contextual insights by analyzing a large volume of tweets.
 

API_description

Creating & Testing APIs

Although there are a number of ways in which an API can be created, a Web API is usually created by using the REST (Representational State Transfer) framework. The REST framework sets a set of guidelines that should be followed while creating an API. As the prime motive of creating an API is to enable other applications to use the services, every stage of the API development process requires testing for functionality, exception handling and security.

Make Testing Easier With Postman Tool

What is Postman Tool? How does it work? 

At the first glance, Postman testing tool is a simple GUI for sending HTTP requests and viewing responses. But deep down, Postman is built on an extensive set of powerful tools that are very easy to use. Postman allows you to organize your API requests into collections and folders share common values across requests with environment variables, script tests with the built-in node.js based runtime, and automate it all with its very own CLI – Newman.


The Postman testing tool is a complete API development platform with various built-in tools that support every stage of the API lifecycle. Postman allows you to design, mock, debug, automatically test, document, monitor and publish the APIs - everything from one place. Postman can be accessed through native apps for MacOS, Linux and Windows.

postman_description

Postman’s complete API development platform will allow you to create requests, build and manage collections, and govern the complete life cycle of your APIs.

Evolution of Postman Testing Tool

The postman started out as a Postman Chrome App when it first came out, used along with the Postman Interceptor Chrome extension. The Google Postman extension was widely accepted and was one of the most sought after tool for testing. Over the years, the API ecosystem evolved, and with this the Postman native apps' capabilities were also improved to surpass the performance of the postman chrome extension. 

However, if you are still using the Postman Google Chrome app, you may notice a banner on top which says  "Chrome apps are being deprecated. Download our free native apps for continued support & better performance." 

This is something that happened when Google announced their not-so-great plans to end support for Chrome apps for Windows, Mac & Linux users. In response to the deprecation of Postman Google Chrome extension, they introduced native apps for Windows, Mac and Linux users and encouraged their users to begin the migration. The new Postman native apps covered all the features & functionalities of the postman chrome extension, and in many cases, the native app was even better than the original Chrome app.

native apps

With the native Postman application performing better than the Postman Chrome app, and the process of migrating being easy (takes less than minute!), it is time to say Goodbye to Postman extension and switch to their native apps.

Why Postman?

Test Suites - Create them with ease

In order to ensure that your API is working as expected, Postman tool allows you to create collections of integration tests. For each of these tests, that are run in a specific order, an HTTP request is made and the assertions written in JavaScript are used to verify the integrity of the code. You also have the freedom to manipulate the data that you receive, courtesy of the assertions written in JavaScript.

postman_screenshot

Testing on different environments? No Problem!

How often do you find that since your local environment is configured a little differently than the test server, your test collection that runs perfectly against your local environment  faces problem when your run it against a different one. Postman testing tool allows you to store certain information about the different environments that you use and automatically insert the correct environment configuration for the test collection that you are running. 

postman_screenshot

Data Storage 

You may have an API which requires some specific data received from another API. Postman tool allows you to store such data from previous tests into global variables, and these can be used in a similar way as environment variables. You can either store the response or a part of the response and use it for the subsequent  API calls. 

Better Integration

The Postman testing tool has a unique interface that allows you to easily run a collection of tests right from the command line. Newman, which is Postman's very own Command Line Interface (CLI) enables running these tests on systems that do not have a GUI. Also, Newman gives you the ability to run a collection of these tests right from within most build tools. 

Newman - Continuous Integration in Postman

Newman is basically a Command Line Interface tool which will allow you to run Postman collections directly from the command line.  Their official website describes Newman as - "Newman is a command line Collection Runner for Postman. Newman allows you to run collections in the same way they are executed inside a Postman collection runner. Since we all know that a Continuous Integration helps us to combine different codes and execute different tests continuously. This combination of tests and code is usually a success due to continuous integration, which in Postman is done by Newman.

Newman is built to integrate easily with your build systems and continuous integration server. It allows developers to get a quick feedback about the performance of the APIs after changes in their code. With the help of Newman, it gets integrated with the CI and after that if any changes are pushed, CI will run the postman collections with Newman. 
 

Jun 07 2019
Jun 07

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" (apparently he never loved "for the enterprise" categorization of Drupal), it is commonly referred to as a content management framework which allows for extensibility & scalability through the addition of various user-created modules that build upon its core framework.

Drupal is one of the most popular CMS' currently available & is the preferred choice for government agencies, large associations, non-profits & numerous Fortune 500 companies. 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 removed.

But why do large enterprises prefer Drupal? Is it as "easy to use " as they say? Or does the picture below depicts the true story of Drupal? Let us find out.

Drupal - A CMS for Everyone

One of the toughest challenges that Drupal adopters face, whether they are new site owners or beginning developers, is trying to figure out what is hard & 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. 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 removed.

Maintenance and Upgrades

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 notices 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.

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 WebPages 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.

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 removed.

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 removed.

Image removed.

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