Feeds

Author

Upgrade Your Drupal Skills

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

See Advanced Courses NAH, I know Enough
Nov 25 2021
Nov 25

With improved performance, a cleaner code, and security improvements, there is a lot to love about Drupal 9. Here are a few benefits you will get from Drupal 9 migration services:

drupal 9 benefits

Empowers us to use intuitive tools. One of the major improvements considered in Drupal 9 is the ease of use. Drupal 9 comes up with various tools to ease the use of Drupal 9. Starting from automatic updates and decoupled menus to Drupal 10 readiness, there are a lot of tools available to use to simplify your work.

Smoother upgrades. Drupal 9 focuses more on smoother upgrades as you don’t have to reinvent the wheel all over again, and any need to re-platform new versions gets released.

Helps you innovate more often. You never get restricted when it comes to using advanced features. You can easily access the latest features to innovate in your business site.

Brings flexibility when it comes to front-end facilities. Drupal 9 has adopted an API-first approach, which helps you make your site more versatile. This allows better integrations, which aids flexibility in the front-end.

Ease of managing richer media. You can easily embed remote content like YouTube and Vimeo on your website. Moreover, with a richer media library module, Drupal development agencies can easily add existing media assets.

Enhanced layout builder. It is possible to use visual design tools to design layouts for template content, customize layout templates, or even add custom pages to the website.

Nov 12 2021
Nov 12

The Drupal 10 Readiness Initiative – What Every Site Owner Should Know to Prepare for?

Drupal release cycles are speeding up! Drupal 9 was launched a year ago, and an upgrade from Drupal 8 to Drupal 9 is still on the to-do list of many businesses. While you are busy evaluating how to migrate to Drupal 9, the Drupal development team is coming up with the next version very soon.

Yes, you guessed it right. Drupal 10 release is planned for 2022. And businesses across the world are talking about Drupal 10 release and readiness. Of course, this will be a big change from the five-year gap between Drupal 8 and Drupal 9. It has taught many things to Drupal developers, and now they’re pretty confident to face the next big thing from Drupal.

So, are you ready to update to Drupal 10? Well, you may find it a little early or strange to discuss, but the movement has already begun, and it is important that you put the plans into action to avoid any last-minute blunders. Let’s take a look at the upcoming Drupal 10 release, what it will bring for you, and what it takes to get ready for it.

Nov 01 2021
Nov 01

The beauty of Drupal lies in being an open-source platform where a community of developers can contribute now and then. With each new version of Drupal, many new modules are introduced for the developers that can help them improve their Drupal development ventures.

Drupal boasts more than 42,650 modules. This is the place where Drupal clearly distinguished itself from other content management systems. Drupal modules are a big reason for the community’s popularity. So, practically, you cannot master Drupal development without modules! And that is the reason why some modules like Chaos installed downloaded more than 11 million times.

In this blog post, we’ll cover a few of the most popular Drupal modules every developer should be aware of. But before we get our hands dirty, let’s discuss the basics of Drupal modules.

May 13 2021
May 13

Reason #1: You Get Two Robust Systems In One.

Most e-commerce sites include integration with third-party content management systems. These may have many inconsistencies and quirks, requiring site owners to spend precious time integrating two systems. And if they achieve a satisfactory result, they would have to maintain the two systems separately: upgrade them, back them up, and correct security problems, and so on. It doubles the amount of time and effort required.

Drupal 8/9 helps you manage content by changing product descriptions, writing blog posts, creating landing pages, and doing other content marketing tasks. On the other hand, Drupal Commerce handles all e-commerce, including book and order management, payment processing, tax estimates, and so on.

You can also easily link your product descriptions from other parts of your website, such as a landing page or blog. The better your search engine visibility, the higher your website will rank and thus attract more traffic.

Reason #2: You Get An Accessible Website.

Accessibility is critical for all websites, but it is especially essential for e-commerce sites. An online store that fails to consider the needs of people with disabilities gets doomed from the start. Legal issues, sales loss, and being penalized by search engines are just a couple of the reasons to take accessibility seriously.

When you develop an e-commerce website in Drupal 8 and Drupal 9, you get accessibility to many Drupal 8 features out of the box. Some of these features are all image alt tags must-have details, and all Drupal 8/9 themes have a contrast ratio appropriate for visitors with low vision.

Reason #3: You Can Create An E-commerce Website In Multiple Languages With Drupal 8/9.

As previously said, one of the most significant benefits of e-commerce is the ability to conduct business across borders. Host your online store on a server and make it accessible to people all over the world, regardless of distance or time. You can also make your content accessible to customers in different countries in appropriate regional languages. It will increase confidence and traffic to your store.

Also Read: Drupal 8 Module Development: A Compressive Step-By-Step Guide

When you build an e-commerce website in Drupal 8/9 or Drupal Commerce, you save a lot of time and effort in localization. If you want to create multilingual ecommerce websites, Drupal is most likely the best tool. It provides you with access to several language-related core modules without much effort.

The Interface Translation module, for example, allows you to easily translate your store's UI, while the Content Translation module does the same for your content. All you have to do is properly configure them.

drupal for website development

Reason #4: Mobile Ready.

If your e-commerce site performs well on mobile devices, it will perform well on other devices as well! Creating user scenarios will assist you in determining what type of content the user will enjoy on their mobile device. This method will assist you in designing the essential elements for your website.

Mobile compatibility has evolved into an essential function for every eCommerce platform. All in today's world must be mobile-ready. Drupal websites not only impress clients with their appearance but also with their mobile responsive design. Drupal websites are simple to use on mobile devices and tablets.

Reason #5: Multilingual.

The internet has taken over the world, and with so many people using similar channels and so many brands spreading internationally, multilingual websites are a must! Even though most internet users choose English as their primary language, ten other languages account for 90 percent of the top ten million websites. Meaning, you need a website in multiple languages to thrive and grow in this highly competitive world.

Drupal is the best platform for a multilingual website. It offers many languages to choose from and four main modules explicitly designed for language and translation support. This Drupal function has yielded excellent results, including increased conversions, improved SEO, unrivalled translation workflows, and a significant contribution to audience expansion. It can also detect the user's favourite language by defining the user's IP address, sessions, browser settings, and so on.

Reason #6: A Quick Website That Is Simple To Extend And Scale.

An excellent online store eventually "grows out of its clothing" and must scale to meet increased traffic. It is essential to add new features. Scalability is not an issue when building an e-commerce website with Drupal 8/9.

First, both the CMS and Drupal Commerce have an extensive range of core and contributed modules that can handle nearly any task imaginable, from creating custom forms to dealing with currencies and calculating discounts.

If this isn't enough, we can further expand the systems by using different application programming interfaces or APIs for short. Drupal websites may use this to access a wide range of external resources, from social media to shipment monitoring.

Drupal REST API has also separated the backend and frontend, and developers can now use any technology to create UIs for Drupal-based websites, including the common JavaScript frameworks Vue.js, React.js, and Angular.js. As a result, websites are much quicker than they used to be. Speed is a decisive conversion-increasing factor. Nobody wants to stay on a page more than a few seconds for a website to load.

Furthermore, the REST API has broadened the channels by which consumers can access an online store. Visitors use the same database when using a smartphone, tablet, desktop, Mac, or PC. It allows you to reach a much larger audience and therefore generate even more sales.

Drupal Website

Reason #7: You Get A Website That No Hacker Can Exploit.

Due to the rise of ecommerce stores, hackers are also using advanced technology to hack ecommerce websites. Cybersecurity is especially important for e-commerce stores as it holds a large amount of customer data, payment details and more. A data breach can result in various issues, including consumer financial information falling into the wrong hands.

Also Read: Web Development Strategy You Must Follow for a Successful Drupal 9 Upgrade

If you are using Drupal 8/9 and Drupal Commerce to create an e-commerce website, you are well-protected against any security threats. The Drupal 8/9 software package is a model of protection in and of itself. There is also a dedicated community of Drupal experts devoted to ensuring the system's and modules' absolute security.

When a new security patch is released, site owners may immediately begin using it. Scammers do not have the reason to create havoc.

Apr 28 2021
Apr 28

Compatibility

Before you download a module in Drupal 8, make sure it will be compatible with your Drupal 8 version. You cannot install a Drupal 7 module into Drupal 8 installation if it is not supported. In Drupal.org, to know the module version released by Drupal.org, navigate to the module's page and scroll right to the end.

Actively Maintained Modules

You need to check and verify that the modules you have chosen are actively maintained, updated, and published by the developers. Suppose you encounter any security vulnerabilities or any other issues while developing.

You will get an instant response from the developer/contributor. In Drupal.org, to know the module version released by Drupal.org, navigate to the module's project page and scroll right to the end.

Popularity

