Creating a custom Drupal block in a module

Creating a custom Drupal block in a module

Friday, Jul 24, 2015
Making a custom block in Drupal, something other than a block with a title and body which is already core functionality, is something that we often end up doing when integrating services from other locations to control the display of some data. Although it may not be as elegant as integrating with a custom entity, it is far less time consuming overall and where we attempt to deliver value before perfection it fits with most customer requirements. ...

Read more
CSS Hover Pointer Events

CSS Hover Pointer Events

Thursday, Jul 2, 2015
This week we’ve found a new technique for creating semi-transparent css only buttons from list items, which become opaque when hovered over. This is easy enough to do when writing custom markup as you can put anything you like inside an anchor tag, but using some of Drupal’s theme output it isn’t always so simple. In our case, we were finding that the list item area was turning opaque without the anchor being hovered over, giving the impression that it was clickable even though it wasn’t (bad UX alert! ...

Read more
Auto Tweeting Links to Pre-Existing Content in Drupal 7

Auto Tweeting Links to Pre-Existing Content in Drupal 7

Friday, May 15, 2015
This week at Will Hall Online we’ve been building a system on one of our sites which periodically tweets a link to an existing piece of content, along with some custom text, a description and hashtags. Possible solutions included: Writing a custom module Try to use the contributed twitter_queue module Construct something using the standard Twitter contrib module, views and rules. We went for the third option in the end, firstly because the working of the twitter_queue module were somewhat mysterious, and secondly because writing a custom module seemed like unnecessary extra effort when we could just use the enormously powerful views and rules modules to come up with something robust and flexible. ...

Read more
Dynamically Hide Tick Labels When Using Flot Chart Categories

Dynamically Hide Tick Labels When Using Flot Chart Categories

Tuesday, Mar 3, 2015
By default, Flot with the Flot categories plugin doesn’t allow for you to use the ticks or tickSize option to show less ticks when there are too many data points on the x-axis for all of the labels to fit. Our initial thought was to attempt to achieve this using a Ticks function inside the axis options. Unfortunately, this proved to be impossible due to the fact that the function appeared to run once for every tick on the axis, which would make it unworkable once we added the necessary computation. ...

Read more
Developing Using Geany IDE

Developing Using Geany IDE

Monday, Feb 16, 2015
At Will Hall Online, we’ve recently started using the Geany IDE for Linux, and as there doesn’t seem to have been a great amount written about, it, we thought we’d share some of our first impressions of the program. First off, it seems to have pretty good support for PHP and Javascript, which forms the bulk of our coding. It’s got some really handy plugins, such as a version control one that allows you to push stuff straight to Git. ...

Read more
Using CKEditor Styles in Drupal

Using CKEditor Styles in Drupal

Wednesday, Nov 12, 2014
For a recent project, we’ve been trying to find an easy way of allowing our client’s staff members to create and edit content using a WYSIWYG editor. However, they also wanted a fair degree of control over the layout of the content, without using any html editing. To achieve this, we decided to create a solution inside the WYSIWYG editor in order to keep the user interface as simple as possible. ...

Read more
Order array by value

Order array by value

Wednesday, Sep 3, 2014
Just a quick code snippet here. I had been looking for a reasonable way to sort an array by the values that are inside it. For example if your array is: $array = array( 'id' => 1, 'name' => 'Graham', 'id' => 2, 'name' => 'Will', 'id' => 3, 'name' => 'Ryan', ); But you want your array to be order by name; in this order: $array = array( 'id' => 1, 'name' => 'Graham', 'id' => 3, 'name' => 'Ryan', 'id' => 2, 'name' => 'Will', ); Here is a quick function to help you out. ...

Read more
Drupal 7 Post Migration Clean Up

Drupal 7 Post Migration Clean Up

Tuesday, Aug 13, 2013
As a follow up to my previous post on Drupal 6 Post Migration Data Clean Up, I thought that a follow up for Drupal 7 would be useful. In this one I have also included the block_custom table for custom blocks, which seems to be a place I have overlooked before. Update links inside node body and custom blocks: UPDATE `field_data_body` SET `body_value` = REPLACE(`body_value`, "http://[temporary site]", "http://[new URL]"); UPDATE `field_revision_body` SET `body_value` = REPLACE(`body_value`, "http://[temporary site]", "http://[new URL]"); UPDATE `block_custom` SET `body` = REPLACE(`body`, "http://[temporary site]", "http://[new URL]"); Update links to files/images within nodes and custom blocks: UPDATE `field_data_body` SET `body_value` = REPLACE(`body_value`, "sites/[temporary site]", "sites/[new URL]"); UPDATE `field_revision_body` SET `body_value` = REPLACE(`body_value`, "sites/[temporary site]", "sites/[new URL]"); UPDATE `block_custom` SET `body` = REPLACE(`body`, "sites/[temporary site]", "sites/[new URL]"); Another useful place if you are looking for post migration is to rebuild your sitemap (using xml_sitemap) and clear all the caches. ...

Read more
Desktop Application Style CSS Buttons

Desktop Application Style CSS Buttons

Thursday, Nov 29, 2012
Getting the right amount of visual attractiveness and common interface into a site, so as to make it easy for a user, can be a difficult path to tread. On the one hand, everyone expects that their site should reflect their brand, with visuals, graphics, fonts, image and user interface all being custom to them, however, making web applications that users find easy to se normally means compromising on some parts to make the site navigation easily recognisable. ...

Read more
Quota alerts for email users

Quota alerts for email users

Thursday, Nov 8, 2012
Recently I have been doing quite a few more system administrator tasks around different office. I wrote this bash script (I realise it is probably not perfect to bash officianados, however, it does solve that problem). I have attached the completed file below if you want to download it. Bash Code #!/bin/bash # get all users whose uid is greater than 1000 and less than 60000 for user in `awk -F':' '{if ($3 > 1000 && $3 < 60000) print $1}' /etc/passwd` do # create array as output from quota command array=( $(quota -v $user)) # retrieve amount of space user is using block=${array[17]} #retrieve quota that user is allowed quota=${array[18]} # result = quota - amount used result=$(($quota-$block)) # if result is less than 20000 then do something. ...

Read more