Drupal code

  • Drupal database prepared statements

    Drupal 7's database layer is awesome, it is built upon PDO and one of the great things about PDO is named placeholders, they allow you to build queries like:

    $unsafestring = "this string can contain quotes: ' or other things";
    $query = db_select('table')
               ->fields('table')
               ->condition('field', $unsafestring);

    The SQL that is sent to the database is:

  • Facebook share links - controlling the data sent

    Not strictly a Drupal post this, but something that I was playing with yesterday that I was really struggling to find any documentation on. We wanted a simple "share" on facebook link, we didn't want to go through the process of creating an app and using the opengraph API - instead we just want to use the simple sharer.php script but have a bit of control over what is being shared.

  • Storing data in Aegir

    Aegir is a very clever Drupal hosting system built using Drupal and Drush. It is divided into two parts: the frontend and the backend. The frontend is essentially just a standard Drupal site that stores its data in the database and then some drush scripts that manipulate the data. The backend (provision) is just a collection of drush scripts, and it stores its data in Aegir contexts which are essentially just arrays of data stored in text files on disk. One of the most mysterious processes in Aegir is sending data from the frontend to the backend to be stored in these contexts. Recently I cracked this mystery, and I'm going to explain how.

  • Aegir tasks daemon

    Aegir is a very clever hosting system for Drupal that sites and provisions them on various servers and does lots of clever things. One of the clever things that it has had for a while is a task queuing system. You can ask Aegir to lots of different things all in one go, and Aegir will queue them up and run them at its own pace. This provides a really good separation from the front-end Aegir website and the back-end Aegir scripts.

  • Setting default theme during installation

    Here's a quick post that will be a reminder for us as much as anyone else! Setting the default theme during installation using an installation profile is surprisingly hard in Drupal 6, and easier though not obvious in Drupal 7. In Drupal 6, we used the wonderful Install Profile API module, which allowed us to do it in just a few lines in an install task:

  • CTools Path Access plugin

    I made a new Drupal 7 module today... the CTools Path Access plugin. It is a very simple module that provides a CTools access plugin for using the access rules of another path.

    For example, you might set up a custom Panels search page in Page Manager, and just want to use the same access rules that the default Drupal search page uses at /search.

  • Playing second fiddle

    While at Drupalcon I couldn't help but want to get involved in core development of Drupal. I have been involved on the fringe of Drupal core development for a number of years, and I've found bugs, submitted patches, tested others' patches, fixed others' patches and contributed documentation, but to get really involved in development you have to basically immerse yourself in it. It's really hard to follow the issue queues and get any sense of what is going on in the Drupal community. I just don't have the time to invest in core development.

  • Drupalcon Chicago - Core conversations - Content vs Configuration

    Drupalcon Chicago had a track for 'Core conversations' that were discussion focused and about the future of Drupal core.

    On the first day there were two sessions essentially about managing content and configuration in Drupal. They focused on the differences, similarity and possible solutions for moving content and configuration around and between sites.

  • Boosting Solr search results at query-time

    Boosting terms in Solr search results produced by the Apache Solr Search module that integrates Solr with Drupal is something we had to do for a project recently. If a user has come to our website from a search engine, we can pick up the terms that they had originally searched for - and then boost any documents containing those terms in our own search pages, regardless of what they search for on our pages.

  • Drupalcon Chicago - Keynote - Dries Buytaert

    Dries kicked off another Drupalcon today by giving his keynote presentation to the community. If you missed it then you can view it on the Drupalcon website but read on for my summary and thoughts.

    Dries has been doing these keynotes for a while now, and every one gets better and more polished. Today's was no exception. Dries summarised the process of Drupal 7 development and suggested changes and improvements to the Drupal 8 development workflow. He also outlined some of his priorities for Drupal 8.

Pages

Subscribe to Drupal code