Make sure to choose popular modules to do the job, as you will get more minor issues while developing. To check this, go to the module's project page on drupal.org. Here, you will see the number of downloads and the number of websites currently using that particular module.

Now that you have chosen the module for development let's get started. In Drupal 8, the modules folder hosted in the root directory of Drupal 8 is where you will find the contributed or custom modules.

Things You Should Know Before Beginning Drupal 8 Module Development

Apr 27 2021
Apr 27

Now that you have enough reasons to migrate to Drupal 8 or 9 from Drupal 7. We have listed out ten essential things that you should remember before you begin the Drupal 7 to 8 migration:

Migrate from drupal 7 to drupal 9

1. Observe and Plan

For a smooth Drupal content migration, first Identify the content types and structure of the existing site and note down the observations. Note down the field types, blocks, content types, taxonomies, etc.

Note down what you need to migrate and what you need to merge based on these observations. Check the Views and other site configurations and note them to replicate them in Drupal 8.

2. Create a checklist of Drupal 7 website modules

First, identify modules that you still need, or if the Drupal 7 module has moved to Drupal 8 Core. keep in mind that not every Drupal 7 module is automatically migrated to Drupal 8. Some of the Drupal 7 modules may have put their functionality into a single Drupal 8 module, and some may have separated their features into two or more Drupal 8 modules.

3. Update to the latest available version

Update your Drupal 7 to the latest available version of Drupal 8 or 9. It will ensure cleaner automatic upgrades of Drupal 7 modules with direct Drupal 8 or 9 upgrade paths.

4. Access.

Before migration, make sure you can access the Drupal 7 website's database and files - both public and private.

5. Backup your website

Before you start the Drupal 7 migration process, make sure to create a backup of the Drupal 7 website and use it for the Drupal 8 migration. Although the Drupal migration does not modify the source, It is still not good to migrate a live functional website.

6. Download a fresh installation

Download a fresh installation of Drupal 8 and again, remember, it MUST be FRESH! If you have done configurations or created content, it will be overwritten automatically when a Drupal 8 upgrade is performed.

7. Familiarize yourself

Unlike in previous version upgrades, you cannot perform a direct upgrade from Drupal 7 to Drupal 8. Drupal 8 Migrate module, Drupal 8 Migrate Drupal module and Drupal 8 Migrate Drupal UI module are three modules in Drupal core. You need to familiarize yourself with Drupal 8's migration system and configuration.

8. Decide the choice of migration

Drush (which gives you granular control) browser user interface (more accessible but less control) are two of the choices you have. You can opt for the method that suits your familiarity level and experience.

9. Know your source

The flexibility of the Drupal content migration system allows you to extract content and load from older versions of Drupal and other sources like CSV, XML, JSON, MYSQL, etc.

10. Perform a content audit

Perform a thorough content audit on the Drupal 7 version to identify content you need to migrate to Drupal 8 or 9. For a smooth Drupal content migration, remove the unused and irrelevant content to avoid spending time and effort migrating them.

Also Read: Custom Drupal Development: 10 Things You 'Must' Know For Best Output

Apr 26 2021
Apr 26

Drupal 7 is generally not quite the same as Drupal 8 and Drupal 9. Many structural changes that progress from a Drupal 7 website to a Drupal 8 are more like a relocation project from an unexpected CMS than a product redesign. For instance, the brand new theme and PHP library in Drupal 9 are features that attract most of the Drupal CMS owners.

Drupal Website Development

Fortunately, there is no large building hole between both Drupal 8 and Drupal 9.

Drupal 9 in reality, more like a next minor center overhaul like 8.8 to 8.9 with some newly added features. Remember when you upgraded Drupal 7 to Drupal 8 that led you to rewrite the Drupal from scratch? Don't be scared; Drupal 9 offers the easiest upgrade from Drupal 8. Since Drupal 8 is backward compatible, you will not have to write custom codes after upgrading. If you practice removing the old and deprecated code base, upgrading from Drupal 8 to Drupal 9 will be smooth as butter.

If you are still using Drupal 7, it will reach the end of life by November 2021. To avoid it, you can upgrade your Drupal website to Drupal 8 or Drupal 9. To help you do a smooth upgrade, here is a comparison guide for Drupal 7 Vs. Drupal 8 Vs. Drupal 9.

Drupal Features

Apr 23 2021
Apr 23

Drupal 8 is loaded with several built-in languages ​​to save time and effort for users using Symphony, which has an underlying element called translation, which can create multilingual sites and help you show the site content in multiple languages. Using Symphony, you can translate everything from content to blocks to menus to taxonomy. You can even translate user profiles, image styles, views, text formats, comments, and feeds on your website. In short, Drupal 8 provides the entire site translation.

Apr 22 2021
Apr 22

Custom drupal development methods vary from version to version in Drupal. The one method used in Drupal 7 might not work for Drupal 8. Here are some of the crucial things to keep in mind for the best output of custom Drupal development:

1. Use Configuration Before Code

To avoid hard-coding a class into a theme, make sure to set the values in the configuration and use it with the code to avoid rewriting the code every time you have to make changes. Once you set the value in the configuration, it gives you advanced functionality and "easy to modify" features. It also enhances coding speed and results in high-quality modules.

2. Limit The Usage Of Modules

While working on enterprise-level Drupal websites, it is essential to use fewer modules. Avoid using every single module which is lacking. Experienced developers are in favor of programming their modules rather than reusing the existing ones. A higher number of custom modules will demand more work in the future to maintain and modify your Drupal site. Publish your modules on Github, which helps you avoid using a larger number of custom modules and encourages you to create reusable code with the required configuration.

3. Environment & Coding Standards

Most of the Drupal development companies work in the same development environment to ensure efficient workflow. In such scenarios, the biggest issue is to make sure that the produced code is clean and reliable; the code should make sense to their team members and the larger Drupal community itself. With the Drupal community and distributed teams working together efficiently, you need to follow coding standards to make sure you achieve the project's goals and objectives.

4. Use hook_schema and hook_update_N

Your module will need its database tables if it stores data in the database which is not Drupal entities or nodes, and you are going to use it as content. Make sure to declare the table schema you will need. You can use "hook_schema" in the module. install file. It will be created and removed on its own whenever you install or uninstall a module.

If you want to remove, add or modify columns or modify the schema, you can easily do these changes in an update hook. Use hook_update_N and bump the version number. Other developers or development teams can implement these changes by pulling your code by running "drush updb."

5.Use what Drupal offers

Drupal has several built-in and admin functionality to help you store and display your module's data. You can define the module settings pages using hook_menu; it will enable modules to register paths to help determine how URL requests are handled. You can use the drupal_get_form page callback to define and return the settings that are needed to be stored. One of the key benefits of doing this- you can restrict, submit and validate handlers to the form if the value has to be integers or existing data fetched from an API, etc.

6. Working With Cron

Cron is a time-based task scheduler that you can configure to execute tasks automatically without any manual involvement once the initial configuration is done. Drupal offers several built-in cron functionalities and a task queue for almost every module development. However, in some cases, like your hosting provider doesn't support cron tasks configuration or maybe you are facing issues in configuring it to run correctly, it is essential to check your site's status report to figure out if you can use Cron configuration.

7. Have A Dedicated Place For Your Custom Modules

Suppose you have named your Drupal custom module as "My_shop." In this case, call the new dedicated folder as "/module/custom/My_shop." It's always advised to create a proper place for this type of module so you don't have to struggle a lot when you want to use the new custom module. It also helps you keep the in-built Drupal module downloaded by Drpal.org and custom modules separated from each other.

8. Create A New Module If Necessary

Reuse the existing Drupal modules as much as possible instead of jumping to write one from scratch because the heavy "load" of custom modules can become challenging to maintain and update your Drupal website in the future.

9. Debug Your Module With Xdebug

It is also known as the golden rule to follow when developing custom modules in Drupal. Debugging your custom module code ensures that there are no PHP code bottlenecks, and you're using only the latest code.

10. Use Automated Code Checking Tool

Make sure to use automated code checking tools like Coder to ensure that your code is reliable, clean, readable, and adheres to Drupal’s coding standards. It also helps you ensure that you are following the best practices of your PHP version.

Apr 21 2021
Apr 21

Pros of Choosing WordPress Over Drupal For Website Development:

Ease Of Use – WordPress is a free and open-source CMS in which anyone can change and redistribute its source code. WordPress even offers mobile apps that make content editing, site administration easy on any device.

SEO-Friendly – Sites built using WordPress are SEO-friendly as there are several SEO plugins (such as Yoast SEO) inbuilt to help optimize content, meta tags, keywords, etc.

Responsive – You can use thousands of WordPress themes to make your site responsive and mobile-friendly. Using this market-leading CMS keeps you ready for the emergent responsive web technology.

