Skip to main content

Drupal planet

knackforge blog knowledge base

Drupal cron-queue

Drupal cron queue is very useful while running a big cron job. It will split a big cron job into small chunks and execute without getting timed out or being abruptly ended.

Three important things to remember in queue implementations are

  1. Create cron queue in hook_cron_queue_info
  2. Fill the queue with data
  3. Define worker callback function

STEP 1 - Create cron queue in hook_cron_queue_info

knackforge blog knowledge base

Drupal 6: system_settings_form

Drupal has a rich set of API to aid us in implementing custom functionalities with minimal optimized code. One such utility is system_settings_form($form).

Recently in my project, I created a new admin configuration form, in that I had to set the all the field values as system variables. If I had not used system_settings_form(), then the code would have been like this.


Embed Html Page with Menu Display handler in Node

Recently I have done some interesting task in my project, my client wants to embed html page into drupal node. So they can show the well-designed html pages with drupal external functionalities(menus, block in the sidebar, footer). It is an easy one to develop it. I have done it in the following ways,

Setup Authcache in Drupal

Important Things to Setup Authcache in Drupal

We need some kind of Caching system to deliver quickly the pages, it will help to improve the site performance and usability. Drupal has a default built-in cache system but it is not enough for some of the complex sites, So we are choosing some kind of complex caching systems like Authcache, Memcached, Varnish. Authcache works with both Memcached and Varnish, we can use them as a backend of the caching process.

knackforge blog knowledge base

Drupal form's #tree option

There may be a need to name the form elements in an array structure how the form is built. You can see this in Ubercart checkout pane form's input elements. This is very useful when one has a large multi-part form which can be grouped easily by their POST content's array format.

Eg: panes[delivery][delivery_first_name]

A simple flag on you $form construct array will do the trick. It's the #tree option. For whichever elements you set this #tree option, the element's children will be named with full reference to its parents.

knackforge blog knowledge base

Drupal Commerce - PayPal payment was successful but order not completed

Most of us use PayPal as a payment gateway for our eCommerce sites. Zero upfront, No maintenance fee, API availability, and documentation makes anyone easy to get started. At times online references offer out-dated documentation or don't apply to us due to account type (Business / Individual), Country of the account holder, etc. We had this tough time when we wanted to set up an Auto return to Drupal website.

knackforge blog knowledge base

How to create Queue worker in Drupal 8

The queue API allows placing items in a queue and processing them later. If you have a task that must be done regularly and it takes more time to complete then Cron queue might be the better solution. 

In Drupal 8, hook_cron_queue_info() has been replaced by QueueWorker Plugin. Define the queue worker by creating a QueueWorker folder inside the Plugin folder. In the below example, I create a form for sending the email. Emails will be added to the queue by submitting the form. On cron run emails will be dequeued.  

Apache Solr Search

How to make Apache solr search programmatically from Drupal 7

Recently I came across a situation where I needed to make Apache solr search from drupal programmatically. Basically we have Apache solr module available in drupal, which enables to connect with solr for searching. There are loads of documentation for setting solr search with drupal, so instead going into those details, lets head straight to the custom code required to make programmatic solr search from drupal:

Review Drupal Professional Themes

Review of Drupal professional themes is one of the best Drupal professional theme selling sites. With decades of free theme and quality of paid themes, has got its own place in the list professional theme selling sites. All our themes are Responsive and catered specifically for Drupal sites. A good theme gives your website a distinct feel that sends out a positive impression to your visitors. In this post, we would like to review the top themes on to help you select the best.

Subscribe to Drupal planet