Drupal 7

Function scope & Drupal cache

Submitted by swim on Mon, 07/14/2014 - 04:43

When developing with caching in mind it's important to consider functionality scope. For example, writing code which is per visitor specific in PHP with caching support ahhh =O. While rewriting that same functionality in JavaScript offers us a quick and cache friendly solution. Consider the following examples.

Extending the Drupal Media module

Submitted by swim on Tue, 06/24/2014 - 04:42

The following example extends the Drupal 7 Media module (7.x-1.4 / 7.x-1.x). The goal is to provide separation between the Drupal backend and the Media module functionality. Providing a custom theme just for the Media module components. This allows users with access to the Media module to circumvent the Drupal backend. Why? We can eliminate user error by providing a cleaner UX, the user's journey is much shorter & the solution feels much more customized.

Requirements

Drupal Commerce Responsive Checkout Tables

Submitted by swim on Fri, 06/06/2014 - 04:18

Providing a responsive checkout is an important feature of any eCommerce site. Drupal Commerce if themed correctly handles this fairly sweet; except for one element, tables.

Here is a quick solution which leverages stacktable.js. Automatically applying it to each views table instance during the checkout process. Simply add more form_id's to extend this functionality to other pages.

Drupal Views custom AJAX pagination callback

Submitted by swim on Sun, 03/16/2014 - 04:39

The following example will illustrate how to override a views default ajax pagination callback. There are a number of reasons this could be useful. Views ajax pagination will replace the entire view element; which is of course required it's still doing more than we might need. We might also want to keep the already loaded content and simply append new rows. Please note this is still a work in progress and is intended for the Owl Carousel module.

Drupal Commerce checkout pane validation

Submitted by swim on Tue, 02/11/2014 - 04:24

This article will contain a super brief summary of some of the gotchas when adding custom validation to checkout panes. Commerce checkout panes handle validation on an element level, validation handlers should be attached to the button. However this is not always possible.

For example, say you have embeded a custom form into one of your checkout panes. Validation for this form must be declared in hook_commerce_checkout_pane_info or hook_commerce_checkout_pane_info_alter

Drupal Field Importance, how to arbitrarily score entities

Submitted by swim on Fri, 01/10/2014 - 04:16

Before I dive into the method behind this module let me explain the use case. Our client had very little time and required at first a simple way to attribute a score (numeric value) per entity type field instance. The total score for the submitted entity is then calculated from each field score where a value has been entered. Finally these are displayed in an administrative view with a comparison to the total amount of points possible for that entity.

Drupal Commerce extending reorder module

Submitted by swim on Tue, 11/05/2013 - 04:09

Below is a very simple bit of code which extends Drupal Commerce reorder module. The code places an AJAX form on all commerce order entities allowing users to reorder from the order details page. This form functions exactly like the module button but with no redirect after the reorder has been triggered. One could easily add this in with a $form_state['redirect'].

Editr HTML, CSS, JS Playground for Drupal

Submitted by swim on Thu, 09/05/2013 - 03:57

Editr is an online code playground editor built with ace.js by Idered (Kasper Mikiewicz). Editr is a fantastic way to demonstrate code providing syntax highlighting, code tips & previews. Further Editr can be hosted locally allowing easy extension. Integrating Editr into Drupal was tedious at first with the jQuery requirements set fairly high; thank you maintainers of the jQuery update module, your awesome. As it stands this is only a proof of concept and should not be used on a live production site etc.

Drupal, Programmatically create registration entity

Submitted by swim on Wed, 09/04/2013 - 04:05

Recently we required a simple method for allowing users to register to the site and an event through a single form. We are using the Entity Registration (1.x) module in conjunction with Commerce Entity Registration. The form was available for each event on the corresponding node pages. Essentially the user required an account to attend an event as follow up & post event information was needed.

Tags

Omega 4.x & matchMedia

Submitted by swim on Fri, 08/16/2013 - 04:08

I love Omega; even more so after recently developing a number of sites using 4.x. While the changes from 3.x have left many site builders unhappy; developers should be ecstatic. Ultimately Omega doesn't make as many assumptions & in turn provides a much blanker canvas than before. One of these freedoms is allowing devs to set their own (breakpoints) media queries. Not like you couldn't override those already setup in 3.x; most people just used the predefined ones as it served an easy win.

Subscribe to Drupal 7