Cost-Effective – WordPress is free, and even its paid features are less expensive than Drupal. The development, maintenance, and hosting cost of WordPress is lower than Drupal.

E-Commerce – WordPress provides plugins like WooCommerce to help you run your e-commerce site efficiently. Also, it has the features to help you handle the growing demand for your products and services.

Cons of Choosing WordPress Over Drupal For Website Development:

Frequent Updates – WordPress releases regular updates, and if you fail to keep up with these updates, it can bring your site to a screeching halt.

Customization Sophistication – You need to know PHP, CSS, and HTML to write complicated code if you want to add any enhanced feature to your site and

Pros of Choosing Drupal Over WordPress For Website Development:

Rapid Development – Drupal is agile and rapid, which helps developers create and deploy a website's core features and functionality. You can use the modules to cut down development times from weeks to days.

Extensive API Support – Drupal offers a range of API support, including Google Analytics, Facebook, Twitter, Google Apps, YouTube, that help developers create custom modules effortlessly.

Security – Unlike WordPress, themes, and modules are covered by an internal security program in Drupal. Therefore, it is not vulnerable when third-party plugins are uploaded as it is challenging to smuggle malicious content in Drupal.

Cross-Browser Usability and Support – Drupal is easy and suitable to use with almost all major browsers. The website's functionality and design translate as per the browsers.

Access Controls / User Permissions - Drupal has a built-in access control system using which you can easily create new roles with individual permissions in no time.

Cons Of Choosing Drupal Over WordPress For Website Development:

Installation and Modification – Drupal does not offer ease of use as WordPress because of its script, which is not user-friendly and needs advanced technical knowledge to install and modify.

Compatibility – Drupal is not backward compatible; if you have extra content and programs in place that you are customary to, Drupal might not be the right CMS platform for you.

We hope you have sound learning of both, WordPress and Drupal CMS platform’s pros and cons now. Again the choice of the right CMS platform for your business boils down to the question; what is your business requirement?

Feb 28 2020
Feb 28
  • Core Modules: These modules are installed in all the Drupal installation packages; you can say that they are the basic (core) modules necessary for the site designing task, like handling the accounts of the users, providing menus for navigation.
  • Contributed Modules: This module can be downloaded from the official Drupal.org site.
  • Custom Modules: Custom modules are pretty self-explanatory – they’re explicitly coded for individual projects.

So here, we try to list out some of the modules from a Pandora of modules that can be used on the go for your web development, in a hassle-free way.

Read More - Move on to Drupal 8, Be Ready for Drupal 9!

Dec 07 2019
Dec 07
 'custom_drush_create_node',
    'description' => dt('Triggers a node-save'),
    'aliases' => array('nc'),
    'arguments'   => array(
      'title'     => "Title of node",
    ),
    'options' => array(
      'repeat' => 'Number nodes to create.',
    ),
    'examples' => array(
      'drush nc error' => 'Prints error as node title is blank.',
      'drush nc Test --repeat=5' => 'Creates 5 nodes with title Test.',
    ),
  );
  return $items;
}

Running the Drush help command for our own command drush help nc will list some useful information about this command (arguments, options, description, aliases, examples etc)

Callback Function

As we have written callback function, Drush expects a function to be declared called drush_create_node(). This default naming structure starts with drush followed by the name of the command all connected with underscores.

function MYMODULE_create_node($title) {
  $repeat = drush_get_option('repeat', 1);
  for ($i=0; $i < $repeat; $i++) {
    $node = new stdClass();
    $node->type = "page";
    $node->title = $title;
    $node->language = LANGUAGE_NONE;
    $node->uid = 1;
    $node = node_submit($node);
    node_save($node);
  }
  drupal_set_message(t('Created ' . $repeat . ' node with title ' . $title));
}

Now clear the drush cache: drush cc drush

And run command: drush nc OR drush nodecreate

Arguments and options

-> Arguments are mandatory whereas options are not.

-> Arguments are passed as function parameters (in order) while options are retrieved in the callback using a special helper function (drush_get_option).

We declared 1 argument (called title) and one option called repeat.

-> The argument type will be the first string that gets written after the command name in the terminal (drush nodecreate or drush nc).

-> The option will be an integer value that gets assigned to the --repeat flag in the command.

Ex. drush nc Test --repeat=2

This will create 5 nodes, with title “Test”

User input

Let’s make it so that if a user doesn’t pass an argument, we ask them what argument they’d like to pass and use the value they provide interactively.

This goes to the top of the command callback function before checking whether the correct argument was passed.

// Check for existence of argument
if (!$title) {
  $options = array(
    'Test' => t('Test'),
    '0' => t('Error'),
  );
  $title = drush_choice($options, t('Please choose a option.'));
}
…
  1. Everything happens only if the user has not passed an argument.
  2. We create an array of key-value pairs that will represent the choices we give the user. The array keys represent the machine name of the choice while the values, the human readable name.
  3. We pass this array along side a question string to the drush_choice() function that will return the machine name of the choice the user makes. And that becomes our new $title variable (the argument).

If the title is not set or error is returned, we can add code to print error in terminal.

…
  if(!$title || $title='error') {
    drupal_set_message(t('Error! No title set.'));
  }
…

Full Code will look something like this:

 'custom_drush_create_node',
    'description' => dt('Triggers a node-save'),
    'aliases' => array('nc'),
    'arguments'   => array(
      'title'     => "Title of node",
    ),
    'options' => array(
      'repeat' => 'Number nodes to create.',
    ),
    'examples' => array(
      'drush nc error' => 'Prints error as node title is blank.',
      'drush nc Test --repeat=5' => 'Creates 5 nodes with title Test.',
    ),
  );
  return $items;
}
 
function MYMODULE_create_node($title) {
  if (!$title) {
    $options = array(
      'Test' => t('Test'),
      '0' => t('Error'),
    );
    $title = drush_choice($options, t('Please choose a option.'));
  }
  if(!$title || $title='error') {
    drupal_set_message(t('Error! No title set.'));
  }
  else {
    $repeat = drush_get_option('repeat', 1);
    for ($i=0; $i < $repeat; $i++) {
      $node = new stdClass();
      $node->type = "page";
      $node->title = $title;
      $node->language = LANGUAGE_NONE;
      $node->uid = 1;
      $node = node_submit($node);
      node_save($node);
    }
    drupal_set_message(t('Created ' . $repeat . ' node with title ' . $title));
  }
}

Feel free to drop your any queries/concern related to this blog. For Drupal Web Development we are always ready to help :) Stay tuned! 

Jun 11 2019
Jun 11

We have been an active Drupal community member since the past 6+ years, 7+ Drupal projects supported, 5000+ successfully delivered international projects and 500+ international Drupal projects - out of which 100+ projects are of Drupal Migration. And hence, we can help you in migrating your current Drupal 6/7 site to Drupal 8 and that too in a way that you will not have to spend a single penny for migrating to Drupal 9 in future. There’s a bunch of rational reasons to back this statement and offer of ours, which we’ll like to share with you:
 

  • Change in Drupal Philosophy
    Previously, every Drupal upgrade was considered to be tedious and more of a technical task as compared to its counterpart CMS platforms. This is because Drupal 8 was created with a philosophy of bridging the gap between the technical developer and a layman-like admin. And taking this philosophy of positive change, Drupal 9 is going to bridge the gap of upgrade issue by introducing compatibility between its older and newer version - making the entire process effortless and inexpensive.
     

  • Upgrade-based Modules
    The compatibility between the older and newer version of Drupal majorly depended upon the modules and themes used while building the older version. Until and unless these modules and themes aren’t upgraded, the migration was a time-taking task and tedious task that required technical assistance. This has been changed with the change in the upgrade path of the content, which makes the migration easier if prepared.
     

  • Drupal Core Deprecating Policy
    Drupal 8 capable of introducing new APIs and features against the old ones. And once these new ones are launched, the old ones automatically get deprecated. Though these old APIs cannot be removed in the minor release of  Drupal 8, it will be removed in the next major version of Drupal 9. Hence, if you migrate to Drupal 8 now, the migration to Drupal 9 can easily be done with just a handful of changes to make it compatible.
     

Looking at the above three major reasons, it must be clear to you that migrating to Drupal 9 from Drupal 8 is far easier as compared to the migration from Drupal 6/7 to Drupal 9. Dries Buytaert, the founder of Drupal, has also shared similar information about planning to be done for Drupal 9. According to him, Drupal 9 is basically built in Drupal 8 instead of a different codebase, altogether. This implies that the new features are added as backward-compatible code and experimental features, which means once the code is stable the old functionality will be deprecated.
 

