VirtualBox Gotchas

This is ongoing post listing different challenges and how those can be overcome when utilizing VirtualBox for your development needs 1. VirtualBox host only supports 32bit guest OS This was a problem on Windows 8 Intel processor machine that didn’t have vt-x enabled. The vt-x is feature of Intel processor that allows the virtualization of some kind. Once enabled, the VirtualBox host can load also 64bit Guest OS. To enable, boot Vindows 8 in BIOS …

Continue reading →

jQuery Snippets

Here are list of JQuery code snippets updated ongoing bases 0. Attach Custom Function to HTML Element Here, we put everything in parentheses so it executes on page load while passing jQuery object and assign it to “$” symbol. Afterwards, search the html element with class ‘image_button’ and assign click event with our function. This function grabs src from one element and swaps with another 1. How to find events attached to particular element the …

Continue reading →

How to Pass Variables Horizontally and Vertically in Drupal

There are some variables($node, $page,etc) you depend more than on anothers in Drupal. Its important to have access them when you need. In the following, we describe two ways -”top to down” and “left to right” to pass and accesses any variable at any part of the execution in Drupal Top to Down …or Vertical A good example, would be passing some variable from page scope to the node scope Since page scope calls theme …

Continue reading →

Scrap Emails From Gmail via Drush

In the following are steps to scrap emails from gmail account. We first archivete all emails into a file(.mbox). Then we run our custom drush command to scap all emails into output-email.csv file. At last, we use tool such as BriteVerify.com to filter only valid emails. Archive All Emails Go to Google Takeout and create archive file(.mbox) from your gmail account Scrap with Drush Once you have archive(.mbox) file, run the following drush command: This …

Continue reading →

Implementing Custom Drush Commands

In this post, we cover how to install and create your first custom Drush command Install Custom Drush Commands There are two steps to install any drush command: a) copy drushrc.php from /path/to/drush/example to your $HOME/.drush/ directory if not already present b) In the drushrc.php specify directory containing your drush cusotm commands This will import the directory where your custom drush function will reside. Lets create one Implementing Custom Drush Command Imlementing drush command can …

Continue reading →

Importing and Exporting Products in Drupal Commerce

In prevous post Drupal Commerce Install and Setup, we went over on incorporating commerce functionality with Drupal and creating/displaying Products. In this post, we go over how to import/export Drupal commerce “products” as well as “product displays”. Important to note, there are “products” and then there are “product displays”. The “product display” is displaying one to many products referenced by the display. It is plain Drupal node with an extra field of type – product …

Continue reading →

Taking CKEditor a Apart

In this post, we dive into the code of CKEditor to learn internals. We needed to do so to understand how the empty tags are being removed by default. This was not acceptable behavior because frameworks like Twitter Bootstrap or Foundation use empty tags part of the layout. Boot from Console When troubleshooting or learning, it always easer to move everything else out of the way but the thing of your interest. In our case, …

Continue reading →

Import/Export Sample Data and Assets for Kickstart All via Features

This is an overview of the custom module – Sample Data developed and used at DesignsSquare.com that was published at Drupal.org for anyone that finds it useful. It is also at github – designssquare-lib-sample-data branch ’7.x-1.x’ Issue: Widget or Theme needs sample data for kickstart. There is no automatic, easy and standard way to package Sample Data with all of its assets(i.e. images, videos,etc) part of single artifact deliverable for easy install in Drupal. Solution: …

Continue reading →

Making It Permanent for File_Managed

The file_managed functionality comes with ajax capability to upload and remove file, however. While, it stores the file, it stores it temporarily,so unless we make it permanent, the files just uploaded will be removed after certain time. In this post, we demonstrate one of the many ways how to make the file upload via file_managed a permanent. Hook Into File_Managed First, we specify the callback for the form element ‘file_managed’ as following: By specifying ‘#process’, …

Continue reading →

Contextual Links – Editable Blocks

One of the awesome things about Drupal is the contextual links. The contextual links provide a way to attach links to any block on the page for easy editing via UI or any purpose for that matter. In this post, we cover how to specify a region for which the context links should show up, then how to add the links and, at last, how to render them in the template. 1. Set the Region …

Continue reading →