Drupal code: Drupal hints and tips

  • Some inital thoughts about the Apple Watch and Drupal

    In recent months there has been much hype over the newest addition to Apple’s product portfolio: the Apple Watch. It’s undoubtedly an impressive looking piece of kit and Apple have been quick to show off its many features in an attempt to get developers thinking up weird and wonderful applications to make the most out of this whole new approach to how users both consume and interact with their content. But what does the Apple Watch mean to us as web developers? How do we leverage Content Management Systems like Drupal to make use of this recent trend towards wearable tech?

  • Mobile first, later : 10 Steps for retrospectively making your Drupal site responsive

    On April 21st, Google updated their mobile search algorithms to boost the rankings of mobile-friendly web pages, whilst conversely decreasing rankings for pages that have been designed only for large screens. This change is likely to have a big impact on many Drupal sites, and ComputerMinds have seen a surge in requests for retrofitting responsive themes onto existing Drupal sites.

  • Drupal Queues

    Queues are a wonderful way of separating different parts of a system. Once you have separated those parts you can do lots of interesting things, like be more fault tolerant or have a more responsive front end for your users.

    For example, lets suppose that we have a website on which we can book a holiday. We can choose lots of different options and at the end of the process when we've booked the holiday we'd like to send the customer a nice PDF detailing all the options they've chosen.

  • Language lessons: 10 Useful tips

    To complete my series on multilingual Drupal, here are some mini-lessons I've learnt. Some of them are are to improve the experience for administrators & translators, others cover obscure corners of code. The first few don't require any knowledge of code, but the later ones will be much more technical.

  • Contribute to Drupal(.org)!

    So at DrupalCon Austin I had a great time at the contribution sprints. I worked on some issues affecting Drupal.org, it was great fun!

    The issues we worked on over the week range from simple things through to some pretty difficult issues.

    Although Drupal core can always use more contributors, I would suggest that Drupal.org is also desperately short of contributors too.

  • Language lessons: What are you translating?

    Content (node-level) translation or entity (field-level) translation?

    It seems an obvious question to ask, but what are you translating?

    The tools exist to translate just about anything in Drupal 7*, but in many different ways, so you need to know exactly what you're translating. Language is 'a first-class citizen', in the sense that any piece of text is inherently written by someone on some language, which Drupal 7 is built to recognise. Sometimes you want to translate each & every individual piece of text (e.g. at the sentence or paragraph level). Other times you want to translate a whole page or section that is made up of multiple pieces of text.

  • A fully-automated testing rig #8

    Part 8: CasperJS debugging tips

    You're getting desperate. Your CoffeeScript / Javascript syntax looks OK, but CasperJS doesn't like what you're giving it.

    Try going through this checklist for a selection of sensible sanity checks and more:

  • A fully-automated testing rig #7

    Part 7: When this.mouse.click doesn't work

    mouse.click and mouse.move are a really helpfuls function in CasperJS, but we have at times found that they just don't work. Mostly, that's been because the element isn't there to click on. Do make sure that it's actually there! Make sure you're using the right selector, too. Try a casper.capture() to see whether it's there, but be wary of timings to ensure that you get a capture for the moment that you want to be performing the mouse action.

  • A fully-automated testing rig #6

    Part 6: Manually fail a test, but continue script execution

    We set up an event to take screenshots of failed test pages, by hooking into the onFail event. This made for a problem when we wanted to pass or fail a test based on whether there were entries in the Drupal Watchdog table. Failing a test also would normally stop script execution, but we explicitly need our post script to finish its work!

  • A fully-automated testing rig #5

    Part 5: Fun with viewports, and THEN some

    As I described previously, we nicely externalised our list of viewport sizes, making it really easy to set our viewports for mobile, tablet and desktop tests. Our content appearance tests put this to good use, taking screenshots of the content at mobile, tablet and desktop resolutions. The problem we very quickly ran into was that we frequently ended up with empty screenshots, or sometimes no screenshot at all. This is where the asynchronous fun began.


Subscribe to our RSS feed Subscribe to Drupal code: Drupal hints and tips