Dries, in his blog on ‘Plan for Drupal 9’, has quoted contributed module authors as one of the core reasons behind the easy migration from Drupal 8 to Drupal 9. On this, he says that these are the module authors are already well-equipped with the upcoming technologies of Drupal 9 and hence they can priorly work in a manner that is Drupal 9 compatible. AddWeb, being one of these contributing members of the community, can assure you of the easy and inexpensive migration to Drupal 9 as and when it arrives.
 

Why Vouch for Drupal 9?
Now, after grasping all the above information regarding the upcoming major release of Drupal 9, you must be wondering what’s in Drupal 9 to vouch for. Let us throw some light on the same, to be able to bring some clarity for you. Drupal 9 is all about eliminating the use of deprecated modules and APIs. Drupal 8, which runs on the dependency of Symfony 3, will run out from the market by November 2021. And hence, it is highly advisable to upgrade and avail the benefits of all that’s latest!
 

Concluding Words:
As an expert #Drupal-er and active community member, AddWeb is all set to offer you with this amazing opportunity to migrate from your current Drupal 6/7 site to Drupal 8, in a way that the future migration to Drupal 9 will be super easy and inexpensive. Share your details with us in here and let our Drupal Migration Experts get back to you. In case, of any queries or suggestions feel free to get in touch with us!

Apr 29 2019
Apr 29

Advantages of govCMS:

The Australian Government created the govCMS distribution by combining Drupal Core and a specific set of Drupal modules. So that uniformity is maintained across all the Australian Government’s websites and it the creation of the same also becomes easy. Let us how else does this, govCMS distribution proves to be advantageous:

Cost-Effective

Individual web hosting and creation of the sites demand time and money. The higher the security and quality of these sites, the higher the costing. govCMS saves on both of these factors and simplifies the entire process by choosing a single provider and hosting platform on Acquia Cloud Site Factory PaaS Service. In fact, whenever there’s an increase in resource usage, one can always upgrade the platform, which is eventually beneficial to all the other govCMS sites also.

Government Standards Compliance

The entire govCMS is created in a way that it perfectly complies with the standards of the Federal Government. Hence, this makes the further process quite smooth and sorted. Security being one of the major concerns while creating a website for such Government organisations. And hence, govCMS has complied with their guideline by completing the program process of Information Security Registered Accessors. Plus, every issue that is found and rectified in govCMS will also automatically be implemented to other govCMS sites too.

Software Maintenance

Drupal is one of the largest open-source platform available today and hence it has a large team of 600 expert community members, who work on making govCMS a consistently growing and highly efficient product. This is taken care by Acquia, which also provides 24x7 assistance for govCMS at application and hardware level.   

Security Compliance

One constantly needs to confirm that there are no issues with the govCMS sites, for which a continuous process of testing, bug-fixing and other such process is required to be followed. This is very well taken care of, when it comes to govCMS and hence the security of this platform is kept intact. In fact, an automated testing process has also been set across the entire network by using Behat.

Responsive

In today’s day and age, a website that is not responsive is outdated. Fortunately, govCMS has been created with a base-theme that is responsive by default. This provides the developers in quick-creation of custom themes. This also helps in the creation of a standard look and feel of the Australian Government’s website, which converts into a user-friendly experience.

Accessibility Compliance

Every single Government website needs to be in compliance with the Web Content Accessibility Guideline (WCAG) AA 2.0. And hence, WCAG AA 2.0 has been at the base of creating the base-theme and hence it’s in complete compliance with the Government standards. This also helps in elevating the user-friendliness of the website. govCMS also provides a list of the accessible elements either via the content pages or the WYSIWYG editor.

Data Retention

Backups are a very critical and significant part of any website. So when it is a Government website, the stakes are even higher. The creation of govCMS is done in complete compliance with the National Archives of Australia Standards. This includes about 7 years of data retention on backups, which is a highly beneficial factor that works in the favour of these govCMS-based Australian Government’s websites.  

govCMS is a pool of perfection when it comes to a platform meant for Government - highly secure, affordable and effective! govCMS platform is a pool of perfection when it comes to a platform meant for creating any Government-based website. Because it is highly secure, affordable and effective! AddWeb is glad to have built a website created by using a govCMS platform, which is in complete compliance with WCAG 2.0 and government standards. And we’re all-equipped to work more on other such govCMS-based websites. If there’s anything specific in your mind that you wish to learn about govCMS then free to write to us in here and we’ll be happy to include the relevant topics in our future blogs.

Mar 27 2019
Mar 27

What is govCMS?

