Multiple join query in Drupal 8

You can find some information on database queries in Drupal 8 here but it doesn’t offer many examples in the way of joins.

MX Master vs Performance MX - impressions

While I have been using the Performance MX for best part of a year, I have just received the MX Master. Below are my initial impressions after just a few minutes.

My custom racquet specs

I’m a bit of a gear junkie. With every sport there are companies that want to make money and every year promise “innovation”. Tennis is no different.

HTTP Authentication with PHP

This is useful if you are using a hosting solution that makes it tricky or impossible to implement HTTP authentication with the web server.

Redirect search block to default Apache Solr search page

For some reason the default search page option on Apache Solr search pages isn’t respected. This form alter hook and submit handler do the trick.

Git delete tag

@See: How to: Delete a remote Git tag

# Assuming the tag to delete is "1.3.5-rc1"
git tag -d 1.3.5-rc1
git push origin :refs/tags/1.3.5-rc1

Simple array to XML conversion

For those times where you need to convert an array to XML whilst maintaining the structure of the data. There are a number of examples of array_to_xml functions on places like StackOverflow but I like the simplicity of my recursive function below.

Synchronising files with Drush rsync

I previously wrote a post about synchronising files using rsync. However, Drush allows for a much more convenient way to sync files between environments.

Create Drupal users with Drush

This is especially useful if you don’t have a login to create accounts through the web interface.

Install Apache Solr on Tomcat - OS X

To get Apache Solr running with Tomcat on OS X there are just a few steps to take

How to use Rsync to download files

###@See: How to use Rsync to synchronise directories Also, if you’re looking to synchronise Drupal files, you would be better using Drush rsync

sql-sanitize: The hidden Drush command

Nosing around in the Drush code I noticed that there some extra commands that are hidden from view.

Installing drush for MAMP with Homebrew

###Install Homebrew

Removing branches in Git

Spend long enough working on a codebase and you’ll eventually end up with a number of branches on your remote that are redundant. This is either because they’re now merged into master or maybe just simply aren’t required anymore.

Adding custom tokens to Webform 3.x

There has been a couple of occassions where I have needed to add a custom token to the webform module (ver. 3.x). The way I have done it is as follows.

Setting up a crontab with examples

Create or edit a crontab by running:

Undo a git commit

Undo a local git commit with git-reset.

How to add meta tags the Drupal way

When adding meta tags to the site <head>, use drupal_add_html_head() in the template.php file.

Add custom fields to the Apache Solr index

Note: This was written using apachesolr version 7.x-1.5

Programmatically manage Drupal blocks

Managing blocks through code can be very valuable, especially if you are running clean deployments of just the codebase. You can use hook_block_info_alter() to configure the default blocks disable/move/change visibility status.

Validate form in AJAX submit callback

Using an AJAX callback on a form submit doesn’t call the validate functions by default and means that form values can be submitted and saved without being confirmed as valid. I’m not sure of the best solution for this problem is, but below is the way I handle it.

Retain filters on apachesolr_panels search form

I have been using the apachesolr_panels module in a project recently and couldn’t find an option to retain filters when performing a keyword search.

Tomcat - cannot find ./bin/

A routine installation of Tomcat and for some reason, trying to start up the server I get the following error:

Apache Solr - filter results with an OR query

By default, adding filters to the query object will use the AND operator. To use OR, you will need to add a SolrFilterSubQuery.

MySQL query - order results by an array

###The Problem

Drupal - Remove system CSS styles

There’s been many a time where I’ve created the perfect CSS in a static site design only for it to be pulled to pieces by Drupal’s system styles. The solution is hook_css_alter(&$css) which can reside in your template.php file:

Reset Drupal's theme using MySQL

It’s possible to break everything by doing something so little for example renaming/removing the current theme without disabling it first. It may also be the case that a new theme is installed which gives that white screen of death.