The 9th PHPNW was held on the 1st and 2nd of October 2016 and I was in attendance with around 400 people. The venue was the Manchester Conference Centre, which is where the event has been for the past few years. It's a nice place with helpful and friendly staff, lots of rooms, great food and even a good bar. After a quick introduction from the organizers Jeremy Coates and Rick Ogden) and a session from the platinum sponsors UKFast we started the conference proper.
The European DrupalCon was held in Dublin from 26th - 30th September and I went along with a couple of colleagues to learn a few things about Drupal. I have been back from the conference for a few days now, and I wanted to write down some of the highlights of the conference in a blog post. There is a lot going on at DrupalCon and with 2000+ people, 3 full days of sessions, 2 tutorial days, multiple parties and over 10,000 cups of coffee consumed there is too much to write about here.
I was recently asked to implement a feature on a Drupal site where all nodes of a certain type would redirect to a main listing page if that node had been unpublished. The problem in doing this is that if a post is unpublished then Drupal will issue an access denied response quite early on in the boot process. When the menu item is loaded it goes through an access callback which sees that the post is unpublished and issues an access denied before anything else can happen. So in this situation you can't use things like Rules to redirect users as the rule is never triggered.
To find out if the current user is anonymous use the following.
This can be used as part of an if statement like this:
To get the currently selected language on a Drupal 8 site you need to run the following.
When creating re-usable theme templates in Drupal 8 it's quite easy to include that template by using the following snippet.
DrupalCamp London, now in it's 4th year, was held of the weekend of the 4th, 5th and 6th of March at The University of London campus in London. Myself and a few other developers from Manchester headed down for the weekend to attend. I wasn't able to attend the CXO day on the 4th, but we were all in attendance for the camp event.
When overriding theme functions in Drupal 7 you would normally copy the theme function into the template.php and alter it to suit your needs. This isn't always convenient though, especially if you are trying to abstract functionality into modules and not have code in your theme layer that is reliant on module code. If you add theme override functions to your module files then they won't do anything as Drupal isn't looking for them there and won't pick them up.
DNS records, as many of you will already know, are commonly used to translate a human readable address into an IP address. This means that instead of visiting a website by typing in it's IP address you can just type in the easy to remember DNS address. I won't talk too much about how DNS records work here, but if you want to know more then you can read the awesome and easy to understand how DNS works commic.
DrupalCamp Scotland 2015 consisted of a Friday training day, followed by a day of talks and sessions on the 6th and 7th November.
The training day was based around Drupal 8 and had us looking at installation, configuration, and development. In the morning we set up a couple of Docker containers (on a Digital Ocean box) to run Drupal 8 from and then looked at the Drupal command line tool when setting up the system. Once installed we looked at the system structure and how the configuration management system worked. In the afternoon we created modules and themes, also using the Drupal console to generate some of the code fragments. I think the use of Docker on a remote server was a good idea in getting everyone up and running on the system without having to rely on local LAMP stacks or whatever. The training day was really good and I was able to swap lots of ideas and techniques with the trainers and other attendees.