The govCMS distribution is supported in Drupal 7 and Drupal 8 version, which has installation profiles for Australian government websites and it is being actively managed on Github (https://github.com/govCMS/govCMS8) and features are maintained from https://www.govcms.gov.au/.
 

To work with govCMS, we have to take care of some factors in order to create a site with the govCMS platform.
 

They have limited number of the module they support and we have to stick to that only and need to find alternate options with the twig and preprocess functions only and they do not allow us to create custom modules as well.
 

Here is the list of modules that they support: https://www.govcms.gov.au/govCMS-d7-modules
 

Unfortunately supported modules for Drupal 8 are less compare to Drupal 7, but we can create support request of community and if it's valid then they can include a module on SaaS platform.
 

Our Experience about working with govCMS

We have worked with govCMS for one of our clients from Australia, who is working with another agency before we met, and already he had started site development with them, and fortunately, he gets to know about the quality of work done so far from the previous agency.

They have added lots of contrib modules and to achieve some functionality they have created custom modules as well, but as the govCMS platform doesn't support such modules we have to flush out all existing implementation and started from the beginning.

All features which are build using custom/contrib modules, we had to find alternatives and get things done only with supported modules and using preprocess functions and twig alters. and along with that, we have to make sure that site is WCAG compliance as it is a government website they must be. So all things we delivered to the client successfully as per the client's expectation with the boundary of govCMS restriction.


 

More details about what is govCMS

Drupal gets big in the Australian Government
 

With almost half of Australian Government departments now running Drupal, and hundreds of more sites now live within various agencies, Drupal has transformed the way government websites are built and managed.
 

Drupal 7: https://www.drupal.org/project/govcms

Drupal 8: https://www.drupal.org/project/govcms8
 

The aim is to provide a single solution for unclassified websites using a common codebase and a shared feature set on a scalable and secure list infrastructure.

govCMS distribution is supported as SaaS by amazeelabs in collaboration with govCMS community and it supports several contributed modules which are available, here is a list of modules which can be used with SaaS https://www.govcms.gov.au/govCMS-d7-modules.
 

Workflows and Ahoy

It is interesting to see that the .ahoy.yml is just a set of command shortcuts, which is similar to the scripts section of a composer.json. Every implementation can be smoothed over by a single Ahoy command, and the underlying implementation can evolve without the developer even noticing.

Speculating, I think the hardest part about adding Ahoy commands will be naming them. Even then, the govCMS team will have the luxury of focussing on the "SaaS govcms 8 on Lagoon" use case, rather than something like BLT which attempts to have commands for "any Drupal anywhere".

Jan 16 2019
Jan 16

Happy 18th birthday to Drupal!

                      

We’re all engrossed in the mode of celebration and the festive fly game was on point. In fact, everyone else was too painted in that mood, cheering and celebrating the spirit of flying. But our zest for celebration was a notch hire, for our reason for celebration was doubled. 15th January is not merely a date when the kite-flying festival falls but that’s the very day when our dearest of all - Drupal came into existence!

Eighteen years before this very day, the very first version of Drupal - 1.0.0 was released by its founder - Dries Buytaert. And just as it happens with all other path-breaking changes world, this one too came with a lot of faith but a humble approach towards its future. And look, how proficiently has it grown in all these years. Today, it’s one of the largest and most-trusted open-source community and the future looks even brighter.  

In the age of data-threats, Drupal is trusted for its security, worldwide. Constantly moving towards strengthening the open-source community, Drupal has never compromised on the security, content, and scope. Drupal is also known for its power of personalisation and flexibility. Drupal Commerce is also the preferred one when it comes to building an easy-looking e-commerce platform with complex functionalities. And if that was not enough, the launch of Decoupled Drupal has blown the tech world like a boss!

We might sound a little biased here, but we’re speaking nothing but the truth. Everyone from ‘The Beatles’ to ‘Estee Lauder’, ‘Columbia University’, ‘NBC Universal’, ‘NBA’, ‘Paramount’ and many more have trusted and adapted Drupal for years now. Dries has rightly quoted about it in his birthday note for Drupal and let us also conclude, our birthday note for Drupal, on the very same note -

Dec 31 2018
Dec 31

Past is a place, thoroughly familiar and yet the experience of revisiting it varies drastically. Revisiting some leaves you with happy nostalgia, some with innocent laughter, some with a moment of pride, and some, a prick of sadness or regret. But yet we choose to visit this place called ‘past’ through our memory, time and again. In fact, we recently did so by revisiting the year 2018, like many others, that is about to end in just a handful of hours. And fortunately, it was filled with a host of happy moments to rejoice and relish, topped by several breakthrough changes and chances we’ve embraced with all love & warmth.


The year 2018 has been the most eventful year for the AddWeb-traveling, counting right from the moment of moving into altogether new office space to officially being a supporting partner of Drupal.org and everything in between. It’s a journey no less than a cinematic experience, with all the drama, emotions and heroic ending - full of catharsis. Let us take you through this marvelous journey, as experienced by AddWeb-ians.

Welcoming 2018 - The Journey Begins, Quite Literally!

Dec 21 2018
Dec 21

Continuous Delivery - A trending word in the world of technology. Continuous Delivery(CD), along with Continuous Integration(CI), is becoming a popular term even with the non-technical people. And hence, every IT company is seeing a flood of clients coming with the demand of both of them. Both of these techniques - CI/CD are closely associated with the quality-oriented work methodologies - Agile and DevOps. And so are we!

Team AddWeb has been for years been associated with and following Agile and DevOps. Just as we’re associated with Drupal. No wonder, we have been ardently following continuous delivery with Drupal for years now. So let us first throw some light on this popular concept of ‘Continuous Delivery with Drupal’.

What is Continuous Delivery?

Continuous Delivery is a process of automatically deploying all your changes made on development stage, directly to the production stage. This kind of delivery is done by accepting all the unit-cases followed by coding standards. Once the code is merged with the stage branch from the development branch, the same stage branch also gets an automatic update with the help of Jenkins and git-webhook, which is triggered by merging the branches. A similar process of automatic delivery is also followed on the production site; where the code is merged with the master branch from stage branch, which is later deployed to the production servers.

Team AddWeb, as we mentioned previously, has been persistent followers of CD with Drupal via Jenkins, Ansible, and RocketChat. We believe, in today’s day and age, CD, and CI hold so much of significance because one can define repetitive tasks for one time and then on every build the same mentioned steps will run in order to update the new content. And when we speak of so much so of its importance, let us also share the tools, block diagram and process that we, at AddWeb, choose to follow for Continuous Delivery.

Nov 03 2018
Nov 03

Team AddWeb has worked for a distinctive list of industries counting from hospitability to technology and retailers to an online lottery purchase system based website. Yes, we recently collaborated with a Japan-based company to build their website with lottery purchase system, using Drupal 8. We’ve been Drupal-ing even before our inception and have been an active member of the Drupal community, globally. Our association and experience of Drupal were the base of the client’s immense faith in us and we knew that we’re going to stand true to that.

About the Project
The project requirement of the client was to build a website for them in Drupal 8. The website is basically an online lottery purchase system. Due to confidential reasons, we can not share the name of the company/client but would like to share that the experience of working on this project was new and enriching.

 

Major Features/Functionalities
We personally love experimenting and implementing innovative features to enhance the client’s website. Plus, we get a little more excited when its a Drupal 8 website. We integrated a host of futuristic features to this very website too. But since, it’s an online lottery purchase system we knew that the integration of the Payment Gateway is going to be one of an integral part. Hence, we created three types of Payment Gateway, as follows:

  • GMO Payment

  • Coins Payment

  • WebMoney Payment

The user is an integral part of this entire online lottery system and hence several functionalities are crafted around them. Like, a user can purchase coins by WebMoney Payment method and can also buy lottery from choosing any product bundle. A user also has an option to select the quantity of the product or go for the complete set. The payment for either of it can be done by the coins, GMO credit card or points.

Draw system is used for the selection of the lottery winner. Other than the lottery prize, the user also stands a chance to win the Kiriban Product as a prize. The Kiriban Product is based on the product bundle configuration, which is an additional product that a user gets as defined by an admin user.

The Problem

Any e-commerce website will definitely have multiple users buying for the same product. In this situation, the backend technicalities should be as such that it updates the quantity left of the product after the last purchase is made. Issues occur when two or more users place the order at the same time. This is an issue that is involved in concurrent shopping. In this case, the lottery opened for some specific time. Hence, the issue occurred in showcasing the updated quantity. This problem came to our notice when the site went live and around 7-8 users made the transaction at one specific time. We immediately started working on the issue.

Challenges Faced:

We quickly picked up the problem and started searching for the resolution. We have had several times, prior to this, created an e-commerce website. Hence, we used multiple methods to resolve the issues, mentioned below, but none of them worked in this particular case.

  • Initially, we tried using a Drupal lock to resolve the issue, but in vain.

  • We, later on, used the MySQL lock but this too didn’t work, due to the involvement of multiple quantities inside for loop.

  • The usage of sleep time with random sleep time also did not work, because it created the nearby value and not the exact one.

Though the method of random sleep time did not work in this case, it gave birth to the final resolution that worked. And hence, we did a minor modification to the same and divided the sleep time in a range of 3. Also, to avoid the possibility of any further clash, we adopted a table of 100.

The Final Resolution:

After trying out a handful of methods, we finally came up with a method that did work out in our favor. Let us share what steps did finally help us in addressing the problem of concurrent shopping that we faced:

  • A table consisting of 1 to 100 numbers was taken, with the sleep time by a range of 3.

  • Later, a random number was picked and a flag value for the same was set.

  • Then, a greater number from those numbers with the range of 3 was picked.

Below is the table that was created to bring out the final solution:

Aug 08 2017
Aug 08

Paragraphs

Paragraphs are one of the modules that make site builder and end users more powerful. Paragraph module does this by replacing one big WYSIWYG with predefined paragraph types. Paragraph module utilizes entity reference field to reference paragraph types. Paragraphs are basically entities so users get control over fields and theming of the paragraph.

Bootstrap 

Bootstrap is sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development. Bootstrap has become one of the most popular front-end frameworks and open source projects in the world.

A combination of these two is "Bootstrap Paragraph" module.

"The Bootstrap Paragraphs module provides a suite of content and layout Paragraph bundles made with the Bootstrap front-end framework."

Using bootstrap paragraph module, it is very easy to create features like an accordion, modals, tabs, multi column layouts, and many more things. 

The module has multiple dependencies including paragraphs, Entity reference revisions, contact formatter to name a few. The module also needs Bootstrap framework’s js and CSS added in site theme. Installing this module via composer could be beneficial.

Module installation follows a standard process. The module comes with predefined paragraph bundles which can be accessed from /admin/structure/paragraphs_type. These paragraph bundles are divided into 2 main categories: 

Content bundles

  • Simple HTML
  • Image
  • Blank
  • Contact Form
  • Drupal Block
  • View

Layout bundles

  • Accordion
  • Carousel
  • Columns (Even, up to 6)
  • Columns (3 Uneven)
  • Columns (2 Uneven)
  • Modal
  • Tabs

Each paragraph type comes with 2 options: 

Width and background color

Jul 12 2017
Jul 12
$nid = '29';
$node = node_load($nid);
$node->field_fname[LANGUAGE_NONE][0]['value'] = 'Johnny1';
$node->field_lname[LANGUAGE_NONE][0]['value'] = 'Harper1';
$node->field_address[LANGUAGE_NONE][0]['value'] = '405, Silicon Tower, Above Freezland Restaurant, Law Garden, Off C.G. road, Ahmedabad, Gujarat - 380009 India.';

field_attach_update('node', $node);
entity_get_controller('node')->resetCache(array($node->nid));
Jul 08 2017
Jul 08

Paragraphs is a contributed module which allows creation, administration, and display of customizable content components. In other words, Paragraphs gives you cleaner data structures so you can give more editing power to your end-users. 

This module replaces drupal’s standard body field with paragraph types. This allows any type of content to be added on the page including but not limited to HTML, images, videos etc. All these can be added by users. Users can add as many paragraphs as they like all the while keeping them all responsive. Developers can reuse paragraphs and layouts. 

Paragraphs are basic Drupal entities. This allows site builder control over fields used in paragraphs and their display. This also makes content saved in paragraphs compatible with Search API, views, and services. 

Below is the step by step instructions to work with Paragraphs module:

1 - Download and enable the module
Paragraphs module follows standard process to download and enable.  Module depends on entity reference revision. You can download and enable this module via drush as well.

2 - Add paragraph types
Paragraphs do not come with any predefined paragraph types. Developers can add as many paragraph types they want by going to admin > structure > paragraphs

Jun 21 2017
Jun 21
function ajax_multistep_form($form, &$form_state)
{
 
// If $form_state['step'] is not set then set default to 1
$form_state['step'] = isset($form_state['step']) ? $form_state['step'] : 1;
// Add a wrapper div to update the form using AJAX
$form['#prefix'] = '

'; $form['#suffix'] = '

';   switch($form_state['step']) { // Step 1 case 1: $fname_default_value = $lname_default_value = ''; if(isset($form_state['values']['step_1'])) { $fname_default_value = $form_state['values']['step_1']['fname']; $lname_default_value = $form_state['values']['step_1']['lname']; } elseif(isset($form_state['storage']['step_1'])) { $fname_default_value = $form_state['storage']['step_1']['fname']; $lname_default_value = $form_state['storage']['step_1']['lname']; }   $form['step_1'] = array( '#type' => 'fieldset', '#title' => t(''), '#collapsible' => false, '#collapsed' => false, ); $form['step_1']['fname'] = array( '#type'=>'textfield', '#required' => true, '#title'=>t('First Name'), '#default_value' => $fname_default_value, ); $form['step_1']['lname'] = array( '#type'=>'textfield', '#required' => true, '#title'=>t('Last name'), '#default_value' => $lname_default_value, ); break; // Step 2 case 2: $phone_default_value = ''; if(isset($form_state['values']['step_2'])) { $phone_default_value = $form_state['values']['step_2']['phone']; } elseif(isset($form_state['storage']['step_2'])) { $phone_default_value = $form_state['storage']['step_2']['phone']; }   $form['step_2'] = array( '#type' => 'fieldset', '#title' => t(''), '#collapsible' => false, '#collapsed' => false, ); $form['step_2']['phone'] = array( '#type'=>'textfield', '#required' => true, '#title'=>t('Phone Number'), '#default_value' => $phone_default_value, ); break; // Step 3 case 3: $city_default_value = $city_default_value = ''; if(isset($form_state['values']['step_3'])) { $street_default_value = $form_state['values']['step_3']['street']; $city_default_value = $form_state['values']['step_3']['city']; } elseif(isset($form_state['storage']['step_3'])) { $street_default_value = $form_state['storage']['step_3']['street']; $city_default_value = $form_state['storage']['step_3']['city']; }   $form['step_3'] = array( '#type' => 'fieldset', '#title' => t(''), '#collapsible' => false, '#collapsed' => false, ); $form['step_3']['street'] = array( '#type'=>'textfield', '#required' => true, '#title'=>t('Street Address'), '#default_value' => $street_default_value, );   $form['step_3']['city'] = array( '#type'=>'textfield', '#required' => true, '#title'=>t('City'), '#default_value' => $city_default_value, );   }     // Form Buttons $form['buttons'] = array ( '#type' => 'container', ); // If we are on step 1, we do not want a back button if($form_state['step'] !== 1) { $form['buttons']['back'] = array ( '#type' => 'submit', '#value' => t('Back'), '#limit_validation_errors' => array(), '#submit' => array('ajax_multistep_form_back_submit'), '#ajax' => array ( 'wrapper' => 'ajax_multistep_form', 'callback' => 'ajax_multistep_form_ajax_callback', ), ); }   if($form_state['step'] !== 3) { $form['buttons']['next'] = array ( '#type' => 'submit', '#value' => t('Next'), '#ajax' => array ( 'wrapper' => 'ajax_multistep_form', 'callback' => 'ajax_multistep_form_ajax_callback', ), ); } else { $form['buttons']['submit'] = array ( '#type' => 'submit', '#value' => t('Submit'), '#ajax' => array ( 'wrapper' => 'ajax_multistep_form', 'callback' => 'ajax_multistep_form_ajax_callback', ), ); } return $form; }
May 12 2017
May 12

Display modes are one of the core functionalities of Drupal 8. They are easy to create and provides great flexibility in terms of theming at entity viewing and editing level. Display modes are available for content, comment, contact messages, custom blocks, taxonomy terms, users. They are also available to views adding more power to views.

Display modes are located at Admin -> Structure -> Display modes -> View mode.

Two types of display modes are available: "view modes" and "form modes."  Both these are example of configuration entities.

View modes allows site builder to request a field to be rendered in a certain way. For example, we can have an article that has doctors field has entity reference. On article full mode display, we can request few details of doctor to be displayed. We can create a new display mode (“Doctor details”) to do so. On Doctor’s full view, we can include a brief summary of articles associated with them. 

To create View mode 

Navigate to Admin -> Structure -> Display modes -> View mode

1. Click on “Add view mode” to add new view mode

Apr 24 2017
Apr 24

This blog is all about Drupal Mail system. Email sending in Drupal is entirely straightforward. Essentially you just need to manage two stages to send an email to somebody:

In Drupal to sends an email we need to take care of two things:

  • Declare all the required properties (subject, body, headers, etc) under hook_mail().
  • Call drupal_mail() with the argument for actually sending the email.

However, in the situation like greater and complex site, the above strides won't be sufficient. In any case, Drupal gives us the Flexibility to redo email sending process, before that it's important to know how stuff functions in the background first, with the help of Drupal you can easily generate custom pdf using the print module. In this blog, I'll demonstrate to you how you can redo and extend the Drupal mail framework to satisfy your necessities.
                   
The Email Sending Process

While sending an email drupal_mail() function uses system class for sending an email. Each mail framework needs to actualize MailSystemInterface class to define its own mail sending conduct.

MailsystemInterface class utilizes two strategies:

  • format()  
  • mail()

The Mail System Module

Mail related settings can be set through Configuration > System > Mail System.

The mail system variable contains two things:

  • default-system => DefaultMailSystem
  • mailsystem_theme => current.

These key-value pairs are the settings you can adjust under the “Mail System Settings” fieldset.

Apr 06 2017
Apr 06
var styledMapType = new google.maps.StyledMapType([
  { elementType: 'geometry', stylers: [{color: '#EBE5E2'}]},
  { elementType: 'labels.text.fill', stylers: [{color: '#520000'}]},
  { elementType: 'labels.text.stroke', stylers: [{color: '#F5E8DA'}]},
  {
    featureType: 'administrative',
    elementType: 'geometry.stroke',
    stylers: [{color: '#C9A193'}]
  },
  {
    featureType: 'administrative.land_parcel',
    elementType: 'geometry.stroke',
    stylers: [{color: '#DCD6B2'}]
  },
  {
    featureType: 'administrative.land_parcel',
    elementType: 'labels.text.fill',
    stylers: [{color: '#AEA5A0'}]
  },
  {
    featureType: 'landscape.natural',
    elementType: 'geometry',
    stylers: [{color: '#DFDFBB'}]
  },
  {
    featureType: 'poi',
    elementType: 'geometry',
    stylers: [{color: '#DFC47F'}]
  },
  {
    featureType: 'poi',
    elementType: 'labels.text.fill',
    stylers: [{color: '#93746E'}]
  },
  {
    featureType: 'poi.park',
    elementType: 'geometry.fill',
    stylers: [{color: '#9DB04A'}]
  },
  {
    featureType: 'poi.park',
    elementType: 'labels.text.fill',
    stylers: [{color: '#197515'}]
  },
  {
    featureType: 'road',
    elementType: 'geometry',
    stylers: [{color: '#F5E4BF'}]
  },
  {
    featureType: 'road.arterial',
    elementType: 'geometry',
    stylers: [{color: '#FDFBF3'}]
  },
  {
    featureType: 'road.highway',
    elementType: 'geometry',
    stylers: [{color: '#F8C452'}]
  },
  {
    featureType: 'road.highway',
    elementType: 'geometry.stroke',
    stylers: [{color: '#E9BF79'}]
  },
  {
    featureType: 'road.highway.controlled_access',
    elementType: 'geometry',
    stylers: [{color: '#E97741'}]
  },
  {
    featureType: 'road.highway.controlled_access',
    elementType: 'geometry.stroke',
    stylers: [{color: '#DBA37F'}]
  },
  {
    featureType: 'road.local',
    elementType: 'labels.text.fill',
    stylers: [{color: '#80544F'}]
  },
  {
    featureType: 'transit.line',
    elementType: 'geometry',
    stylers: [{color: '#DFCD95'}]
  },
  {
    featureType: 'transit.line',
    elementType: 'labels.text.fill',
    stylers: [{color: '#8F726D'}]
  },
  {
    featureType: 'transit.line',
    elementType: 'labels.text.stroke',
    stylers: [{color: '#EBD9B0'}]
  },
  {
    featureType: 'transit.station',
    elementType: 'geometry',
    stylers: [{color: '#DFD2A9'}]
  },
  {
    featureType: 'water',
    elementType: 'geometry.fill',
    stylers: [{color: '#BAD3C2'}]
  },
  {
    featureType: 'water',
    elementType: 'labels.text.fill',
    stylers: [{color: '#8E9985'}]
  }
]);

Mar 14 2017
Mar 14

Facets allow users to search the site based on selected criteria. Using Facet API module we can add facets on site. For each field that is indexed, we can have facets. These facets can be configured and displayed on search pages. We have various configuration options available for this.

Many times we need to show these facets on pages that are not Search pages. Facet API module does provide this functionality. You need to create a view display of type "Facet blocks". Below are the steps to do so.

1 - Create a view of search index and a display of type "Facets Block". You can make this display in the same view as the search page.

Feb 27 2017
Feb 27
    use Dompdf\Dompdf;

    $result = '
      
        
        
      
    
          fitst row first column
        
          fitst row second column
        
';     if (module_exists('print') && !empty($result)) {       $dompdf = new Dompdf();       $dompdf->load_html($result);       $dompdf->render();       $pdfoutput = $dompdf->output();       $filename = 'demo.pdf';       $filepath = 'sites/default/files/pdf/demo.pdf';       $fp = fopen($filepath, "w+");       fwrite($fp, $pdfoutput);       fclose($fp);     }
Dec 08 2016
Dec 08

"AddWeb Solution, a reliable Offshore Enterprise Web Design & Development Agency is consistently delivering ambitious digital experiences for a decade. Successfully delivered 500+ projects in multiple dynamic technologies like Drupal, Laravel, ReactJS, WordPress, Magento, and many more in diverse industry verticals on the planet earth with an artful agile methodology to ensure smooth deliverables. Contact us now to benefit from our honesty and skills."

Nov 23 2016
Nov 23

Below is code to use field attached form hook.

/** * Implements hook_form() */ function hook_form($form, &$form_state) { $entity_type = 'node'; $entity_info = new stdClass(); $entity_info->type = 'test'; $field = 'field_test_image'; //to attach test content type's field to the form field_attach_form($entity_type, $entity_info, $form, $form_state, NULL, array('field_name' => $field)); $form['submit'][] = 'hook_custom_submit'; return $form; } /** * Implements hook_submit() */ function hook_custom_submit($form, $form_state) { $form_values = $form_state['values']; $node = new stdClass(); $node->type = 'test'; $node->field_test_image = $form_values[‘field_test_image’]; node_save($node); }

Nov 23 2016
Nov 23

For using basic & common classes for grid layout (For width), typography, alignment etc, we write css like:

For alignment

.margin-top--5px { margin-top: 5px; } .margin-top--10px { margin-top: 10px; } .margin-top--15px { margin-top: 15px; } ...

Typography

.h1-32pt { font-size: 32pt; } .h2-28pt { font-size: 28pt; } .h3-24pt { font-size: 24pt; } .h4-20pt { font-size: 20pt; } ...

Grid views

.width-1 { width: 8.33%; } .width-2 { width: 16.66%; } .width-3 { width: 25%; } .width-4 { width: 33.33%; } ...

  • But with use of below code, all the classes with respective css are generated at once and we don't have to write each css manually.
  • User can generate classes for different properties like width, height, padding, margin, font-size, line-height, etc.
  • Main benefits are any numerical units like px, %, vw, vh, em, rem, etc can be used
  • Whole series of classes like above will be generated by using small code snippet.

Example of generated class with respective value

Ex, width: 10px , width: 15px , width: 20px , … , width: 100px , width: 200px , …

Below code generate CSS properties like:

.margin-top--0per {
  margin-top: 0%;
}
.margin-top--1per {
  margin-top: 1%;
}
.padding-all--0px {
  padding: 0px;
}
.padding-all--10px {
  padding: 10px;
}

Note: Our demo creating 1 to 100 value.

SCSS Code:

/**
 * Adding margin, padding & width classes.
 * Ex. margin-top--10px, padding-all--50per, width--100per
 */


/* Map for position */
$position-map: (
  top: 'top',
  right: 'right',
  left: 'left',
  bottom: 'bottom',
);


$unit-map: (
  per: '%',
  px: 'px',
);


@for $size from 0 through 100 {
  @each $unit, $ut in $unit-map {
    @each $position, $pos in $position-map {
      .margin-#{$position}--#{$size}#{$unit} { margin-#{$position}: #{$size}#{$ut}; }
      .padding-#{$position}--#{$size}#{$unit} { padding-#{$position}: #{$size}#{$ut}; }
    }


    .margin-all--#{$size}#{$unit} { margin: #{$size}#{$ut}; }
    .margin-vertical--#{$size}#{$unit} {
      margin-top: #{$size}#{$ut};
      margin-bottom: #{$size}#{$ut};
    }
    .margin-horizontal--#{$size}#{$unit} {
      margin-right: #{$size}#{$ut};
      margin-left: #{$size}#{$ut};
    }


    .padding-all--#{$size}#{$unit} { padding: #{$size}#{$ut}; }
    .padding-vertical--#{$size}#{$unit} {
      padding-top: #{$size}#{$ut};
      padding-bottom: #{$size}#{$ut};
    }
    .padding-horizontal--#{$size}#{$unit} {
      padding-right: #{$size}#{$ut};
      padding-left: #{$size}#{$ut};
    }


    .width--#{$size}#{$unit} {
      width: #{$size}#{$ut} !important;
    }
  }
}

So, this is a smart code - use it and save your time guys! Feel free to add your views and comments for any Drupal Development Services. #letstalksolution

Nov 23 2016
Nov 23

Views Tabs Field 

This module provides a field of Views which renders content in vertical or horizontal tabs. This allows us to show content on views page in the tabbed format. This module provides a field in view which can be used to show content on tabs.

Below are the steps to use this module.

1 - Download and enable module normally.

2 - Create a view and add fields in this view. The fields that you want to be displayed as tabs, make them exclude from a display.

3 - Add "Global: Tabs" field.

Nov 23 2016
Nov 23
/**
 * Implements hook_token_info().
 */
function MYMODULE_token_info() {
  // Define a new token type.
  $types['custom'] = array(
    'name' => t("Custom Tokens"),
    'description' => t("Tokens that are custom."),
  );


  // Define any new tokens.
  $tokens['fname'] = array(
    'name' => t("First name"),
    'description' => t("First name token"),
  );


  $tokens['lname'] = array(
    'name' => t("Last name"),
    'description' => t("Last name token"),
  );


  return array(
    'types' => $types,
    'tokens' => array(
      'tn' => $tokens,
    ),
  );
}
Nov 23 2016
Nov 23
.controller(imagUploadCtrl, function($scope, $ionicModal, $localStorage, $cordovaFileTransfer, FileResource,$http) {
$scope.uploadFile = function () {
var url = 'http://example.com/api/ionic_api/file';
      var config = {
      	'Content-Type': 'application/x-www-form-urlencoded',
            'X-CSRF-TOKEN': CSRF TOKEN
      }
$scope.num = (Math.ceil(Math.random() * 999));
fileData = { 
      	filename :$scope.num+files.filename,
            filepath:'public://pictures/'+$scope.num+files.filename,
            file:files.base64
     	}

      $http.post(url, fileData, config)
      .success(function (data, status, headers, config) {
      	$localStorage.f_id = data.fid;
            udateData = {
                field_image:{
                  'und':[{
                      fid:$localStorage.f_id
                    }]
                  },
                uid:USER ID
            }

		var urlEditProfile = 'http://example.com/api/ionic_api/user/UID';
		$http.put(url, udateData, config)
		.success(function(data, status, headers, config){
			console.log(“User edited successfully”);
})
.error(function(data, status, headers, config){
	alert("Error");
              	console.log(JSON.stringify(data));
})

    
      })
      .error(function (data, status, header, config) {
      	alert("Error");
            console.log(JSON.stringify(data));
      });
}
})
Nov 23 2016
Nov 23

-d flag will accept all defaults.

This will ask questions like which branches you would like to use as development and production branches, and how would your prefixes be named. Press Enter to accept default suggestions.
&nbsp;

FEATURE BRANCHES

Using git-flow feature branches you can easily work on multiple features of project at the same time.

+ Create a feature branch

New feature branch is created from the 'develop' branch and switches to it.


 
Jul 04 2016
Jul 04
/**
 * Generate batch process & its operations.
 */
function MYMODULE_build_batch() {
  $operations = array();

  // Here we can add multiple operation
   $operations[] = array('MYMODULE_process_data', array($arg1)); // operation with argument
   $operations[] = array('MYMODULE_process_data'); // operation without argument

  //Define your batch operation here
  $batch = array( 
    'title' => t('Batch operation processing'),
    'operations' => $operations,
    'finished' => 'MYMODULE_build_batch_finished',
    'init_message' => t('Initializing...'),
    'progress_message' => t('Operation @current out of @total.'),
    'error_message' => t('Found some error here.'),
    'file' => drupal_get_path('module', 'MYMODULE') . 'MYMODULE.module',
  );

  return $batch;
}
May 25 2016
May 25

One of our clients wanted us to generate order PDF on order payment completion. The requirement included customized PDF which includes store logo, watermark and dynamic header and footer based on site language.

We used Commerce Billy PDF module to accomplish this task. Commerce Billy is a lightweight approach for a billing system for Drupal Commerce (Billy = Billing Light). 

Commerce Billy PDf is a part of Commerce Billy module.

This module adds a new order state called "invoiced". In this state, order gets its invoice PDF generated.

Here is how we did this.

Download and enable module.

Go to admin/commerce/config/billy-invoice and choose the settings that apply to your system.

Mar 19 2016
Mar 19
/**
               * @file
               * Code for Dependent Autocomplete.
               */

              /**
               * Implements hook_menu().
               */
              function mymodule_autocomplete_menu() {

                $items['mymodule/autocomplete/single/%/%/%'] = array(
                  'title' => 'Entity Reference Autocomplete',
                  'page callback' => 'mymodule_autocomplete_autocomplete_callback',
                  'page arguments' => array(2, 3, 4, 5),
                  'access callback' => 'mymodule_autocomplete_access_callback',
                  'access arguments' => array(2, 3, 4, 5),
                  'type' => MENU_CALLBACK,
                );

                $items['set-manufacture-sesn'] = array(
                  'title' => 'Set session',
                  'page callback' => 'mymodule_autocomplete_set_session_make',
                  'access arguments' => array('access content'),
                );

                return $items;
              }

              /**
               * Implements hook_js_alter().
               */
              function mymodule_autocomplete_js_alter(&$javascript) {
                $javascript['misc/autocomplete.js']['data'] = drupal_get_path('module', 'mymodule_autocomplete') . '/autocomplete.js';
              }


              /**
               * function for set session of selected parent term.
               */
              function mymodule_autocomplete_set_session_make() {

                $requested_parent = $_REQUEST['parent_term'];
                $explaode_val_temp = explode("(", $requested_parent);

                $parent_tid = str_replace(")", "", $explaode_val_temp[1]);

                $_SESSION['PARENT_TID'] = $parent_tid;

              }


              /**
               * Implements hook_form_FORM_ID_alter().
               */
              function mymodule_autocomplete_form_new_content_type_node_form_alter(&$form, &$form_state, $form_id) {

                unset($_SESSION['PARENT_TID']);

                if (isset($form_state['node']) && !empty($form_state['node']->field_equipment_manufacture[LANGUAGE_NONE]['0']['target_id'])) {
                  $_SESSION['PARENT_TID'] = $form_state['node']->field_equipment_manufacture[LANGUAGE_NONE]['0']['target_id'];
                }

                $form['field_equipment_model'][LANGUAGE_NONE]['0']['target_id']['#autocomplete_path'] = 'mymodule/autocomplete/single/field_equipment_model/node/new_content_type/NULL';

                $form['#validate'][] = 'mymodule_autocomplete_equipmentnode_form_validate';

                // Attach js to form
                $form['#attached']['js'] = array(
                  drupal_get_path('module', 'mymodule_autocomplete') . '/mymodule_autocomplete.js',
                );
              }

              /**
               * Validates the category attributes form.
               */
              function mymodule_autocomplete_equipmentnode_form_validate($form, &$form_state) {
                
                if (isset($form_state['values']['field_equipment_manufacturer'][LANGUAGE_NONE]['0']['target_id']) && !empty($form_state['values']['field_equipment_manufacturer'][LANGUAGE_NONE]['0']['target_id'])) {
                  $_SESSION['PARENT_TID'] = $form_state['values']['field_equipment_manufacturer'][LANGUAGE_NONE]['0']['target_id'];
                }
                
              }

              /**
               * Menu Access callback for the autocomplete widget.
               *
               * @param $type
               *   The widget type (i.e. 'single' or 'tags').
               * @param $field_name
               *   The name of the entity-reference field.
               * @param $entity_type
               *   The entity type.
               * @param $bundle_name
               *   The bundle name.
               * @return
               *   True if user can access this menu item.
               */
              function mymodule_autocomplete_access_callback($type, $field_name, $entity_type, $bundle_name) {
                $field = field_info_field($field_name);
                $instance = field_info_instance($entity_type, $field_name, $bundle_name);

                if (!$field || !$instance || $field['type'] != 'entityreference' || !field_access('edit', $field, $entity_type)) {
                  return FALSE;
                }
                return TRUE;
              }

              /**
               * Menu callback: autocomplete the label of an entity.
               *
               * @param $type
               *   The widget type (i.e. 'single' or 'tags').
               * @param $field_name
               *   The name of the entity-reference field.
               * @param $entity_type
               *   The entity type.
               * @param $bundle_name
               *   The bundle name.
               * @param $entity_id
               *   Optional; The entity ID the entity-reference field is attached to.
               *   Defaults to ''.
               * @param $string
               *   The label of the entity to query by.
               */
              function mymodule_autocomplete_autocomplete_callback($type, $field_name, $entity_type, $bundle_name, $entity_id = '', $string = '') {
                // If the request has a '/' in the search text, then the menu system will have
                // split it into multiple arguments and $string will only be a partial. We want
                //  to make sure we recover the intended $string.
                $args = func_get_args();
                // Shift off the $type, $field_name, $entity_type, $bundle_name, and $entity_id args.
                array_shift($args);
                array_shift($args);
                array_shift($args);
                array_shift($args);
                array_shift($args);
                $string = implode('/', $args);

                $field = field_info_field($field_name);
                $instance = field_info_instance($entity_type, $field_name, $bundle_name);
                

                return mymodule_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id, $string);
              }

              /**
               * Return JSON based on given field, instance and string.
               *
               * This function can be used by other modules that wish to pass a mocked
               * definition of the field on instance.
               *
               * @param $type
               *   The widget type (i.e. 'single' or 'tags').
               * @param $field
               *   The field array definition.
               * @param $instance
               *   The instance array definition.
               * @param $entity_type
               *   The entity type.
               * @param $entity_id
               *   Optional; The entity ID the entity-reference field is attached to.
               *   Defaults to ''.
               * @param $string
               *   The label of the entity to query by.
               */
              function mymodule_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id = '', $string = '') {
                $matches = array();

                $entity = NULL;
                if ($entity_id !== 'NULL') {
                  $entity = entity_load_single($entity_type, $entity_id);
                  $has_view_access = (entity_access('view', $entity_type, $entity) !== FALSE);
                  $has_update_access = (entity_access('update', $entity_type, $entity) !== FALSE);
                  if (!$entity || !($has_view_access || $has_update_access)) {
                    return MENU_ACCESS_DENIED;
                  }
                }

                $handler = mymodule_get_selection_handler($field, $instance, $entity_type, $entity);

                if (isset($_SESSION['PARENT_TID'])) {
                  $handler->field['settings']['handler_settings']['view']['display_name'] = 'entityreference_2';
                  $handler->field['settings']['handler_settings']['view']['args'][0] = $_SESSION['PARENT_TID'];
                }

                if ($type == 'tags') {
                  // The user enters a comma-separated list of tags. We only autocomplete the last tag.
                  $tags_typed = drupal_explode_tags($string);
                  $tag_last = drupal_strtolower(array_pop($tags_typed));
                  if (!empty($tag_last)) {
                    $prefix = count($tags_typed) ? implode(', ', $tags_typed) . ', ' : '';
                  }
                }
                else {
                  // The user enters a single tag.
                  $prefix = '';
                  $tag_last = $string;
                }

                if (isset($tag_last)) {
                  // Get an array of matching entities.
                  $entity_labels = $handler->getReferencableEntities($tag_last, $instance['widget']['settings']['match_operator'], 10);

                  // Loop through the products and convert them into autocomplete output.
                  foreach ($entity_labels as $values) {
                    foreach ($values as $entity_id => $label) {
                      $key = "$label ($entity_id)";
                      // Strip things like starting/trailing white spaces, line breaks and tags.
                      $key = preg_replace('/\s\s+/', ' ', str_replace("\n", '', trim(decode_entities(strip_tags($key)))));
                      // Names containing commas or quotes must be wrapped in quotes.
                      if (strpos($key, ',') !== FALSE || strpos($key, '"') !== FALSE) {
                        $key = '"' . str_replace('"', '""', $key) . '"';
                      }
                      $matches[$prefix . $key] = '' . $label . '';
                    }
                  }
                }

                drupal_json_output($matches);
              }

              /**
               * Get the selection handler for a given entityreference field.
               */
              function mymodule_get_selection_handler($field, $instance = NULL, $entity_type = NULL, $entity = NULL) {
                ctools_include('plugins');
                $handler = $field['settings']['handler'];
                $class = ctools_plugin_load_class('entityreference', 'selection', $handler, 'class');

                if (class_exists($class)) {
                  return call_user_func(array($class, 'getInstance'), $field, $instance, $entity_type, $entity);
                }
                else {
                  return EntityReference_SelectionHandler_Broken::getInstance($field, $instance, $entity_type, $entity);
                }
              }

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