Reroute Email module uses hook_mail_alter() to prevent emails from being sent to users from non-production sites. It allows you to enter one or more email addresses that will receive the emails instead of delivering them to the original user.
-
Reroute Email module uses hook_mail_alter() to prevent emails from being sent to users from non-production sites. It allows you to enter one or more email addresses that will receive the emails instead of delivering them to the original user.
-
-
-
This is useful in case where you do not want email sent from a Drupal site to reach the users. For example, if you copy a live site to a test site for the purpose of development, and you do not want any email sent to real users of the original site. Or you want to check the emails sent for uniform formatting, footers, ...etc.
-
-
-
As we don't need the module configured on production (we don't need to reroute any emails there), it's best to do this in code using settings.local.php (if you have one) or the standard settings.php file.
-
-
The first thing that we need to do is to enable rerouting. Without doing this, nothing will happen.
-
-
$conf['reroute_email_enable'] = TRUE;
-
-
-
The next option is to whether to show rerouting description in mail body. I usually have this enabled. Set this to TRUE or FALSE depending on your preference.
-
-
$conf['reroute_email_enable_message'] = TRUE;
-
-
-
The last setting is the email address to use. If you're entering a single address, you can add it as a simple string.
In this example, all emails from the site will be rerouted to person1@example.com.
-
-
If you want to add multiple addresses, these should be added in a semicolon-delimited list. Whilst you could add these also as a string, I prefer to use an array of addresses and the implode() function.
In this example, person2@example.com and person3@example.com would receive their emails from the site as normal. Any emails to addresses not in the array would continue to be redirected to person1@example.com.
Style Drupal 6's Taxonomy Lists with PHP, CSS and jQuery
-
-
5th April 2010
-
-
Whilst developing this, and other Drupal websites for clients, I decided that I wanted to categorise content using the taxonomy system. However, I wasn't happy with the way that Drupal displayed the terms lists by default, and I started comparing this to other websites that I look at.
-
-
To start with, I wanted to have something that described what the list was displaying - like in the second example above. I wanted to have the words 'Posted in' displayed before the list of terms. To do this, I had to edit the node template file that exists within my theme folder (sites/all/themes). As I only wanted this change to affect my Blog posts, the file that I needed to change is node-blog.tpl.php
-
-
I scrolled down until I found the piece of code that displayed the terms list:
I created a file named script.js in my theme folder with the following code in it. After clearing Drupal's caches, this file is automatically recognised by Drupal 6.
This code finds the last item in the list, uses .prev to select the one before it, and then uses .addClass to assign it the HTML class of "test". We can then use this class to target it with specific CSS.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Whilst working on my own portfolio/testimonial website, I decided to have a portfolio page displaying the name of each site and a thumbnail image. For this Blog post, I'll be using a site called Popcorn Strips which I built for a friend earlier this year as an example.
-
-
I created a content type called 'Project' with a CCK ImageField called 'Screenshot'. I created a project called Popcorn Strips, used the ScreenGrab add-on for Mozilla Firefox to take a screenshot of the website, and uploaded it to the project node.
-
-
I created a View to display the published projects, and an ImageCache
-preset to create the thumbnail image by scaling and cropping the image
-to a size of 200x100 pixels.
-
-
Although, this automatically focused the crop on the centre of the image, whereas I wanted to crop from the top and left of the image - showing the site's logo and header.
-
-
I installed the ImageCrop module, which add a jQuery crop function to the standard ImageCache presents. I removed the original Scale and Crop action and replaced it with a Scale action with a width of 200px.
-
-
I then added a new 'Javascript crop' action with the following settings:
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
I created a new Webform to serve as a simple Contact form, but left the main configuration until after I created the form components. I added 'Name', 'Email', 'Subject' and 'Message' fields, as well as a 'Category' select list. Below 'Options', I entered each of my desired options in the following format:
-
-
Email address|Visible name
-
-
-
I went back to the form configuration page and expanded 'Conditional Email Recipients', and selected my Category. Note that the standard 'Email To' field above it needs to be empty. Originally, I made the mistake of leaving addresses in that field which resulted in people being sent emails regardles of which category was selected. I then configured the rest of the form.
-
-
Then, when I went to the finished form, the category selection was available.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
If you use the Zen theme, then you should also be using the Zenophile module!
-
-
The Zenophile module allows you to very quickly create Zen subthemes from within your web browser, as well as editing options such as the site directory where it should be placed, the layout type (fixed or fluid), page wrapper and sidebar widths, and the placement of the sidebars.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Create a Slideshow of Multiple Images Using Fancy Slide
-
-
25th May 2010
-
-
Whilst updating my About page, I thought about creating a slideshow of several images instead of just the one static image. When I looking on Drupal.org, the only slideshow modules were to create slideshows of images that were attached to different nodes - not multiple images attached to one node. Then, I found the Fancy Slide module. It's a jQuery Slideshow module with features that include integration with the CCK, ImageCache and Nodequeue modules.
-
-
I added an CCK Image field to my Page content type, and set the number of values to 3, then uploaded my images to the Page.
-
-
Once the Images were added, I went to the Fancy Slide settings page and created the slideshow.
-
-
I added the dimensions of my images, the type of animation, specified the node that contained the images, the slideshow field, delay between slides and transition speed. With the slideshow created, it now needed embedding into the page.
-
-
I added the following code into my About page, as described in the Fancy Slide readme.txt file - the number representing the ID of the slideshow.
-
-
<?php print theme('fancy_slide', 1); ?>
-
-
-
In my opinion, this adds a nice effect to the About page. I like it because it's easy to set up, and easy to add additional images later on if required.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Quickly Import Multiples Images Using the Imagefield_Import Module
-
-
29th May 2010
-
-
Thanks to Bob at Mustardseed Media for tweeting about this module. It's undoubtedly saved me hours of work today alone!
-
-
I've recently started a personal project converting a website to Drupal. It's currently a static HTML/CSS site which also uses the Coppermine Photo Gallery. As part of building the new website, I wanted to move all the photos from the existing site onto the new one. However, with 1260 photos in 17 albums, this could have been a lengthy process!
-
-
I created a new Drupal-powered Gallery as described in this screencast by Jeff Eaton - using the CCK and Imagefield modules, and re-created each of my existing Gallery nodes. Using the Imagefield_Import module, I was then able to quickly import the photos into the new Galleries.
-
-
I downloaded all the photos from the previous Gallery via FTP, and installed and configured the Imagefield_Import module.
-
-
I created an 'Import' folder, selected the target field and mode. In this case, I want each image to be imported into its own Photo node. I moved the photos for the first album into the Import folder, and loaded the 'Import Images' screen (admin/content/imagefield_import).
-
-
After clicking 'Import', a node is created for each photo, the image is uploaded, and added to the selected Gallery.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Whilst uploading images for my Projects and Testimonials sections, I noticed that the Imagecache-scaled images weren't as high a quality the originals on my Mac. I did some searching online and found out that, by default, Drupal resamples uploaded jpgs to 75% of their original quality.
-
-
To increase the quality of your images, change the setting in the two following places:
-
-
-
admin/settings/imageapi/config
-
admin/settings/image-toolkit
-
-
-
The first one is for ImageAPI. Primarily, this means Imagecache presets. The second one is for core's image.inc. This is used for resizing profile pictures in core, and some contrib modules. Once changed, I did have to flush each of the Imagecache presets (admin/build/imagecache) for the changes to take effect.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Create a Block of Social Media Icons using CCK, Views and Nodequeue
-
-
23rd June 2010
-
-
I recently decided that I wanted to have a block displayed in a sidebar on my site containing icons and links to my social media profiles - Twitter, Facebook etc. I tried the Follow module, but it lacked the option to add extra networks such my Drupal.org account, and my RSS feed. I started to create my own version, and then found this Blog post by Hank Palan.
-
-
I created a 'Social icon' content type with the body field removed, and with fields for a link and image - then downloaded the favicons from the appropriate websites to use.
-
-
However, instead of using a custom template (node-custom.tpl.php) file, I used the Views module.
-
-
I added fields for the node titles, and the link from the node's content. Both of these are excluded from being displayed on the site. I then re-wrote the output of the Icon field to create the link using the URL, and using the node's title as the image's alternative text and the link's title.
-
-
I also used the Nodequeue module to create a nodequeue and arrange the icons in the order that I wanted them to be displayed. Once this was added as a relationship within my View, I was able to use node's position in the nodequeue as the sort criteria.
-
-
To complete the process, I used the CSS Injector module to add some additional CSS styling to position and space out the icons.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Aside from the obvious candidates such as Views, CCK etc, here are a list of 10 contributed modules that I currently use on each Drupal project.
-
-
So, in no particular order:
-
-
-
Admin: The admin module provides UI improvements to the standard Drupal admin interface. I've just upgraded to the new 6.x-2.0-beta4 version, and installed the newly-required Rubik/Tao themes. So far, so good!
-
Better Permissions/Filter Permissions: Basic permissions is a basic module which enhances the Drupal Permissions page to support collapsing and expanding permission rows. Filter permissions provides filters at the top of the Permissions page for easier management when your site has a large amount of roles and/or permissions.
-
Better Formats: Better formats is a module to add more flexibility to Drupal's core input format system.
-
Clone module: Allows users to make a copy of an existing item of site content (a node) and then edit that copy.
-
Vertical Tabs: Integrated into Drupal 7 core, this module adds vertical tabs to the node add and edit forms.
-
Context: Context allows you to manage contextual conditions and reactions for different portions of your site. You can think of each context as representing a "section" of your site. For each context, you can choose the conditions that trigger this context to be active and choose different aspects of Drupal that should react to this active context.
Module Filter: What this module aims to accomplish is the ability to quickly find the module you are looking for without having to rely on the browsers search feature which more times than not shows you the module name in the 'Required by' or 'Depends on' sections of the various modules or even some other location on the page like a menu item.
Add Another: Add another displays a message after a user creates a node, and/or displays an "Add another" tab on nodes allowing them to make another node of the same type. You can control what roles and node types see this feature.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
The first thing that I did was to create a content type to store my imported images. I named it 'Photo', removed the Body field, and added an Image field.
-
-
Next, I installed and configured the Feeds and Image Grabber module. I used an overridden default Feed to import my photos from Flickr using the following settings:
-
-
-
Basic settings: I changed the Refresh time to 15 minutes.
-
Processor settings: I changed the content type to 'Photo', and the author's name from 'anonymous'.
-
Processor mapping: I added a new mapping from 'Item URL (link)' to 'Photo (FIG)'. The Photo FIG target is added by the Image Grabber module.
-
-
-
Next, I needed to create the actual Feed, which I did by clicking 'Import' within the Navigation menu, and clicking 'Feed'. I gave it a title, entered the URL to my RSS feed from Flickr, and enabled the Image Grabber for this feed.
-
-
Once the Feed is created, the latest 20 images from the RSS feed are imported and 20 new Photos nodes are created. In the example below, the image with the 'Photo' label is the Image field mapped by the Image Grabber module. It is this image that I'll be displaying within my Gallery.
-
-
With the new Photo nodes created, I then created the View to display them.
-
-
The View selects the image within the Photo content type, and displays in it a grid using an ImageCache preset. The View is limited to 20 nodes per page, and uses a full pager if this is exceeded. The nodes are sorted by the descending post date, and filtered by whether or not they are published, and only to include Photo nodes.
-
-
As an additional effect, I also included the 'Feeds Item - Item Link' field, which is basically the original link from the RSS feed. By checking the box the exclude the item from the display, it is not shown, but makes the link available to be used elsewhere. By checking the box 'Re-write the output for this field' on the 'Content: Photo' field, I was able to add the replacement token (in this case, [url]) as the path for a link around each image. This meant that when someone clicked a thumbnail of a photo, they were directed to the Flickr website instead of the node within my Drupal site.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Change the Content Type of Multiple Nodes Using SQL
-
-
1st July 2010
-
-
In this post, I will be changing values within my Drupal 6 site's database to quickly change the content type of multiple nodes. I will be using a test development site with the core Blog module installed, and converting Blog posts to a custom content type called 'News article'.
-
-
Before changing any values within the database, ensure that you have an up-to-date backup which you can restore if you encounter a problem!
-
-
To begin with, I created the 'News article' content type, and then used the Devel Generate module to generate some Blog nodes.
Using an SQL 'Update' command, I can change the type value from 'blog' to 'article'. This will change every occurance of the value 'blog'. If I wanted to only change certain nodes, I could add a 'Where' clause to only affect nodes with a certain nid or title.
-
-
Now, when I query the database, the type is shown as 'article'.
-
-
Now, when I go back into the administration section of my site and view the content, the content type now shows at 'News article'.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Create Virtual Hosts on Mac OS X Using VirtualHostX
-
-
2nd July 2010
-
-
This isn't a Drupal related topic per se, but it is a walk-through of one of the applications that I use whilst doing Drupal development work. I assume, like most Mac OS X users, I use MAMP to run Apache, MySQL and PHP locally whilst developing. I also use virtual hosts in Apache to create local .dev domains which are as close as possible to the actual live domains. For example, if I was developing a site called mysite.com, my local development version would be mysite.dev.
-
-
Normally, I would have to edit the hosts file and Apache's httpd.conf file to create a virtual host. The first to set the domain and it's associated IP address, and the other to configure the domain's directory, default index file etc. However, using VirtualHostX, I can quickly create a virtual host without having to edt any files. Enter the virtual domain name, the local path and the port, and apply the settings. VirtualHostX automatically restarts Apache, so the domain is ready to work straight away. You can also enter custom directives from within the GUI.
-
-
There's also an option to share the host over the local network. Next, I intend on configuring a virtual Windows PC within VMware Fusion to view these domains so that I can do cross-browser testing before putting a site live.
-
-
I ensured that my Apache configuration within MAMP was set to port 80, and that VirtualHostX was using Apache from MAMP instead of Apple's built-in Apache.
-
-
Note: One problem that I had after setting this up, was that I was receving an error when attempting to open a Drupal website which said 'No such file or directory'.
-
-
After some troubleshooting, I found out that Web Sharing on my Mac had become enabled (I don't know why, I've never enabled it), and that this was causing a conflict with Apache. Once I opened my System Preferences and disabled it, everything worked fine!
-
-
This, along with MAMP, Coda, Sequel Pro, and Transmit, has become an essential tool within my development environment.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
In preparation for my Blog posts being added to Drupal Planet, I needed to create a new Taxonomy term (or, in this case, tag) called 'Drupal Planet', and assign it to new content to imported into their aggregator. After taking a quick look though my previous posts, I decided that 14 of my previous posts were relevant, and thought that it would be useful to also assign these the 'Drupal Planet' tag.
-
-
I didn't want to manually open each post and add the new tag, so I decided to make the changes myself directly into the database using SQL, and as a follow-up to a previous post - Quickly Change the Content Type of Multiple Nodes using SQL.
-
-
Again, before changing any values within the database, ensure that you have an up-to-date backup which you can restore if you encounter a problem!
-
-
The first thing I did was create the 'Drupal Planet' term in my Tags vocabulary. I decided to do this via the administration area of my site, and not via the database. Then, using Sequel Pro, I ran the following SQL query to give me a list of Blog posts on my site - showing just their titles and nid values.
-
-
SELECT title, nid FROM node WHERE TYPE = 'blog' ORDER BY title ASC;
-
-
-
I made a note of the nid's of the returned nodes, and kept them for later. I then ran a similar query against the term_data table. This returned a list of Taxonomy terms - showing the term's name, and it's unique tid value.
-
-
SELECT NAME, tid FROM term_data ORDER BY NAME ASC;
-
-
-
The term that I was interested in, Drupal Planet, had the tid of 84. To confirm that no nodes were already assigned a taxonomy term with this tid, I ran another query against the database. I'm using aliases within this query to link the node, term_node and term_data tables. For more information on SQL aliases, take a look at http://w3schools.com/sql/sql_alias.asp.
-
-
SELECT * FROM node n, term_data td, term_node tn WHERE td.tid = 84 AND n.nid = tn.nid AND tn.tid = td.tid;
-
-
-
As expected, it returned no rows.
-
-
The table that links node and term_data is called term_node, and is made up of the nid and vid columns from the node table, as well as the tid column from the term_data table. Is it is here that the additional rows would need to be entered.
-
-
To confirm everything, I ran a simple query against an old post. I know that the only taxonomy term associated with this post is 'Personal', which has a tid value of 44.
-
-
SELECT nid, tid FROM term_node WHERE nid = 216;
-
-
-
Once the query had confirmed the correct tid value, I began to write the SQL Insert statement that would be needed to add the new term to the required nodes. The nid and vid values were the same on each node, and the value of my taxonomy term would need to be 84.
-
-
Once this had completed with no errors, I returned to the administration area of my Drupal site to confirm whether or not the nodes had been assigned the new term.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
As a heavily-reliant Quicksilver user on my MacBook Pro, I was glad when I found the Teleport module for Drupal(due to Elliott Rothman's tweet).
-
-
When you press a configurable hot-key, a jQuery dialog box appears where you can search for nodes by title or path, or directly enter the path that you want to navigate to. This will greatly reduce the number of clicks that I need to perform to get to my desired page - even compared to the Admin and Administration Menu modules.
-
-
Although it's not a new module (the first commits were 2 years ago), I hope that they are still planning on achieving the list of future directions listed on their Drupal.org project page:
-
-
-
Make interface act more like Quicksilver (i.e. you should only have to press Enter once to launch)
-
'Actions' like Quicksilver: if you select a node, a second input should appear with options to go to the View page, Edit page, (un)publish, etc. Same with users.
-
Hook into more non-node content, like taxonomy terms and functions in the API module.
-
-
-
Personally, this will make navigation around both the front-end and administration area of my Drupal sites so much easier.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Sorry for the lack of Blog posts lately, but my new job that I started a few weeks ago has certainly been keeping me busy! I've got a few more posts that I'm preparing content for, and I'll hopefully be back into my weekly-post routine before too long!
-
-
Today, I'd like to just give a quick overview of the Admin:hover module. It basically adds an administrative menu that pops up when you hover over a node or block within your Drupal website - the kind of functionality that was present within previous versions of the Admin module. It also integrates well with the Devel and Clone modules.
-
-
I've found this to be extremely useful whilst working on photo galleries etc. where multiple nodes are displayed in a grid format and I quickly need to publish or unpublish something for testing purposes. No longer do I need to open each node, or go into the administration area to perform the required actions.
-
-
It is also possible to customise which links are available from within the adminstration area. The possible selections that I currently have on this site are as follows:
-
-
Node links:
-
-
-
Edit
-
Publish
-
Unpublish
-
Promote
-
Unpromote
-
Make sticky
-
Make unsticky
-
Delete
-
Clone
-
Dev load
-
View author
-
Edit author
-
Add
-
-
-
Block links:
-
-
-
Configure block
-
Add block
-
-
-
Although, as I have additional contributed modules installed, some of these may not neccassaily be available out of the box.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Recently, I converted a client's static HTML website, along with their Coppermine Photo Gallery, into a Drupal-powered website.
-
-
Over the next few posts, I'll be replicating the process that I used during the conversion, and how I added some additional features to my Drupal gallery.
-
-
To begin with, I created my photo gallery as described by Jeff Eaton in this screencast, downloaded all my client's previous photos via FTP, and quickly added them into the new gallery using the Imagefield Import module (which I mentioned previously).
-
-
When I compare this to the previous gallery, I can see several differences which I'd like to include. The first of which is the number of photos in each gallery, and the date that the most recent photo was added.
-
-
To do this, I'd need to query my website's database. To begin with, I wanted to have a list of all the galleries on my site which are published, and what they're unique node ID values are. To do this, I opened Sequel Pro and entered the following code:
-
-
SELECT title
-AS title, nid
-AS gallery_idFROM node
-WHERE type = 'gallery'
-AND status = 1;
-
-
-
As the nid value of each gallery corresponds with the 'field_gallery_nid' field within the content_type_photo field, I can now query the database and retrieve information about each specific gallery.
-
-
For example, using aliasing within my SQL statement, I can retrieve a list of all the published photos within the 'British Squad 2008' gallery by using the following code:
I can easily change this to count the number of published nodes by changing the first line of the query to read SELECT COUNT(*).
-
-
SELECT COUNT(*)
-FROM node n, content_type_photo p
-WHERE p.field_gallery_nid = 105
-AND n.status = 1
-AND n.nid = p.nid;
-
-
-
As I've used the Views Attach module, and I'm embedding the photos directly into the Gallery nodes, I easily add this to each gallery by creating a custom node-gallery.tpl.php file within my theme. I can then use the following PHP code to retrieve the node ID for that specific gallery:
-
-
<?php
-$selected_gallery = db_result(db_query("
-SELECT nid
-FROM {node}
-WHERE type = 'gallery'
-AND title = '$title'
-"));
-?>
-
-
-
I can then use this variable as part of my next query to count the number of photos within that gallery, similar to what I did earlier.
Next, I wanted to display the date that the last photo was displayed within each album. This was done by using a similar query that also sorted the results in a descending order, and limited it to one result - effectively only returning the created date for the newest photo.
-
-
<?php
-$latest_photo = db_result(db_query("
-SELECT n.created
-FROM {node} n, {content_type_photo} p
-WHERE p.field_gallery_nid = $selected_gallery
-AND n.nid = p.nid
-ORDER BY n.created DESC LIMIT 1
-"));
-?>
-
-
-
This was all then added into a 'print' statement which displayed it into the page.
-
-
<?php
-if ($selected_gallery_total != 0) {
- $output = '<i>There are currently ' . $selected_gallery_total . ' photos in this gallery.';
- $output .= 'Last one added on ' . $latest_photo . '</i>';
- print $output;
-}
-?>
-
-
-
OK, so let's take a look at the Gallery so far:
-
-
You will notice that the returned date value for the latest photo added is displaying the UNIX timestamp instead of in a more readable format. This can be changed by altering the 'print' statement to include a PHP 'date' function:
-
-
<?php
-if ($selected_gallery_total != 0) {
- $output = '<i>There are currently ' . $selected_gallery_total . ' photos in this gallery.';
- $output .= 'Last one added on ' . date("l, jS F, Y", $latest_photo) . '.</i>';
- print $output;
-}
-?>
-
-
-
The values that I've entered are from this page on PHP.net, and can be changed according on how you want the date to be displayed.
-
-
As I've added all of these photos today, then the correct dates are being displayed. However, on the client's original website, the majority of these photos were pubished several months or years ago, and I'd like the new website to still reflect the original created dates. As opposed to modifying each individual photograph, I'll be doing this in bulk in my next post.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
At the end of my last post, I'd finished creating the first part of the new photo gallery, but I wanted to change the dates of the published photos to reflect the ones on the client's original website.
-
-
Firstly, I'll refer to the previous list of published galleries that I created before, and create something different that also displays the created and modified dates. Picking the node ID of the required gallery, I used the following SQL query to display a list of photos.
When I look back at the old photo gallery, I can see that the previous 'last added' date was June 27, 2008. So, how do I update my new photos to reflect that date? Using http://www.onlineconversion.com/unix_time.htm, I can enter the required date in its readable format, and it will give me the equivilent UNIX timestamp. To keep things relatively simple, I'll set all photos within this gallery to the same time.
-
-
The result that I'm given is '1217149200'. I can now use an UPDATE statement within another SQL query to update the created and modified dates.
Now when I query the database, both the created and modified databases have been updated, and when I return to the new photo gallery, the updated value is being displayed.
-
-
Once the changes have been applied, it's a case of repeating the above process for each of the required galleries.
-
-
In the next post, I'll explain how to add a count of published galleries and photos on the main photo gallery page, as well as how to install and configure the Shadowbox module.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Up until as recent as last week, whenever I added an image into one of my Blog posts, I was manually adding the caption below each image and styling it accordingly. That was until I installed the Image Caption module.
-
-
The Image Caption module uses jQuery to dynamically add captions to images. Here is a walkthrough of the process that I followed to install and configure the module. As always, I used Drush to download and enable the module, then visited the Image Caption Settings page (admin/settings/image_caption). Here, I select which node types should be included in image captioning. In my case, I only wanted this to apply to Blog posts.
-
-
As I use the FileField, ImageField and Insert modules to add images to my posts, as opposed to via a WYSIWYG editor, I'm able to add the CSS class of 'caption' to my images.
-
-
Now, all images inserted this way will have the CSS class of 'caption'.
-
-
As the Image Caption module uses the image's title tag to create the displayed caption, I enabled the custom title text for my Image field so that when I upload an image, I'm prompted to enter text for the caption.
-
-
This results in a span called image-caption-container around the inserted image, and a caption below it called image-caption containing the text.
-
-
All that's left is to style these classes within your CSS stylesheet.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
To begin with, a download a fresh copy of Drupal 6.19 and created a copy of the original user.pages.inc file. Within the duplicate file, I made the same changes to the function that I did in earlier code, and saved the changes. Now, within my Terminal, I can navigate to Drupal's root directory and create the patch.
There is also a Git patch creation workflow, which is described at http://groups.drupal.org/node/91424. Thanks to Randy Fay for making me aware of this, and suggesting a slight change to my original patch creation command.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
The next part of the new gallery that I want to implement is to group the galleries by their respective categories. The first step is to edit my original photo_gallery view and add an additional display.
-
-
I've called it 'Taxonomy', and it's similar to the original 'All Galleries' view. The differences are that I've added the taxonomy term as an argument, removed the header, and updated the path to be gallery/%. The other thing that I need to do is overwrite the output of the original 'All Galleries' View by creating a file called views-view--photo-gallery--page-1.tpl.php and placing it within my theme directory.
-
-
Within that file, I can remove the standard content output. This still outputs the heading information from the original View. I can now use the function called 'views_embed_view' to embed my taxonomy display onto the display. The views_embed_view function is as follows:
To reduce the amount of code needed, I can use the following 'while' loop to generate the same code for each taxonomy term. It dynamically retrieves the relevant taxonomy terms from the database, and uses each name as the argument for the view.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Create a Better Photo Gallery in Drupal - Part 2.1
-
-
22nd October 2010
-
-
Today, I realised that I hadn't published the code that I used to create the total figures of galleries and photos at the top of the gallery (I said at the end of Part 2 that I'd include it in Part 3, but I forgot). So, here it is:
-
-
<?php
-
-// Queries the database and returns a list of nids of published galleries.
-$galleries = db_query("SELECT nid FROM {node} WHERE type = 'gallery' AND status = 1");
-// Resets the number of photos.
-$output = 0;
-// Prints a list of nids of published galleries.
-while($gallery = db_fetch_array($galleries)) {
- $gallery_id = $gallery['nid'];
- $photos = $photos + db_result(db_query("SELECT COUNT(*) FROM node n, content_type_photo ctp WHERE n.status = 1 AND n.type = 'photo' AND ctp.field_gallery_nid = $gallery_id AND n.nid = ctp.nid"));
-}
-
-// Prints the output.
-print 'There ';
-if($photos == 1) {
- print 'is';
-}
-else {
- print 'are';
-}
-print ' currently ';
-print $photos . ' ';
-if($photos == 1) {
- print 'photo';
-}
-else {
- print 'photos';
-}
-print ' in ';
-
-// Counts the number of published galleries on the site.
-$galleries = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE TYPE = 'gallery' AND STATUS = 1"));
-
-// Prints the number of published galleries.
-print $galleries;
-if ($galleries == 1) {
- print ' gallery';
-}
-else {
- print ' galleries';
-}
-print '.';
-?>
-
-
-
It was applied to the view as a header which had the input format set to PHP code.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Use Regular Expressions to Search and Replace in Coda or TextMate
-
-
4th November 2010
-
-
As in the original post, I'd generated a list of node ID values, and needed to add structure the SQL update statment formatted in a certain way. However, I changed my inital query slightly to out put the same nid value twice.
-
-
SELECT nid, nid FROM node WHERE TYPE = 'blog' ORDER BY nid ASC;
-
-
-
Then, I could select all of the returned rows, copy the values, and paste them into Coda:
-
-
As before, I needed my SQL update statement to be in the following format:
-
-
INSERT INTO term_node VALUE (nid, vid, tid), (nid2, vid2, tid);
-
-
-
As I mentioned previously, the nid and vid values are the same for each node, and the tid will remain constant. In this case, the tid value that I needed to use was '63'.
-
-
So, using the 'Find and Replace' function within Coda, combined with regular expressions (regex), I can easily format the values as needed. To begin with, I need to ensure that the RegEx search option is enabled, and that I'm using the correct escape character.
-
-
The first thing that I wanted to do was add the seperating comma between the two values. To do this, I
-perform a search for \s*\t. This searches for everything that is whitespace AND is a tab value. I can then add the comma as the replacement for each result.
-
-
All 31 lines have been changed.
-
-
Next, I can use \n to target the lines between the rows. I'll replace it with the next comma, the number 63 (the tid value), the closing bracket, another comma, re-add the line and add the opening bracket.
-
-
The only two lines that aren't changed are the first and last, as they don't have any line breaks following them. I can complete these lines manually. Now all I need to do is add the beginning of the SQL update statement, then copy and paste it into Sequel Pro.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Easily Embed TypeKit Fonts into your Drupal Website
-
-
14th February 2011
-
-
To begin with, you will need to register for a TypeKit account - there is a free version if you just want to try it out.
-
-
Next, you'll need to create a kit that contains the fonts that you want to use on your website. I've used FF Tisa Web Pro.
-
-
Under 'Kit Settings', ensure that your website domain (e.g. mysite.com) is listed under 'Domains'.
-
-
Download and install the @font-your-face module onto your Drupal site, and to go admin/settings/fontyourface to configure it. Enter your TypeKit API key, and click 'Import Typekit' to import your kits and fonts.
-
-
Go to admin/build/themes/fontyourface, and click 'Browse fonts to enable'. Click on the name of the font that you want to enable, check 'Enabled', and click 'Edit font' to save your changes.
-
-
With the font enabled, you can now use it in your CSS.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Replace the $page_id value with your Page ID number (unless you want to show the number of fans for this site).You can find your Page ID by logging into your Facebook account, going to 'Adverts and Pages', clicking 'Edit page', and looking at the URL.
I've also wrapped the output in a number_format() function so that it properly formatted with commas etc - like where I've used it within the Gold Event listing on the Horse & Country TV website.
-
-
$page_id = "143394365692197";
-$xml = @simplexml_load_file("http://api.facebook.com/restserver.php?method=facebook.fql.query&query=SELECT%20fan_count%20FROM%20page%20WHERE%20page_id=".$page_id."") or die ("a lot");
-$fans = $xml->page->fan_count;
-print number_format($fans);
-
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
2 weeks ago, I handed in my notice of resignation to Horse & Country TVbecause I've been offered a new role at Proctor & Stevenson - a Marketing Design and Communications agency in Bristol.
-
-
Proctors have an extensive client list - including BMW, Panasonic, the Open University and VOSA, and it's going to be a fantastic opportunity for me to continue expanding my skillset whilst gaining vital experience.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
I've finally uploaded my first module onto Drupal.org!
-
-
I've written many custom modules, although the vast majority of them are either small tweaks for my own sites, or company/site-specific modules that wouldn't be good to anyone else, so there would be nothing achieved by contributing them back to the community. Previously, I've blogged about the Imagefield Import module - a module that I use on a number of sites, both personal and for clients - and what I've looked for lately is for a way to speed up the process again. Gathering my images together and manually copying them into the import directory takes time - especially if I'm working somewhere with a slow Internet connection and I'm FTP-ing the images into the directory. Also, it's not always the easiest solution for site users - especially non-technical ones.
-
-
So, I wrote the Imagefield Import Archive module. Including comments, the module contains 123 lines, and builds upon the existing functionality of the Imagefield Import module by adding the ability for the user to upload a .zip archive of images. The archive is then moved into the specified import directory and unzipped before being deleted, and the user is directed straight to the standard Imagefield Import page where their images are waiting to be imported, just as usual.
-
-
The module is currently a sandbox project on Drupal.org, although I have applied for full project access so that I can be added as a fully-fledged downloadable module.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Create Multigroups in Drupal 7 using Field Collections
-
-
28th August 2011
-
-
One of my favourite things lately in Drupal 6 has been CCK 3, and more specifically, the Content Multigroups sub-module. Basically this allows you to create a fieldset of various CCK fields, and then repeat that multiple times. For example, I use it on this site whist creating invoices for clients. I have a fieldset called 'Line Item', containing 'Description', 'Quantity' and 'Price' fields. With a standard fieldset, I could only have one instance of each field - however, using a multigroup, I can create multiple groups of line items which I then use within the invoice.
-
-
But at the time of writing this, there is no CCK 3 version for Drupal 7. So, I created the same thing using Field Collection and Entity modules.
-
-
With the modules uploaded and enabled, go to admin/structure/field-collections and create a field collection.
-
-
With the module enabled, you can go to your content type and add a Field Collection field. By default, the only available Widget type is 'Hidden'.
-
-
Next, go to admin/structure/field-collections and add some fields to the field collection - the same way that you would for a content type. For this collection is going to contain two node reference fields - Image and Link.
-
-
With the Field Collection created, I can now add it as a field within my content type.
-
-
Whilst this works perfectly, the field collection is not editable from the node edit form. You need to load the node, and the collection is displayed here with add, edit, and delete buttons. This wasn't an ideal solution, and I wanted to be able to edit the fields within the collection from the node edit form - the same way as I can using multigroups in Drupal 6.
-
-
After some searching I found a link to a patch which when applied adds a 'subform' widget type to the field collection field and allows for it to be embedded into, and editable from within the node form. Going back to the content type fields page, and clicking on 'Hidden' (the name of the current widget), I can change it to subform and save my changes.
-
-
With this change applied, when I go back to add or edit a node within this content type, my field collection will be easily editable directly within the form.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
How to Install and Configure Subversion (SVN) Server on Ubuntu
-
-
19th October 2011
-
-
Recently, I needed to set up a Subversion (SVN) server on a Ubuntu Linux server. This post is going to outline the steps taken, and the commands used, to install and configure the service.
-
-
Note: As I was using Ubuntu, I was using the 'apt-get' command to download and install the software packages. If you're using a different distribution of Linux, then this command may be different. I'm also assuming that Apache is already installed.
-
-
Firstly, I'm going to ensure that all of my installed packages are up to date, and install any available updates.
-
-
$ sudo apt-get update
-
-
-
Now, I need to download the subversion, subversion-tools and libapache2 packages.
These are all of the packages that are needed to run a Subversion server.
-
-
Create subversion directory
-
-
Now, I need to create the directory where my repositories are going to sit. I've chosen this directory as I know that it's one that is accessible to my managed backup service.
-
-
$ sudo mkdir /home/svn
-
-
-
Create a test repository
-
-
First, I'll create a new folder in which I'll create my test project, and then I'll create a repository for it.
This both adds and commits these new directories into the repository.
-
-
In order for Apache to access the SVN repositories, the /home/svn directory needs to be owned by the same user and group that Apache runs as. In Ubuntu, this is usually www-data. To change the owner of a directory, use the chown command.
-
-
$ sudo chown -R www-data:www-data /home/svn
-
-
-
Configuring Apache
-
-
The first thing that I need to do is enable the dav_svn Apache module, using the a2enmod command.
-
-
$ sudo a2enmod dav_svn
-
-
-
With this enabled, now I need to modify the Apache configuration file.
-
-
$ cd /etc/apache2
-$ sudo nano apache2.conf
-
-
-
At the bottom of the file, add the following lines, and then save the file by pressing Ctrl+X.
With this saved, restart the Apache service for the changes to be applied.
-
-
sudo service apache2 restart
-
-
-
I can now browse through my test repository by opening Firefox, and navigating to http://127.0.0.1/svn/test. Here, I can now see my three directories, although they are currently all empty.
-
-
-
-
Securing my SVN repositories
-
-
Before I start committing any files to the test repository, I want to ensure that only authorised users can view it - currently anyone can view the repository and it's contents, as well as being able to checkout and commit files. To do this, I'm going to require the user to enter a username and a password before viewing or performing any actions with the repository.
-
-
Re-open apache2.conf, and replace the SVN Location information with this:
I'm prompted to enter and confirm my password, and then my details are saved. The Apache service will need to be restarted again, and then the user will need to authenticate themselves before viewing the repositories.
-
-
-
-
Checking out the repository and commiting files
-
-
For example, now want to checkout the files within my repository into a new directory called 'test2' within my home directory. Firstly, I need to create the new directory, and then I can issue the checkout command.
I'm passing the command two arguments - the first is the URL of the repository's trunk directory, and the second is the directory where the files are to be placed. As no files have been commited yet into the trunk, it appears to be empty - but if you perform an ls -la command, you'll see that there is a hidden .svn directory.
-
-
Now you can start adding files into the directory. Once you've created your files, perform a svn add command, passing in individual filenames as further arguments.
-
-
$ svn add index.php
-$ svn add *
-
-
-
With all the required files added, they can be committed using svn commit -m 'commit message' command, and the server can be updated using the svn up command.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
As the vast majority of the Drupal websites that I currently work on are built on Drupal 7, I thought that it was time that I upgraded this site. Following the core upgrade process and the CCK migration process, everything was upgraded smoothly without any issues.
-
-
I've upgraded a handful of essential contrib modules to the latest stable version, Administration Menu, Views etc., and will continue upgrading the other modules on the site as time allows.
-
-
I also prefer Bartik to Garland - but I will be creating a new custom theme when I get a chance.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
How to use Authorized Keys to Create a Passwordless SSH Connection
-
-
1st February 2012
-
-
If you're accessing Linux servers or automating tasks between servers, rather than having to enter your user password every time, you can also use SSH public key authentication. This is a simple process that involves creating a local key and storing it within the authorized_keys file on the remote server.
-
-
-
Check if you already have a SSH key.
-$ ssh-add -L
-
If you don't have one, create one.
-$ ssh-keygen
-
Upload the key onto the server. Replace myserver with the hostname or IP address of your remote server.
-$ ssh-copy-id myserver
-
-
-
If you're using Mac OS X and you don't have ssh-copy-id installed, download and install Homebrew and run the brew install ssh-copy-id command.
-
-
If successful, you should now see a message like:
-
-
-
Now try logging into the machine, with "ssh 'myserver'", and check in:
-
-
~/.ssh/authorized_keys
-
-
to make sure we haven't added extra keys that you weren't expecting.
-
-
-
Now the next time that you SSH onto the server, it should log you in without prompting you for your password.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
The first thing that I need to do is download the Omega theme and the Omega Tools and LESS modules, and then to enable both modules. I'm doing this using Drush, but you can of course do this via the admin interface at admin/modules.
-
-
$ drush dl less omega omega_tools;
-$ drush en -y less omega_tools
-
-
-
With the Omega Tools module enabled I get the drush omega-subtheme command that creates my Omega subtheme programatically. Using this command, I'm creating a new subtheme, enabling it and setting it as the default theme on my site.
By default, four stylesheets are created within the subtheme's css directory. The first thing that I'm going to do is rename global.css to global.less.
-
-
$ mv css/global.css css/global.less
-
-
-
Now I need to find all references to global.css within my oliverdavies.info file. I did this using $ nano oliverdavies.info, pressing Ctrl+W to search, then Ctrl+R to replace, entering global.css as the search phrase, and then global.less as the replacement text. After making any changes to oliverdavies.info, I need to clear Drupal's caches for the changes to be applied.
-
-
$ drush cc all
-
-
-
I tested my changes by making some quick additions to my global.less file and reloading the page.
-
-
If your changes aren't applied, then confirm that your global.less file is enabled within your theme's configuration. I did this by going to admin/appearance/settings/oliverdavies, clicking on the Toggle styles tab within Layout configuration and finding global.less at the bottom of Enable optional stylesheets.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
A great post details that details the steps needed to install Nagios - a popular open source system and network monitoring software application - on CentOS.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Today, I had a situation where I was displaying a list of teasers for news article nodes. The article content type had several different fields assigned to it, including main and thumbnail images. In this case, I wanted to have different output and fields displayed when a teaser was displayed compared to when a complete node was displayed.
-
-
I have previously seen it done this way by adding this into in a node.tpl.php file:
-
-
if ($teaser) {
- // The teaser output.
-}
-else {
- // The whole node output.
-}
-
-
-
However, I decided to do something different and create a separate template file just for teasers. This is done using the hook_preprocess_HOOK function that I can add into my theme's template.php file.
-
-
The function requires the node variables as an argument - one of which is theme_hook_suggestions. This is an array of suggested template files that Drupal looks for and attempts to use when displaying a node, and this is where I'll be adding a new suggestion for my teaser-specific template. Using the debug() function, I can easily see what's already there.
Now, within my theme I can create a new node--article-teaser.tpl.php template file and this will get called instead of the node--article.tpl.php when a teaser is loaded. As I'm not specifying the node type specifically and using the dynamic $node->type value within my suggestion, this will also apply for all other content types on my site and not just news articles.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
How to add a date popup calendar onto a custom form
-
-
23rd May 2012
-
-
First, I need to download the Date module, and make my module dependent on date_popup by adding the following line into my module's .info file.
-
-
dependencies[] = date_popup
-
-
-
Within my form builder function:
-
-
$form['date'] = array(
- '#title' => t('Arrival date'),
-
- // Provided by the date_popup module
- '#type' => 'date_popup',
-
- // Uses the PHP date() format - http://php.net/manual/en/function.date.php
- '#date_format' => 'j F Y',
-
- // Limits the year range to the next two upcoming years
- '#date_year_range' => '0:+2',
-
- // Default value must be in 'Y-m-d' format.
- '#default_value' => date('Y-m-d', time()),
-);
-
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Prevent Apache from displaying text files within a web browser
-
-
23rd May 2012
-
-
When you download Drupal, there are several text files that are placed in the root of your installation. You don't want or need these to be visible to anyone attempting to view them in a browser - especially CHANGELOG.txt as that includes the exact version of Drupal you are running and could therefore have security implications.
-
-
Rather than delete these files or change the file permissions manually for each file, I can add the following lines into my VirtualHost configuration:
-
-
<Files ~ "\.txt$">
- Order deny,allow
- Deny from all
-</Files>
-
-
-
This prevents any files with a .txt extension from being accessed and rendered in a web browser.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
name = My Theme
-description = A description of my theme
-core = 7.x
-
-# Add a base theme, if you want to use one.
-base = mybasetheme
-
-# Define regions, otherwise the default regions will be used.
-regions[header] = Header
-regions[navigation] = Navigation
-regions[content] = Content
-regions[sidebar] = Sidebar
-regions[footer] = Footer
-
-# Define which features are available. If none are specified, all the default
-# features will be available.
-features[] = logo
-features[] = name
-features[] = favicon
-
-# Add stylesheets
-stylesheets[all][] = css/reset.css
-stylesheets[all][] = css/mytheme.css
-stylesheets[print][] = css/print.css
-
-# Add javascript files
-styles[] = js/mytheme.js
-
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Dividing Drupal's process and preprocess functions into separate files
-
-
24th May 2012
-
-
If you use a lot of process and preprocess functions within your Drupal theme, then your template.php can get very long and it can become difficult to find a certain piece of code. Following the example of the Omega theme, I've started separating my process and preprocess functions into their own files. For example, mytheme_preprocess_node can be placed within a preprocess/node.inc file, and mytheme_process_page can be placed within process/page.inc.
-
-
The first step is to use the default mytheme_process() and mytheme_preprocess() functions to utilise my custom function. So within my template.php file:
-
-
<?php
-
-/**
- * Implements hook_preprocess().
- *
- * Initialises the mytheme_invoke() function for the preprocess hook.
- */
-function mytheme_preprocess(&$variables, $hook) {
- mytheme_invoke('preprocess', $hook, $variables);
-}
-
-/**
- * Implements hook_process().
- *
- * Initialises the mytheme_invoke() function for the process hook.
- */
-function mytheme_process(&$variables, $hook) {
- mytheme_invoke('process', $hook, $variables);
-}
-
-
-
Now, to write the mytheme_invoke() function:
-
-
<?php
-
-/**
- * Invokes custom process and preprocess functions.
- *
- * @param string $type
- * The type of function we are trying to include (i.e. process or preprocess).
- *
- * @param array $variables
- * The variables array.
- *
- * @param string $hook
- * The name of the hook.
- *
- * @see mytheme_preprocess()
- * @see mytheme_process()
- */
-function mytheme_invoke($type, $hook, &$variables) {
- global $theme_key;
-
- // The name of the function to look for (e.g. mytheme_process_node).
- $function = $theme_key . '_' . $type . '_' . $hook;
-
- // If the function doesn't exist within template.php, look for the
- // appropriate include file.
- if (!function_exists($function)) {
- // The file to search for (e.g. process/node.inc).
- $file = drupal_get_path('theme', $theme_key) . '/' . $type . '/' . $type . '-' . str_replace('_', '-', $hook) . '.inc';
-
- // If the file exists, include it.
- if (is_file($file)) {
- include($file);
- }
- }
-
- // Try to call the function again.
- if (function_exists($function)) {
- $function($variables);
- }
-}
-
-
-
As mytheme_invoke() checks to see if the function already exists before searching for checking the include files, I could still add the functions into template.php as normal and this would override any corresponding include file.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
After a busy few days, I've released two new contrib Drupal modules:
-
-
-
Block Aria Landmark Roles - Inspired by Block Class, this module adds additional elements to the block configuration forms that allow users to assign a ARIA landmark role to a block.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Install and Configure the Nomensa Accessible Media Player in Drupal
-
-
14th July 2012
-
-
The official documentation for this module is now located at https://www.drupal.org/node/2383447. This post was accurate at the time of writing, whereas the documentation page will be kept up to date with any future changes.
-
-
This week I released the first version of the Nomensa Accessible Media Player module for Drupal 7. Here's some instructions of how to install and configure it.
-
-
Initial configuration
-
-
Download the Library
-
-
The library can be downloaded directly from GitHub, and should be placed within you sites/all/libraries/nomensa_amp directory.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
I'm absolutely delighted to announce that I'm going to be writing an article for Linux Journal magazine's upcoming Drupal special. The article is going to be entitled "Speeding Up Your Drupal Development Using Installation Profiles and Distributions" and will be mentioning existing distributions available on Drupal.org, but mainly focussing on the steps needed to create your own custom distribution. Needless to say, I'm quite excited about it!
-
-
The article is expected to be published in October.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Yesterday evening I went along and spoke at the UnifiedDiff meetup in Cardiff, having offered previously to do a presentation providing an introduction to Drupal.
-
-
I'm an experienced Drupal Developer, but not an experienced public speaker (although I have done several user training sessions and Drupal demonstrations for clients previously), and I think that some of the nerves that I had beforehand were apparent during the presentation, and being the first speaker for the evening probably didn't help, although I did get a nice tweet mid-way through.
-
-
Initially, after aiming for a 20-minute presentation plus Q&A, I think I wrapped up the presentation in around 14 minutes, although I did about 6 minutes of answering questions afterwards including the apparently mandatory "Why use Drupal compared to WordPress or Joomla?" question, some Drupal 8 and Symfony questions, as well as an interesting question about the White House development project after I'd listed it within a list of example sites. Next time, I think that some more detailed presenter notes are needed. Typically, as soon as it sat back in my seat, the majority of things that I'd managed to remember beforehand all came flooding back to me and I thought "I should have said that whilst I was up speaking".
-
-
Overall, considering my inexperience at speaking to this type of audience, I was fairly happy with my presentation, although I'm sure that I'll change my mind once I've watched the video of it on the UnifiedDiff website. Regardless, I think that it was a great experience and I enjoyed doing it, and I'd like to thank the organisers of UnifiedDiff for having me speak at their meetup. It was great to have a more relaxed conversation with some people after the other speakers had been up, and having introduced Drupal I would be more than happy to come back and do a more in-depth presentation if there is an interest for me to do so.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Sublime Text 2 has been my text editor of choice for the past few months, and I use it at home, in work, and on any virtual machines that I run. So rather than having to manually re-enter my settings each time, I thought that I'd document them here for future reference. These preferences ensure that the code is compliant with Drupal coding standards - using two spaces instead of a tab, no trailing whitespace, blank line at the end of a file etc.
-
-
Preferences
-
-
These can be changed by going to Preferences > Settings - User.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
I'm happy to announce that the Accessible Bristol website was launched this week, on Drupal 7. The site has been developed over the past few months, and uses the User Relationships and Privatemsg modules to provide a community-based platform where people with an interest in accessibility can register and network with each other.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
How to use SASS and Compass in Drupal 7 using Sassy
-
-
6th December 2012
-
-
I've recently started using SASS rather than LESS to do my CSS preprocessing - namely due to its integration with Compass and it's built-in CSS3 mixins. There are three modules that provide the ability to use SASS within Drupal:
Alternatively, you could use a base theme like Sasson that includes a SASS compiler.
-
-
Download the PHPSass Library
-
-
The first thing to do is download the PHPSass library from GitHub, as this is a requirement of the Sassy module and we can't enable it without the library. So, in a Terminal window:
Otherwise, download the each module from it's respective project page and place it within your sites/all/modules or sites/all/modules/contrib directory.
-
-
Configuring the Prepro module
-
-
The Prepro module provides various settings that can be changed for each preprocessor. Go to admin/config/media/prepro to configure the module as required.
-
-
Personally, in development, I'd set caching to 'uncached' and the error reporting method to 'show on page'. In production, I'd change these to "cached" and "watchdog" respectively. I'd also set the output style to "compressed",
-
-
Adding SASS files into your theme
-
-
With this done, you can now add SASS and SCSS files by adding a line like stylesheets[all][] = css/base.scss in your theme's .info file.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
-
-
-
-
-
-
-
-
diff --git a/docs/blog/2013/01/09/checking-if-user-logged-drupal-right-way/index.html b/docs/blog/2013/01/09/checking-if-user-logged-drupal-right-way/index.html
deleted file mode 100644
index cd3fa43a..00000000
--- a/docs/blog/2013/01/09/checking-if-user-logged-drupal-right-way/index.html
+++ /dev/null
@@ -1,276 +0,0 @@
-
-
-
- Checking if a user is logged into Drupal (the right way) | Oliver Davies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Checking if a user is logged into Drupal (the right way)
-
-
9th January 2013
-
-
I see this regularly when working on Drupal sites when someone wants to check whether the current user is logged in to Drupal (authenticated) or not (anonymous):
-
-
global $user;
-if ($user->uid) {
- // The user is logged in.
-}
-
-
-
or
-
-
global $user;
-if (!$user->uid) {
- // The user is not logged in.
-}
-
if (user_is_logged_in()) {
- // Do something.
-}
-
-
-
This returns a boolean (TRUE or FALSE) depending or not the user is logged in. Essentially, it does the same thing as the first example, but there's no need to load the global variable.
-
-
A great use case for this is within a hook_menu() implementation within a custom module.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
This post outlines the steps required to create your own custom tokens in Drupal.
-
-
When writing the recent releases of the Copyright Block module, I used tokens to allow the user to edit and customise their copyright message and place the copyright_message:dates token in the desired position. When the block is rendered, the token is replaced by the necessary dates.
-
-
We will be using the fictional foo module to demonstrate this.
The first thing that we need to do is define the new token type and/or the token itself, along with it's descriptive text. To view the existing tokens and types, use dpm(token_get_info());, assuming that you have the Devel module installed.
-
-
/**
- * Implements hook_token_info().
- */
-function foo_token_info() {
- $info = array();
-
- // Add any new tokens.
- $info['tokens']['foo']['bar'] = t('This is my new bar token within the foo type.');
-
- // Return them.
- return $info;
-}
-
-
-
In this case, the token called bar resides within the foo group.
-
-
If I needed to add a new token within an existing token type, such as 'node', the syntax would be $info['tokens']['node']['bar'].
-
-
Implementing hook_tokens()
-
-
Now that the Token module is aware of our new token, we now need to determine what the token is replaced with. This is done using hook_tokens(). Here is the basic code needed for an implementation:
The first thing to check for is the type of token using an if() function, as this could be an existing type like 'node', 'user' or 'site', or a custom token type like 'foo'. Once we're sure that we're looking at the right type(s), we can use foreach ($tokens as $name => $original) to loop through each of the available tokens using a switch(). For each token, you can perform some logic to work out the replacement text and then add it into the replacements array using $replacements[$original] = $new;.
-
-
/**
- * Implements hook_tokens().
- */
-function foo_tokens($type, $tokens, array $data = array(), array $options = array()) {
- $replacements = array();
-
- // The first thing that we're going to check for is the type of token - node,
- // user etc...
- if ($type == 'foo') {
- // Loop through each of the available tokens.
- foreach ($tokens as $name => $original) {
- // Find the desired token by name
- switch ($name) {
- case 'bar':
- $new = '';
-
- // Work out the value of $new...
-
- // Add the new value into the replacements array.
- $replacements[$original] = $new;
- break;
- }
- }
- }
-
- // Return the replacements.
- return $replacements;
-}
-
With everything defined, all that we now need to do is pass some text through the token_replace() function to replace it with the values defined within hook_token().
-
-
$a = t('Something');
-// This would use any token type - node, user etc.
-$b = token_replace($a);
-// This would only use foo tokens.
-$c = token_replace($a, array('foo'));
-
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
The Quickest way to Install Sublime Text 2 in Ubuntu
-
-
2nd March 2013
-
-
After reading numerous blog posts about how to install Sublime Text 2 in Ubuntu, this is definitely the quickest way! Just paste the following lines into your Terminal:
After running this, Sublime Text 2 has been installed within the /usr/lib/sublime-text-2 directory and can be launched from the Dashboard, or by typing subl, sublime-text or sublime-text-2 into a Terminal window.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Yesterday was my last day working at Nomensa. Next week, I'll be starting as a Senior Developer at Precedent.
-
-
The last 14 months that I've been working at Nomensa have been absolutely fantastic, and had allowed me to work on some great projects for great clients - mainly unionlearn and Digital Theatre Plus. I've learned so much about accessibility and web standards, and have pretty much changed my whole approach to front-end development to accommodate best practices. I've also been involved with the Drupal Accessibility group since starting at Nomensa, and have written several accessibility-focused Drupal modules, including the Nomensa Accessible Media Player module and the Accessibility Checklist. I'll definitely be continuing my interest in accessibility, championing best practices, and incorporating it into my future work wherever possible.
-
-
With that all said, I'm really looking forward to starting my new role at Precedent, tackling some new challenges, and I'm sure that it'll be as great a place to work as Nomensa was.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Display Git Branch or Tag Names in your Bash Prompt
-
-
27th April 2013
-
-
Whilst watching Drupalize.me's recent Introduction to Git series, I thought it was useful the way that the current Git branch or tag name was displayed in the bash prompt.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Creating Local and Staging sites with Drupal's Domain Module Enabled
-
-
17th July 2013
-
-
The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database. The issue is that the domains are stored within the database so these are copied across when the data is migrated between environments, whereas the domains are obviously going to change.
-
-
Rather than changing the domain settings within the Domain module itself, the best solution I think is to use table prefixes and create a different domain table per environment. With a live, staging and local domains, the tables would be named as follows:
-
-
live_domain
-local_domain
-staging_domain
-
-
-
Within each site's settings.php file, define the prefix for the domain table within the databases array so that each site is looking at the correct table for its environment.
-
-
$databases['default']['default'] = array(
- 'driver' => 'mysql',
- 'database' => 'foobar',
- 'username' => 'foo',
- 'password' => 'bar',
- 'host' => 'localhost',
- 'prefix' => array(
- 'default' => '',
- 'domain' => 'local_', // This will use the local_domain table.
- // Add any other prefixed tables here.
- ),
-);
-
-
-
Within each environment-specific domain table, update the subdomain column to contain the appropriate domain names.
-
-
Update: I've just found out about the Domain Alias sub-module, which you can enable and add aliases to each domain, so you could add the aliases in this way also.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
There are times when doing Drupal development when you need to run a custom PHP script, maybe moving data from one field to another, that doesn't warrant the time and effort to create a custom module. In this scenario, it would be quicker to write a .php script and bootstrap Drupal to gain access to functions like node_load() and db_query().
-
-
To bootstrap Drupal, you would need to add some additional lines of code to the stop of your script. Something like:
The script would need be placed in the root of your Drupal directory, and you would then have had to open a browser window and visit http://example.com/foo.php to execute it. This is where the "drush php-script" command (or "drush scr" for short) is useful, and can be used to execute the script from the command line.
-
-
$ drush scr foo.php
-
-
-
It also means that I no longer need to manually bootstrap Drupal, so my script is much cleaner.
-
-
// Just do stuff.
-$node = node_load(1);
-
-
-
I prefer to keep these scripts outside of my Drupal directory in a separate "scripts" directory (with Drupal in a "drupal" directory on the same level). This makes it easier to update Drupal as I don't need to worry about accidentally deleting the additional files. From within the drupal directory, I can now run the following command to go up one level, into the scripts directory and then execute the script. Note that you do not need to include the file extension.
If you commonly use the same scripts for different projects, you could also store these within a separate Git repository and checkout the scripts directory using a Git submodule.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Testing a patch file is usually a two-step process. First you download the patch file from the source, and then you run a separate command to apply it.
-
-
You can save time and typing by running the two commands on one line:
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
I still maintain a number of Drupal 6 sites and occassionally need to download Drupal 6 core as opposed to Drupal 7. I'm also experimenting with Drupal 8 so I need to download that as well.
-
-
By declarding the core version of Drupal, such as "drupal-6", Drush will download that instead.
-
-
$ drush dl drupal-6
-
-
-
This downloads the most recent stable version of Drupal 6. If you don't want that, you can add the --select and additionally the --all options to be presented with an entire list to chose from.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Here are some bash aliases that I use and find helpful for quickly writing Git and Git Flow commands. These should be placed within your ~/.bashrc or ~/.bash_profile file:
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
It's all booked, I'm going to be attending DrupalCamp London this year, my first DrupalCamp!
-
-
I'm going as a volunteer, so I'm going to be helping with the registrations on the Saturday morning and for another couple hours elsewhere over the weekend. I've also offered to help organise and oversee some code sprints, although I'm definitely wanting to do some sprinting of my own and attend a few sessions.
-
-
I'm looking forward to meeting some new people as well as catching up with some people that I met at DrupalCon Prague.
-
-
If you're also coming, see you there!
-
-
Update: I've just found out that my session, What is Git Flow?, has been accepted and will take place on the Sunday morning. It's going to be a busy weekend!
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Here are my slides from my "What is Git Flow?" session at DrupalCamp London.
-
-
-
-
-
Take aways
-
-
The main take aways are:
-
-
-
Git Flow adds various commands into Git to enhance its native functionality, which creates a branching model to separate your stable production code from your unstable development code.
-
Never commit directly to the master branch - this is for production code only!
-
You can commit directly to the develop branch, but this should be done sparingly.
-
Use feature branches as much as possible - one per feature, user story or bug.
-
Commit early and often, and push to a remote often to encourage collaboration as well as to provide a backup of your code.
-
You can use settings within services like GitHub and Bitbucket to only allow certain users to push to the master and develop branches, and restrict other Developers to only commit and push to feature branches. Changes can then be committed and pushed, then reviewed as part of a peer code review, and merged back into the develop branch.
-
-
-
Feedback
-
-
If you've got any questions, please feel free to tweet at me or fill in the session evaluation form that you can complete on the DrupalCamp London website.
-
-
I've had some great feedback via Twitter:
-
-
-
-
-
-
@opdavies@DrupalCampLDN always had trouble with git. Your talk + Git flow has made it all very easy.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
I was at Precedent for just over a year and had the opportunity to work on several Drupal projects from project leading to ad-hoc module and theme development, including my largest Drupal build to date.
I was able to contribute some code back into the community and encourage other team members to do the same.
-
-
It was good to be able to introduce some new tools like Vagrant, Puppet, SASS and Compass into the team. I was pleased to introduce and champion the Git Flow branching model, which them became the standard approach for all Drupal projects, and hopefully soon all development projects.
-
-
Working for the Drupal Association and on Drupal.org was an opportunity that I couldn't refuse, and is certainly going to be a fun and interesting challenge. I can't wait to get started!
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
This is just a quick post to thank everyone for their comments and congratulations after my previous post about joining the Drupal Association. I’m looking forward to my first day in the job tomorrow.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
As an active contributor to the Drupal project, I spend a lot of time working with other peoples’ modules and themes, and occassionally have to fix a bug or add some new functionality.
-
-
In the Drupal community, we use a patch based workflow where any changes that I make get exported to a file detailing the differences. The patch file (*.patch) is attached to an item in an issue queue on Drupal.org, applied by the maintainer to their local copy of the code and reviewed, and hopefully committed.
-
-
There is an option that the maintainer can add to the end of their commit message.
This differs slightly different for each Drupal user, and the code can be found on their Drupal.org profile page.
-
-
If this is added to the end of the commit message, the resulting commit will show that it was committed by the maintainer but authored by a different user. This will then display on Drupal.org that you’ve made a commit to that project.
-
-
-
-
The problem is that some project maintainers either don’t know about this option or occasionally forget to add it. Dreditor can suggest a commit message and assign an author, but it is optional and, of course, not all maintainers use Dreditor (although they probably should).
-
-
The git format-patch command seems to be the answer, and will be my preferred method for generating patch files in the future rather than git diff.
Prepare each commit with its patch in one file per commit, formatted to resemble UNIX mailbox format. The output of this command is convenient for e-mail submission or for use with git am.
-
-
-
Here is a section of a patch that I created for the Metatag module using git format-patch:
-
-
From 80c8fa14de7f4a83c2e70367aab0aedcadf4f3b0 Mon Sep 17 00:00:00 2001
-From: Oliver Davies <oliver@oliverdavies.co.uk>
-Date: Mon, 12 May 2014 14:53:55 +0100
-Subject: [PATCH] Exclude comment entities when checking if this is the page,
- otherwise comment_fragment.module will break metatag
-
----
-
-
-
As mentioned above, the patch is structured in an email format. The commit message is used as the subject line, and the date that the commit was made locally is used for the date. What we’re interested in is the “From” value. This contains your name and email address from your ~/.gitconfig file and is used to author the patch automatically.
-
-
Everything below this is the same as a standard patch file, the same as if was generated with git diff.
How did I create this patch? Here are the steps that I took:
-
-
-
Clone the source repository using $ git clone --branch 7.x-1.x http://git.drupal.org/project/metatag.git and move into that directory.
-
Create a branch for this patch using $ git checkout -b 2265447-comment-fragment-conflict.
-
Add and commit any changes as normal.
-
Generate the patch file using $ git format-patch 7.x-1.x --stdout > metatag-comment-fragment-conflict-2265447-4.patch.
-
-
-
Note: I am defining 7.x-1.x in the last step as the original branch to compare (i.e. the original branch that we forked to make our issue branch). This will change depending on the project that you are patching, and it’s version number. Also, commits should always be made against the development branch and not the stable release.
-
-
By default, a separate patch file will be created for each commit that we’ve made. This is overridden by the --stdout option which combines all of the patches into a single file. This is the recommended approach when uploading to Drupal.org.
-
-
The resulting patch file can be uploaded onto a Drupal.org issue queue, reviewed by the Testbot and applied by a module maintainer, and you automatically get the commit attributed. Problem solved.
-
-
Committing the Patch
-
-
If you need to commit a patch that was created using git format-patch, the best command to do this with is the git am command.
-
-
For example, within your repository, run:
-
-
$ git am /path/to/file
-$ git am ~/Code/metatag-comment-fragment-conflict-2265447-4.patch
-
-
-
You should end up with some output similar to the following:
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
How to fix Vagrant Loading the Wrong Virtual Machine
-
-
6th October 2014
-
-
A few times recently, I've had instances where Vagrant seems to have forgotten which virtual machine it's supposed to load, probably due to renaming a project directory or the .vagrant directory being moved accidentally.
-
-
Here are the steps that I took to fix this and point Vagrant back at the correct VM.
-
-
-
Stop the machine from running using the $ vagrant halt command.
-
Use the $ VBoxManage list vms command to view a list of the virtual machines on your system. Note the ID of the correct VM that should be loading. For example, "foo_default_1405481857614_74478" {e492bfc3-cac2-4cde-a396-e81e37e421e2}. The number within the curly brackets is the ID of the virtual machine.
-
Within the .vagrant directory in your project (it is hidden by default), update the ID within the machines/default/virtualbox/id file.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Updating Features and Adding Components Using Drush
-
-
21st October 2014
-
-
If you use the Features module to manage your Drupal configuration, it can be time consuming to update features through the UI, especially if you are working on a remote server and need to keep downloading and uploading files.
-
-
If you re-create a feature through the UI, you'll be prompted to download a new archive of the feature in its entirety onto your local computer. You could either commit this into a local repository and then pull it remotely, or use a tool such as SCP to upload the archive onto the server and commit it from there. You can simplify this process by using Drush.
-
-
Finding Components
-
-
To search for a component, use the drush features-components command. This will display a list of all components on the site. As we're only interested in components that haven't been exported yet, add the --not-exported option to filter the results.
-
-
To filter further, you can also use the grep command to filter the results. For example, drush features-components --not-exported field_base | grep foo, would only return non-exported field bases containing the word "foo".
-
-
The result is a source and a component, separated by a colon. For example, field_base:field_foo.
-
-
Exporting the Feature
-
-
Once you have a list of the components that you need to add, you can export the feature. This is done using the drush features-export command, along with the feature name and the component names.
In this example, the base for field_boo and it's instance on the user object is being added to the "myfeature" feature.
-
-
If you are updating an existing feature, you'll get a message informing you that the module already exists and asking if you want to continue. This is fine, and is automatically accepted by including -y within the command. If a feature with the specified name doesn't exist, it will be created.
-
-
If you're creating a new feature, you can define where the feature will be created using the --destination option.
-
-
Once complete, you will see a confirmation message.
-
-
-
Created module: my feature in sites/default/modules/custom/features/myfeature
-
-
-
The Result
-
-
Once finished, the feature is updated in it's original location, so there's no download of the feature and then needing to re-upload it. You can add and commit your changes into Git or continue with your standard workflow straight away.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Using a file structure similar to this, organise your font files into directories, using the the font name for both the directory name and for the file names.
Within your SASS file, start an @each loop, listing the names of the fonts. In the same way as PHP's foreach loop, each font name will get looped through using the $family variable and then compiled into CSS.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Using Remote Files when Developing Locally with Stage File Proxy Module
-
-
20th November 2014
-
-
Download the Stage File Proxy module from Drupal.org and enable it on your site.
-
-
As this module is only going to be needed on pre-production sites, it would be better to configure this within your settings.php or settings.local.php file. We do this using the $conf array which removes the need to configure the module through the UI and store the values in the database.
-
-
// File proxy to the live site.
-$conf['stage_file_proxy_origin'] = 'http://www.example.com';
-
-// Don't copy the files, just link to them.
-$conf['stage_file_proxy_hotlink'] = TRUE;
-
-// Image style images are the wrong size otherwise.
-$conf['stage_file_proxy_use_imagecache_root'] = FALSE;
-
-
-
If the origin site is not publicly accessible yet, maybe it's a pre-live or staging site, and protected with a basic access authentication, you can include the username and password within the origin URL.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Include environment-specific settings files on Pantheon
-
-
27th November 2014
-
-
I was recently doing some work on a site hosted on Pantheon and came across an issue, for which part of the suggested fix was to ensure that the $base_url variable was explicitly defined within settings.php (this is also best practice on all Drupal sites).
-
-
The way that was recommended was by using a switch() function based on Pantheon's environment variable. For example:
-
-
switch ($_SERVER['PANTHEON_ENVIRONMENT']) {
- case 'dev':
- // Development environment.
- $base_url = 'dev-my-site.gotpantheon.com';
- break;
-
-
- case 'test':
- // Testing environment.
- $base_url = 'test-my-site.gotpantheon.com';
- break;
-
-
- case 'live':
- // Production environment.
- $base_url = 'live-my-site.gotpantheon.com';
- break;
-}
-
-
-
Whilst this works, it doesn't conform to the DRY (don't repeat yourself) principle and means that you also might get a rather long and complicated settings file, especially when you start using multiple switches and checking for the value of the environment multiple times.
-
-
My alternative solution to this is to include an environment-specific settings file.
-
-
To do this, add the following code to the bottom of settings.php:
-
-
if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) {
- if ($_SERVER['PANTHEON_ENVIRONMENT'] != 'live') {
- // You can still add things here, for example to apply to all sites apart
- // from production. Mail reroutes, caching settings etc.
- }
-
- // Include an environment-specific settings file, for example
- // settings.dev.php, if one exists.
- $environment_settings = __DIR__ . '/settings.' . $_SERVER['PANTHEON_ENVIRONMENT'] . '.php';
- if (file_exists($environment_settings)) {
- include $environment_settings;
- }
-}
-
-
-
This means that rather than having one long file, each environment has it's own dedicated settings file that contains it's own additional configuration. This is much easier to read and make changes to, and also means that less code is loaded and parsed by PHP. Settings that apply to all environments are still added to settings.php.
-
-
Below this, I also include a similar piece of code to include a settings.local.php file. The settings.php file then gets committed into the Git repository.
-
-
Within the sites/default directory, I also include an example file (example.settings.env.php) for reference. This is duplicated, renamed and populated accordingly.
-
-
<?php
-
-/**
- * This is a specific settings file, just for the x environment. Any settings
- * defined here will be included after those in settings.php.
- *
- * If you have also added a settings.local.php file, that will override any
- * settings stored here.
- *
- * No database credentials should be stored in this file as these are included
- * automatically by Pantheon.
- */
-
-$base_url = '';
-
-
-
The environment specific files are also committed into Git and pushed to Pantheon, and are then included automatically on each environment.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
This allows for you to create a new file called settings.local.php within a sites/* directory (the same place as settings.php), and this will be included as an extension of settings.php. You can see the same technique being used within Drupal 8's default.settings.php file.
-
-
Environment specific settings like $databases and $base_url can be placed within the local settings file. Other settings like $conf['locale_custom_strings_en'] (string overrides) and $conf['allow_authorize_operations'] that would apply to all environments can still be placed in settings.php.
-
-
settings.php though is ignored by default by Git by a .gitignore file, so it won't show up as a file available to be committed. There are two ways to fix this. The first is to use the --force option when adding the file which overrides the ignore file:
-
-
git add --force sites/default/settings.php
-
-
-
The other option is to update the .gitignore file itself so that settings.php is no longer ignored. An updated .gitignore file could look like:
-
-
# Ignore configuration files that may contain sensitive information.
-sites/*/settings.local*.php
-
-# Ignore paths that contain user-generated content.
-sites/*/files
-sites/*/private
-
-
-
This will allow for settings.php to be added to Git and committed, but not settings.local.php.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
A lot happened in 2014. Here are some of the main things that I'd like to highlight:
-
-
Joined the Drupal Association
-
-
This was the main thing for me this year, in May I left Precedent and joined the Drupal Association. I work on the Engineering team, focused mainly on Drupal.org but I've also done some theming work on the DrupalCon Amsterdam and Latin America websites, and some pre-launch work on Drupal Jobs.
-
-
Some of the tasks that I've worked on so far are:
-
-
-
Fixing remaining issues from the Drupal.org Drupal 7 upgrade.
Configuring human-readable paths for user profiles using Pathauto. Only a small change, but made a big difference to end-users.
-
Migration of user data from profile values to fields, and various user profile improvements. This was great because now we can do things like reference mentors by their username and display their picture on your profile, as well as show lists of peope listing a user as their mentor. This, I think, adds a more personal element to Drupal.org because we can see the actual people and not just a list of names on a page.
-
-
-
I've started keeping a list of tasks that I've been involved with on my Work page, and will be adding more things as I work on them.
-
-
Portland
-
-
I was able to travel to Portland, Oregon twice last year to meet with the rest of the Association staff. Both times I met new people and it was great to spend some work and social time with everyone, and it was great to have everyone together as a team.
-
-
My First DrupalCamp
-
-
In February, I attended DrupalCamp London. This was my first time attending a Camp, and I managed to attend some great sessions as well as meet people who I'd never previously met in person. I was also a volunteer and speaker, where I talked about Git Flow - a workflow for managing your Git projects.
I was also able to do a little bit of sprinting whilst I was there, reviewing other people's modules and patches.
-
-
Attending this and DrupalCon Prague in 2013 have really opened my eyes to the face-to-face side of the Drupal community, and I plan on attending a lot more Camps and Cons in the future.
-
-
DrupalCon Amsterdam
-
-
I was also able to travel to Holland and attend DrupalCon Amsterdam along with other members of Association staff.
-
-
DrupalCamp Bristol
-
-
In October, we started planning for DrupalCamp Bristol. I'm one of the founding Committee members,
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
This week, my first code patch was committed to Drupal core. The patch adds the user_has_role() function to the user module, to simplify the way to check whether a user in Drupal has been assigned a specific role. This is something that I normally write a custom function for each project, but it's now available in Drupal core as of 7.36.
-
-
But what if someone is using a core version less than 7.36 and tries using the function? The site would return an error because that function wouldn't exist.
-
-
If you're building a new Drupal site, then I'd assume that you're using a latest version of core, or you have the opportunity to update it when needed. But what if you're writing a contrib module? How can you be sure that the correct minimum version of core?
-
-
Setting Dependencies
-
-
What I'm going to be doing for my contrib projects is defining a minimum version of Drupal core that the module is compatible with. If this dependency isn't met, the module won't be able to be enabled. This is done within your module's .info file.
-
-
Adding a Simple Dependency
-
-
You can define a simple dependency for your module by adding a line this this to your project's .info file:
-
-
dependencies[] = views
-
-
-
This would make your module dependant on having the Views module present and enabled, which you'd need if you were including views as part of your module, for example.
-
-
Adding a Complex Dependency
-
-
In the previous example, our module would enable if any version of Views was enabled, but we need to specify a specific version. We can do this by including version numbers within the dependencies field in the following format:
-
-
dependencies[] = modulename (major.minor)
-
-
-
This can be a for a specific module release or a branch name:
We can also use the following as part of the field for extra granularity:
-
-
-
= or == equals (this is the default)
-
> greater than
-
< lesser than
-
>= greater than or equal to
-
<= lesser than or equal to
-
!= not equal to
-
-
-
In the original scenario, we want to specify that the module can only be enabled on Drupal core 7.36 or later. To do this, we can use the "greater than or equal to" option.
-
-
dependencies[] = system (>=7.36)
-
-
-
Because we need to check for Drupal's core version, we're using the system module as the dependency and specifying that it needs to be either equal to or greater than 7.36. If this dependency is not met, e.g. Drupal 7.35 is being used, then the module cannot be enabled rather than showing a function not found error for user_has_role() when it is called.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
People may or may not know, but this site runs on Sculpin, a PHP based static site generator (this may be the first time that I've mentioned it on this site). The source code is hosted on GitHub, and I've listed the site on the Community page on the Sculpin website.
-
-
To get it there, I forked the main sculpin.io repository so that I had my own copy, created a branch, made my additions and submitted a pull request. Easy enough!
-
-
New Domain
-
-
In the last week or so, I've changed this site URL from .co.uk to just .uk, and also updated the GitHub repo URL to match, so I wanted to update the Community page to use the correct URL.
-
-
There had been commits to the main repo since my pull request was merged, I didn't want to delete my repo and fork again, and making any changes against and old codebase isn't best practice, so I wanted to merge the latest changes into my forked repo before I did anything else - just to check that I didn't break anything!
-
-
Updating my Local Repo
-
-
I had a quick look for a Update my fork button or something, but couldn't see one to I added the main repository as an additional remote called upstream and fetched the changes.
Now my local site knows about the upstream repo, and I could rebase the changes (git pull upstream master should have worked too) and push them back to origin.
-
-
$ git rebase upstream/master
-First, rewinding head to replay your work on top of it...
-...
-Fast-forwarded master to upstream/master.
-
-$ git push origin master
-
-
-
This seems to have worked OK - the commits are still authored by the correct people and at the correct date and time - and I went ahead and created a new feature branch and pull request based on that master branch.
-
-
-
- The commits on my forked master branch after rebasing and pushing. All good!
-
-
-
-
- The new feature branch with the new commit.
-
-
-
Is There a Better Way?
-
-
Did I miss something? Is there a recommended and/or better way to update your forked repos, maybe through the UI? Please send me a tweet with any comments.
-
-
Update: Rebasing in PhpStorm
-
-
December 2015: I’ve found that PhpStorm has an option available to rebase a fork from within the IDE. This is within the VCS > Git menu.
-
-
I believe that it will use an existing "upstream" remote if it exists, otherwise it will add one automatically for you, linking to the repository that you forked from.
-
-
Once you’ve completed the rebase, you can then push your updated branch either from the terminal, or using the Push command from the same menu.
-
-
-
-
It would be great to see something similar added to hub too (I’ve created an issue)!
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
As part of re-building this site with Sculpin, I wanted to automate the deployments, as in I wouldn't need to run a script like publish.sh locally and have that deploy my code onto my server. Not only did that mean that my local workflow was simpler (update, commit and push, rather than update, commit, push and deploy), but if I wanted to make a quick edit or hotfix, I could log into GitHub or Bitbucket (wherever I decided to host the source code) from any computer or my phone, make the change and have it deployed for me.
-
-
I'd started using Jenkins CI during my time at the Drupal Association, and had since built my own Jenkins server to handle deployments of Drupal websites, so that was the logical choice to use.
I've also released an Ansible role for Sculpin that installs the executable so that the Jenkins server can run Sculpin commands.
-
-
Triggering a Build from a Git Commit
-
-
I created a new Jenkins item for this task, and restricted where it could be run to master (i.e. the Jenkins server rather than any of the nodes).
-
-
Polling from Git
-
-
I entered the url to the GitHub repo into the Source Code Management section (the Git option may have been added by the Git plugin that I have installed).
-
-
As we don’t need any write access back to the repo, using the HTTP URL rather than the SSH one was fine, and I didn’t need to provide any additional credentials.
-
-
Also, as I knew that I’d be working a lot with feature branches, I entered */master as the only branch to build. This meant that pushing changes or making edits on any other branches would not trigger a build.
-
-
-
-
I also checked the Poll SCM option so that Jenkins would be routinely checking for updated code. This essentially uses the same syntax as cron, specifying minutes, hours etc. I entered * * * * * so that Jenkins would poll each minute, knowing that I could make this less frequent if needed.
-
-
This now that Jenkins would be checking for any updates to the repo each minute, and could execute tasks if needed.
-
-
Building and Deploying
-
-
Within the Builds section of the item, I added an Execute Shell step, where I could enter a command to execute. Here, I pasted a modified version of the original publish.sh script.
-
-
#!/bin/bash
-
-set -uex
-
-sculpin generate --env=prod --quiet
-if [ $? -ne 0 ]; then echo "Could not generate the site"; exit 1; fi
-
-rsync -avze 'ssh' --delete output_prod/ prodwww2:/var/www/html/oliverdavies.uk/htdocs
-if [ $? -ne 0 ]; then echo "Could not publish the site"; exit 1; fi
-
-
-
This essentially is the same as the original file, in that Sculpin generates the site, and uses rsync to deploy it somewhere else. In my case, prodwww2 is a Jenkins node (this alias is configured in /var/lib/jenkins/.ssh/config), and /var/www/html/oliverdavies.uk/htdocs is the directory from where my site is served.
-
-
Building Periodically
-
-
There is some dynamic content on my site, specifically on the Talks page. Each talk has a date assigned to it, and within the Twig template, the talk is positoned within upcoming or previous talks based on whether this date is less or greater than the time of the build.
-
-
The YAML front matter:
-
-
---
-...
-talks:
- - title: Test Drive Twig with Sculpin
- date: 2015-07-24
- location: DrupalCamp North
----
-
-
-
The Twig layout:
-
-
{% for talk in talks|reverse if talk.date >= now %}
- {# Upcoming talks #}
-{% endfor %}
-
-{% for talk in talks if talk.date < now %}
- {# Previous talks #}
-{% endfor%}
-
-
-
I also didn’t want to have to push an empty commit or manually trigger a job in Jenkins after doing a talk in order for it to be positioned in the correct place on the page, so I also wanted Jenkins to schedule a regular build regardless of whether or not code had been pushed, so ensure that my talks page would be up to date.
-
-
After originally thinking that I'd have to split the build steps into a separate item and trigger that from a scheduled item, and amend my git commit item accordingly, I found a Build periodically option that I could use within the same item, leaving it intact and not having to make amends.
-
-
I set this to @daily (the same H H * * * - H is a Jenkins thing), so that the build would be triggered automatically each day without a commit, and deploy any updates to the site.
-
-
-
-
Next Steps
-
-
This workflow works great for one site, but as I roll out more Sculpin sites, I'd like to reduce duplication. I see this mainly as I’ll end up creating a separate sculpin_build item that’s decoupled from the site that it’s building, and instead passing variables such as environment, server name and docroot path as parameters in a parameterized build.
-
-
I'll probably also take the raw shell script out of Jenkins and save it in a text file that's stored locally on the server, and execute that via Jenkins. This means that I’d be able to store this file in a separate Git repository with my other Jenkins scripts and get the standard advantages of using version control.
-
-
Update
-
-
Since publishing this post, I've added some more items to the original build script.
-
-
Updating Composer
-
-
if [ -f composer.json ]; then
- /usr/local/bin/composer install
-fi
-
-
-
Updates project dependencies via Composer if composer.json exists.
-
-
Updating Sculpin Dependencies
-
-
if [ -f sculpin.json ]; then
- sculpin install
-fi
-
-
-
Runs sculpin install on each build if the sculpin.json file exists, to ensure that the required custom bundles and dependencies are installed.
-
-
Managing Redirects
-
-
if [ -f scripts/redirects.php ]; then
- /usr/bin/php scripts/redirects.php
-fi
-
-
-
I've been working on a redirects.php script that generates redirects from a .csv file, after seeing similar things in the Pantheon Documentation and That Podcast repositories. This checks if that file exists, and if so, runs it and generates the source file containing each redirect.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
I recently had my first experience using the Entityform module in a project. It was quite easy to configure with different form types, but then I needed to embed the form into an overlay. I was expecting to use the drupal_get_form() function and render it, but this didn’t work.
-
-
Here are the steps that I took to be able to load, render and embed the form.
-
-
Loading the Form
-
-
The first thing that I needed to do to render the form was to load an empty instance of the entityform using entityform_empty_load(). In this example, newsletter is the name of my form type.
-
-
$form = entityform_empty_load('newsletter');
-
-
-
This returns an instance of a relevant Entityform object.
-
-
Rendering the Form
-
-
The next step was to be able to render the form. I did this using the entity_form_wrapper() function.
-
-
As this function is within the entityform.admin.inc file and not autoloaded by Drupal, I needed to include it using module_load_include() so that the function was available.
The first argument is the Entityform object that was created in the previous step (I’ve submitted a patch to type hint this within entityform so that it’s clearer what is expected), which is required.
-
-
The other two arguments are optional. The second argument is the mode (submit is the default value), and the last is the form context. page is the default value, for use on the submit page, however I changed this to embedded.
-
-
I could then pass this result into my theme function to render it successfully within the relevant template file.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
For the past few weeks I’ve been working on a personal side project, based on Drupal VM. It’s called the Drupal VM Generator, and over the weekend I’ve added the final features and fixed the remaining issues, and tagged the 1.0.0 release.
-
-
-
-
What is Drupal VM?
-
-
Drupal VM is a project created and maintained by Jeff Geerling. It’s a Vagrant virtual machine for Drupal development that is provisioned using Ansible.
-
-
What is different to a regular Vagrant VM is that uses a file called config.yml to configure the machine. Settings such as vagrant_hostname, drupalvm_webserver and drupal_core_path are stored as YAML and passed into the Vagrantfile and the playbook.yml file which is used when the Ansible provisioner runs.
-
-
In addition to some essential Ansible roles for installing and configuring packages such as Git, MySQL, PHP and Drush, there are also some roles that are conditional and only installed based on the value of other settings. These include Apache, Nginx, Solr, Varnish and Drupal Console.
-
-
What does the Drupal VM Generator do?
-
-
-
The Drupal VM Generator is a Symfony application that allows you to quickly create configuration files that are minimal and use-case specific.
-
-
-
Drupal VM comes with an example.config.yml file that shows all of the default variables and their values. When I first started using it, I’d make a copy of example.config.yml, rename it to config.yml and edit it as needed, but a lot of the examples aren’t needed for every use case. If you’re using Nginx as your webserver, then you don’t need the Apache virtual hosts. If you are not using Solr on this project, then you don’t need the Solr variables.
-
-
For a few months, I’ve kept and used boilerplace versions of config.yml - one for Apache and one for Nginx. These are minimal, so have most of the comments removed and only the variables that I regularly need, but these can still be quite time consuming to edit each time, and if there are additions or changes upstream, then I have two versions to maintain.
-
-
The Drupal VM Generator is a Symfony application that allows you to quickly create configuration files that are minimal and use-case specific. It uses the Console component to collect input from the user, Twig to generate the file, the Filesystem component to write it.
-
-
Based on the options passed to it and/or answers that you provide, it generates a custom, minimal config.yml file for your project.
-
-
Here’s an example of it in action:
-
-
-
-
You can also define options when calling the command and skip any or all questions. Running the following would bypass all of the questions and create a new file with no interaction or additional steps.
-
-
Where do I get it?
-
-
The project is hosted on GitHub, and there are installation instructions within the README.
-
-
-
-
The recommended method is via downloading the phar file (the same as Composer and Drupal Console). You can also clone the GitHub repository and run the command from there. I’m also wanting to upload it to Packagist so that it can be included if you manage your projects with Composer.
-
-
Please log any bugs or feature requests in the GitHub issue tracker, and I’m more than happy to receive pull requests.
-
-
If you’re interested in contributing, please feel free to fork the repository and start doing so, or contact me with any questions.
-
-
Update 17/02/16: The autoloading issue is now fixed if you require the package via Composer, and this has been tagged as the 1.0.1 release
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
xautoload is a Drupal module that enables the autoloading of PHP classes, in the same way that you would do so in a Composer based project such as Drupal 8 or Symfony.
-
-
It supports both the PSR-0 and PSR-4 standards, as well as providing a wildcard syntax for Drupal’s file[] syntax in .info files.
-
-
To use it, download and enable it from Drupal.org as you would for any other module, and then add it as a dependency within your module. The xautoload project page suggests including a minimum version in this format:
-
-
dependencies[] = xautoload (>= 7.x-5.0)
-
-
-
This will ensure that the version of xautoload is 7.x-5.0 or newer.
-
-
How to use it
-
-
Wildcard syntax for .info files
-
-
Here is an example .info file for a migrate module.
In this example, each custom migration class is stored in it’s own file within the includes directory, and each class needs to be loaded separately using the files[] = filename syntax.
-
-
One thing that the xautoload module does to enable for the use of wildcards within this syntax. By using wildcards, the module file can be simplified as follows:
-
-
files[] = includes/**/*.inc
-
-
-
This will load any .inc files within the includes directory as well as any sub-directories, like 'node' in the original example.
-
-
This means that any new migration classes that are added will be automatically loaded, so you don’t need to declare each include separately within foo_migrate.info again. The great thing about this approach is that it works with the existing directory and file structure.
-
-
Use the PSR-4 structure
-
-
If you want to use the PSR-4 approach, you can do that too.
-
-
In order to do so, you’ll need to complete the following steps:
-
-
-
Rename the includes directory to src.
-
Ensure that there is one PHP class per file, and that the file extension is .php rather than .inc.
-
Ensure that the name of the file matches the name of the class - FooArticleNodeMigration would be in a file called FooArticleNodeMigration.php.
-
Add a namespace to each PHP file. This uses the same format as Drupal 8, including the machine name of the module. For example, Drupal\foo_migrate.
-
-
-
If the class is within a sub-directory, then this will also need to be included within the namespace - e.g. Drupal\foo_migrate\Node.
-
You’ll also need to import any class names that you are referencing, including class names that are you extending, by adding use statements at the top of the file. You may be able to prefix it with \ instead (e.g. \DrupalNode6Migration), but I prefer to use imports.
With these steps completed, any imports within your .info file can be removed as they are no longer needed and any classes will be loaded automatically.
-
-
Within foo_migrate.migrate.inc, I can now reference any class names using their full namespace:
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Earlier this week I wrote a small PHP library called GmailFilterBuilder that allows you to write Gmail filters in PHP and export them to XML.
-
-
I was already aware of a Ruby library called gmail-britta that does the same thing, but a) I’m not that familiar with Ruby so the syntax wasn’t that natural to me - it’s been a while since I wrote any Puppet manifests, and b) it seemed like a interesting little project to work on one evening.
-
-
The library contains two classes - GmailFilter which is used to create each filter, and GmailFilterBuilder that parses the filters and generates the XML using a Twig template.
In this case, an email from example@test.com would be archived, never marked as spam, and have a label of "Test" added to it.
-
-
With this code written, and the GmailFilterBuilder library installed via Composer, I can run php test.php and have the XML written to the screen.
-
-
This can also be written to a file - php test.php > filters.xml - which can then be imported into Gmail.
-
-
Twig Extensions
-
-
I also added a custom Twig extension that I moved into a separate twig-extensions library so that I and other people can re-use it in other projects.
-
-
It’s a simple filter that accepts a boolean and returns true or false as a string, but meant that I could remove three ternary operators from the template and replace them with the boolean_string filter.
-
-
Before:
-
-
{{ filter.isArchive ? 'true' : 'false' }}
-
-
-
After:
-
-
{{ filter.isArchive|boolean_string }}
-
-
-
This can then be used to generate output like this, whereas having blank values would have resulted in errors when importing to Gmail.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
I spent some time yesterday working on the Drupal VM Generator, and have released versions 2.8.1, 2.9.0 and 2.9.1.
-
-
The main updates are:
-
-
-
Fixed an InvalidResponseException that was thrown from within the boolean_as_string Twig filter from the opdavies/twig-extensions library when the config:generate command was run in non-interactive mode.
-
Adding a working test suite for the existing commands, using PhpUnit and Symfony’s Process component. This is now linked to Travis CI, and the tests are run on each commit and pull request.
-
The version requirements have been changed to allow 2.7 versions of the used Symfony Components, as well as the 3.x versions. This was done to resolve a conflict when also installing Drush globally with Composer.
-
-
-
Next Steps
-
-
Currently the project is based on Drupal VM 3.0.0 which is an outdated version (4.1.0 was released today). Adding updates and supporting the newer versions is a high priority, as well as keeping in sync with new releases. This will be easier with the test suite in place.
-
-
My initial thoughts are that version 2.10.0 will support Drupal VM 4.0.0, and if needed, 2.11.0 will ship shortly afterwards and support Drupal VM 4.1.0.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Easier Sculpin Commands with Composer and NPM Scripts
-
-
7th January 2017
-
-
My website includes several various command line tools - e.g. Sculpin, Gulp and Behat - each needing different arguments and options, depending on the command being run. For example, for Sculpin, I normally include several additional options when viewing the site locally - the full command that I use is ./vendor/bin/sculpin generate --watch --server --clean --no-interaction. Typing this repeatedly is time consuming and could be easily mis-typed, forgotten or confused with other commands.
-
-
In this video, I show you how I've simplied my Sculpin and Gulp workflow using custom Composer and NPM scripts.
-
-
-
-
-
-
Scripts
-
-
Here are the scripts that I’m using - they are slightly different from those in the video. I use the --generate and --watch options for Sculpin and the gulp watch command for NPM. I had to change these before the recording as I was using the demo magic script to run the commands, and existing from a watch session was also ending the script process.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
This is an example of how my Nginx configuration looked to redirect from an old domain to a new one, and also to redirect from the root example.com domain to the canonical www subdomain.
It also redirects the URI value, e.g. from http://example.com/test to http://example.com/test, but I noticed recently though that any the query string would be lost - e.g. http://example.com/?test would redirect to http://www.example.com and the ?test would be dropped. The application that I built references images based on the query string, so I wanted these to be included within the redirect.
-
-
This was fixed by making a small change to my return statement.
$is_args is an empty string if there are no arguments, or a ? to signify the start of the query string. $args then adds the arguments ($query_string could also be used with the same result).
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
TL;DR You need to include the name of your web server container as the --url option to run-scripts.php.
-
-
I’ve been a Drupal VM user for a long time, but lately I’ve been using a combination Drupal VM and Docker for my local development environment. There were a couple of issues preventing me from completely switching to Docker - one of which being that when I tried running of my Simpletest tests, a lot of them would fail where they would pass when run within Drupal VM.
-
-
Here’s an excerpt from my docker-compose.yml file:
This creates a new instance of the php container, sets the working directory to my Drupal root and runs Drupal’s run-tests.sh script with some arguments. In this case, I'm running the OverrideNodeOptionsTestCase class for the override_node_options tests. Once complete, the container is deleted because of the --rm option.
-
-
This resulted in 60 of the 112 tests failing, whereas they all passed when run within a Drupal VM instance.
-
-
Test summary
-------------
-
-Override node options 62 passes, 60 fails, 29 exceptions, and 17 debug messages
-
-Test run duration: 2 min 25 sec
-
-
-
Running the tests again with the--verbose option, I saw this message appear in the output below some of the failing tests:
-
-
-
simplexml_import_dom(): Invalid Nodetype to import
After checking that I had all of the required PHP extensions installed, I ran docker-compose exec php bash to connect to the php container and ran curl http://localhost to check the output. Rather than seeing the HTML for the site, I got this error message:
-
-
-
curl: (7) Failed to connect to localhost port 80: Connection refused
-
-
-
Whereas curl http://nginx returns the HTML for the page, so included it with the --url option to run-tests.sh, and this resulted in my tests all passing.
Test summary
-------------
-
-Override node options 121 passes, 0 fails, 0 exceptions, and 34 debug messages
-
-Test run duration: 2 min 31 sec
-
-
-
Note: In this example I have separate nginx and php containers, but I've tried and had the same issue when running Nginx and PHP-FPM in the same container - e.g. called app - and still needed to add --url http://app in order for the tests to run successfully.
-
-
I don’t know if this issue is macOS specfic (I know that Drupal CI is based on Docker, and I don’t know if it’s an issue) but I’m going to test also on my Ubuntu Desktop environment and investigate further and also compare the test run times for Docker in macOS, Docker in Ubuntu and within Drupal VM. I’m also going to test this with PHPUnit tests with Drupal 8.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
DrupalCamp Bristol 2017 - Early Bird Tickets, Call for Sessions, Sponsors
-
-
15th May 2017
-
-
-
-
In less than two months time, DrupalCamp Bristol will be back for our third year! (July seems to come around quicker each year). This is this year’s schedule and venues:
Today we announced Emma Karayiannis as our Saturday keynote speaker, and we’ll be announcing some of the other speakers later this week.
-
-
Not submitted your session yet? The session submissions are open until May 31st. We’re looking for talks not only on Drupal, but other related topics such as PHP, Symfony, server administration/DevOps, project management, case studies, being human etc. If you want to submit but want to ask something beforehand, please send us an email or ping us on Twitter.
-
-
Not spoken at a DrupalCamp before? No problem. We’re looking for both new and experienced speakers, and have both long (45 minutes) and short (20 minutes) talk slots available.
-
-
Not bought your tickets yet? Early bird tickets for the CXO and conference days are still available! The sprint day tickets are free but limited, so do register for a ticket to claim your place.
-
-
We still have sponsorships opportunities available (big thanks to Microserve, Deeson and Proctors) who have already signed up), but be quick if you want to be included in our brochure so that we can get you added before our print deadline! Without our sponsors, putting on this event each year would not be possible.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Yesterday I was fixing a bug in an inherited Drupal 7 custom module, and I decided that I was going to add some tests to ensure that the bug was fixed and doesn’t get accidentially re-introduced in the future. The test though required me to have a particular content type and fields which are specific to this site, so weren’t present within the standard installation profile used to run tests.
-
-
I decided to convert the custom module into a Feature so that the content type and it’s fields could be added to it, and therefore present on the testing site once the module is installed.
-
-
To do this, I needed to expose the module to the Features API.
-
-
All that’s needed is to add this line to the mymodule.info file:
-
-
features[features_api][] = api:2
-
-
-
After clearing the cache, the module is now visible in the Features list - and ready to have the appropriate configuration added to it.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
The Drupal Meetups Twitterbot is a small project that I worked on a few months ago, but hadn't got around to promoting yet. It’s intention is to provide one Twitter account where people can get the up to date news from various Drupal meetups.
-
-
It works by having a whitelist of Twitter accounts and hashtags to search for, uses Codebird to query the Twitter API and retweets any matching tweets on a scheduled basis.
-
-
If you would like your meetup group to be added to the list of searched accounts, please open an issue on the GitHub repo.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
Earlier this week I moved this site from my personal Linode server to GitHub Pages.
-
-
This made sense as I already kept the source code in on GitHub, the issue was that GitHub Pages doesn’t know how to dynamically parse and generate a Sculpin site like it does with some other static site generators. It can though parse and serve HTML files, which is what Sculpin generates. It’s just a case of how those files are added to GitHub.
-
-
I’ve seen different implementations of this, mostly where the Sculpin code is on one branch, and the generated HTML code is on a separate gh-pages or master branch (depending on your repository name). I’m not fond of this approach as it means automatically checking out and merging branches which can get messy, and also it’s weird to look at a repo’s branches page and see one branch maybe tens or hundreds of commits both ahead and behind the default branch.
-
-
This has been made simpler and tidier now that we can use a docs directory within the repository to serve content.
-
-
-
-
This means that I can simply re-generate the site after making changes and add it as an additional commit to my main branch with no need to switch branches or perform a merge.
-
-
To simplify this, I’ve added a new publish.sh script into my repository to automate the sites. This is how it currently looks:
-
-
#!/usr/bin/env bash
-
-SITE_ENV="prod"
-
-# Remove the existing docs directory, build the site and create the new
-# docs directory.
-rm -rf ./docs
-vendor/bin/sculpin generate --no-interaction --clean --env=${SITE_ENV}
-touch output_${SITE_ENV}/.nojekyll
-mv output_${SITE_ENV} docs
-
-# Ensure the correct Git variables are used.
-git config --local user.name 'Oliver Davies'
-git config --local user.email oliver@oliverdavies.uk
-
-# Add, commit and push the changes.
-git add --all docs
-git commit -m 'Build.'
-git push origin HEAD
-
-
-
This begins by removing the deleting the existing docs directory and re-generating the site with the specified environment. Then I add a .nojekyll file and rename the output directory to replace docs.
-
-
Now the changes can be added, committed and pushed. Once pushed, the new code is automatically served by GitHub Pages.
As the site was previously using HTTPS, I didn’t want to have to go back to HTTP, break any incoming links and lose any potential traffic. To continue using HTTPS, I decided to use Cloudflare to serve the site via their CDN which does allow for HTTPS traffic.
-
-
Next Steps
-
-
-
Enable automatically running publish.sh when new changes are pushed to GitHub rather than running it manually. I was previously using Jenkins and Fabric for this, though I’m also going to look into using Travis to accomplish this.
-
Add the pre-build steps such as running composer install and yarn to install dependencies, and gulp to create the front-end assets. This was previously done by Jenkins in my previous setup.
Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/accessible-bristol-site-launched/index.html b/docs/blog/accessible-bristol-site-launched/index.html
deleted file mode 100644
index 7fa5c077..00000000
--- a/docs/blog/accessible-bristol-site-launched/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/add-date-popup-calendar-custom-form/index.html b/docs/blog/add-date-popup-calendar-custom-form/index.html
deleted file mode 100644
index 204817c3..00000000
--- a/docs/blog/add-date-popup-calendar-custom-form/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/add-taxonomy-term-multiple-nodes-using-sql/index.html b/docs/blog/add-taxonomy-term-multiple-nodes-using-sql/index.html
deleted file mode 100644
index b3285f35..00000000
--- a/docs/blog/add-taxonomy-term-multiple-nodes-using-sql/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/adding-custom-theme-templates-drupal-7/index.html b/docs/blog/adding-custom-theme-templates-drupal-7/index.html
deleted file mode 100644
index a7d92d8b..00000000
--- a/docs/blog/adding-custom-theme-templates-drupal-7/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/announcing-the-drupal-vm-config-generator/index.html b/docs/blog/announcing-the-drupal-vm-config-generator/index.html
deleted file mode 100644
index 17efc2c6..00000000
--- a/docs/blog/announcing-the-drupal-vm-config-generator/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/announcing-the-drupal-vm-generator/index.html b/docs/blog/announcing-the-drupal-vm-generator/index.html
deleted file mode 100644
index 17efc2c6..00000000
--- a/docs/blog/announcing-the-drupal-vm-generator/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/automating-sculpin-jenkins/index.html b/docs/blog/automating-sculpin-jenkins/index.html
deleted file mode 100644
index 87ff4a72..00000000
--- a/docs/blog/automating-sculpin-jenkins/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/building-gmail-filters-with-php/index.html b/docs/blog/building-gmail-filters-with-php/index.html
deleted file mode 100644
index c4f1d08c..00000000
--- a/docs/blog/building-gmail-filters-with-php/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/change-content-type-multiple-nodes-using-sql/index.html b/docs/blog/change-content-type-multiple-nodes-using-sql/index.html
deleted file mode 100644
index 379e7965..00000000
--- a/docs/blog/change-content-type-multiple-nodes-using-sql/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/checking-if-user-logged-drupal-right-way/index.html b/docs/blog/checking-if-user-logged-drupal-right-way/index.html
deleted file mode 100644
index f7d82ed4..00000000
--- a/docs/blog/checking-if-user-logged-drupal-right-way/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/checkout-specific-revision-svn-command-line/index.html b/docs/blog/checkout-specific-revision-svn-command-line/index.html
deleted file mode 100644
index 6e019bd9..00000000
--- a/docs/blog/checkout-specific-revision-svn-command-line/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/conditional-email-addresses-webform/index.html b/docs/blog/conditional-email-addresses-webform/index.html
deleted file mode 100644
index 4318bd4f..00000000
--- a/docs/blog/conditional-email-addresses-webform/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-a-zen-sub-theme-using-drush/index.html b/docs/blog/create-a-zen-sub-theme-using-drush/index.html
deleted file mode 100644
index b61a963a..00000000
--- a/docs/blog/create-a-zen-sub-theme-using-drush/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-and-apply-patches/index.html b/docs/blog/create-and-apply-patches/index.html
deleted file mode 100644
index 11be7baf..00000000
--- a/docs/blog/create-and-apply-patches/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-better-photo-gallery-drupal-part-1/index.html b/docs/blog/create-better-photo-gallery-drupal-part-1/index.html
deleted file mode 100644
index aee249bf..00000000
--- a/docs/blog/create-better-photo-gallery-drupal-part-1/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-better-photo-gallery-drupal-part-2/index.html b/docs/blog/create-better-photo-gallery-drupal-part-2/index.html
deleted file mode 100644
index 99eaf3a4..00000000
--- a/docs/blog/create-better-photo-gallery-drupal-part-2/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-better-photo-gallery-drupal-part-21/index.html b/docs/blog/create-better-photo-gallery-drupal-part-21/index.html
deleted file mode 100644
index 997d5c76..00000000
--- a/docs/blog/create-better-photo-gallery-drupal-part-21/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-better-photo-gallery-drupal-part-3/index.html b/docs/blog/create-better-photo-gallery-drupal-part-3/index.html
deleted file mode 100644
index 7c1aed4d..00000000
--- a/docs/blog/create-better-photo-gallery-drupal-part-3/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-block-social-media-icons-using-cck-views-and-nodequeue/index.html b/docs/blog/create-block-social-media-icons-using-cck-views-and-nodequeue/index.html
deleted file mode 100644
index e286b849..00000000
--- a/docs/blog/create-block-social-media-icons-using-cck-views-and-nodequeue/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-flickr-photo-gallery-using-feeds-cck-and-views/index.html b/docs/blog/create-flickr-photo-gallery-using-feeds-cck-and-views/index.html
deleted file mode 100644
index 826928c3..00000000
--- a/docs/blog/create-flickr-photo-gallery-using-feeds-cck-and-views/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-multigroups-drupal-7-using-field-collections/index.html b/docs/blog/create-multigroups-drupal-7-using-field-collections/index.html
deleted file mode 100644
index 79e79820..00000000
--- a/docs/blog/create-multigroups-drupal-7-using-field-collections/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-omega-subtheme-less-css-preprocessor-using-omega-tools-and-drush/index.html b/docs/blog/create-omega-subtheme-less-css-preprocessor-using-omega-tools-and-drush/index.html
deleted file mode 100644
index 51ae05eb..00000000
--- a/docs/blog/create-omega-subtheme-less-css-preprocessor-using-omega-tools-and-drush/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-slideshow-multiple-images-using-fancy-slide/index.html b/docs/blog/create-slideshow-multiple-images-using-fancy-slide/index.html
deleted file mode 100644
index 13c2e8ba..00000000
--- a/docs/blog/create-slideshow-multiple-images-using-fancy-slide/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/create-virtual-hosts-mac-os-x-using-virtualhostx/index.html b/docs/blog/create-virtual-hosts-mac-os-x-using-virtualhostx/index.html
deleted file mode 100644
index 958a5516..00000000
--- a/docs/blog/create-virtual-hosts-mac-os-x-using-virtualhostx/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/creating-and-using-custom-tokens-drupal-7/index.html b/docs/blog/creating-and-using-custom-tokens-drupal-7/index.html
deleted file mode 100644
index aae3dadc..00000000
--- a/docs/blog/creating-and-using-custom-tokens-drupal-7/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/creating-local-and-staging-sites-drupals-domain-module-enabled/index.html b/docs/blog/creating-local-and-staging-sites-drupals-domain-module-enabled/index.html
deleted file mode 100644
index 33536c24..00000000
--- a/docs/blog/creating-local-and-staging-sites-drupals-domain-module-enabled/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/display-custom-menu-drupal-7-theme-template-file/index.html b/docs/blog/display-custom-menu-drupal-7-theme-template-file/index.html
deleted file mode 100644
index 8d3daa48..00000000
--- a/docs/blog/display-custom-menu-drupal-7-theme-template-file/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/display-git-branch-or-tag-names-your-bash-prompt/index.html b/docs/blog/display-git-branch-or-tag-names-your-bash-prompt/index.html
deleted file mode 100644
index 245ed12e..00000000
--- a/docs/blog/display-git-branch-or-tag-names-your-bash-prompt/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/display-number-facebook-fans-php/index.html b/docs/blog/display-number-facebook-fans-php/index.html
deleted file mode 100644
index 0c70e1c6..00000000
--- a/docs/blog/display-number-facebook-fans-php/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/dividing-drupals-process-and-preprocess-functions-separate-files/index.html b/docs/blog/dividing-drupals-process-and-preprocess-functions-separate-files/index.html
deleted file mode 100644
index f72af321..00000000
--- a/docs/blog/dividing-drupals-process-and-preprocess-functions-separate-files/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/dont-bootstrap-drupal-use-drush/index.html b/docs/blog/dont-bootstrap-drupal-use-drush/index.html
deleted file mode 100644
index 876507ad..00000000
--- a/docs/blog/dont-bootstrap-drupal-use-drush/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/download-different-versions-drupal-drush/index.html b/docs/blog/download-different-versions-drupal-drush/index.html
deleted file mode 100644
index 7cb5a7fe..00000000
--- a/docs/blog/download-different-versions-drupal-drush/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/drupal-association/index.html b/docs/blog/drupal-association/index.html
deleted file mode 100644
index c3b8211a..00000000
--- a/docs/blog/drupal-association/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/drupal-vm-generator-291-released/index.html b/docs/blog/drupal-vm-generator-291-released/index.html
deleted file mode 100644
index 3ad7b0f4..00000000
--- a/docs/blog/drupal-vm-generator-291-released/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/drupalcamp-london-2014/index.html b/docs/blog/drupalcamp-london-2014/index.html
deleted file mode 100644
index 977fe060..00000000
--- a/docs/blog/drupalcamp-london-2014/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/drush-make-drupalbristol/index.html b/docs/blog/drush-make-drupalbristol/index.html
deleted file mode 100644
index e92229fb..00000000
--- a/docs/blog/drush-make-drupalbristol/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/easier-sculpin-commands-with-composer-and-npm-scripts/index.html b/docs/blog/easier-sculpin-commands-with-composer-and-npm-scripts/index.html
deleted file mode 100644
index c9f38ad0..00000000
--- a/docs/blog/easier-sculpin-commands-with-composer-and-npm-scripts/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/easily-embed-typekit-fonts-your-drupal-website/index.html b/docs/blog/easily-embed-typekit-fonts-your-drupal-website/index.html
deleted file mode 100644
index 0c0b7647..00000000
--- a/docs/blog/easily-embed-typekit-fonts-your-drupal-website/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/fix-vagrant-loading-wrong-virtual-machine/index.html b/docs/blog/fix-vagrant-loading-wrong-virtual-machine/index.html
deleted file mode 100644
index 32a4b3d4..00000000
--- a/docs/blog/fix-vagrant-loading-wrong-virtual-machine/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/forward-one-domain-another-using-modrewrite-and-htaccess/index.html b/docs/blog/forward-one-domain-another-using-modrewrite-and-htaccess/index.html
deleted file mode 100644
index be5f93f5..00000000
--- a/docs/blog/forward-one-domain-another-using-modrewrite-and-htaccess/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/git-format-patch/index.html b/docs/blog/git-format-patch/index.html
deleted file mode 100644
index f247dc9c..00000000
--- a/docs/blog/git-format-patch/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/going-drupalcon/index.html b/docs/blog/going-drupalcon/index.html
deleted file mode 100644
index 440727a2..00000000
--- a/docs/blog/going-drupalcon/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/how-to-define-a-minimum-drupal-core-version/index.html b/docs/blog/how-to-define-a-minimum-drupal-core-version/index.html
deleted file mode 100644
index 232367d4..00000000
--- a/docs/blog/how-to-define-a-minimum-drupal-core-version/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/imagefield-import-archive/index.html b/docs/blog/imagefield-import-archive/index.html
deleted file mode 100644
index 0ffff74d..00000000
--- a/docs/blog/imagefield-import-archive/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/improve-jpg-quality-imagecache-and-imageapi/index.html b/docs/blog/improve-jpg-quality-imagecache-and-imageapi/index.html
deleted file mode 100644
index 0ac5ad75..00000000
--- a/docs/blog/improve-jpg-quality-imagecache-and-imageapi/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/include-css-fonts-using-sass-each-loop/index.html b/docs/blog/include-css-fonts-using-sass-each-loop/index.html
deleted file mode 100644
index 965a1311..00000000
--- a/docs/blog/include-css-fonts-using-sass-each-loop/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/include-local-drupal-settings-file-environment-configuration-and-overrides/index.html b/docs/blog/include-local-drupal-settings-file-environment-configuration-and-overrides/index.html
deleted file mode 100644
index f0bc0e17..00000000
--- a/docs/blog/include-local-drupal-settings-file-environment-configuration-and-overrides/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/index.html b/docs/blog/index.html
deleted file mode 100644
index a888d412..00000000
--- a/docs/blog/index.html
+++ /dev/null
@@ -1,320 +0,0 @@
-
-
-
- Blog | Oliver Davies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Blog
-
-
-
-
Publishing Sculpin Sites with GitHub Pages
-
-
13th July 2017
-
-
-
-
-
Earlier this week I moved this site from my personal Linode server to GitHub Pages.
-
-
This made sense as I already kept the source code in on GitHub, the issue was that GitHub Pages doesn’t know how to dynamically parse and generate a Sculpin site like it does with some other static site generators. It can though parse and serve HTML files, which is what Sculpin generates. It’s just a case of how those files are added to GitHub.
The Drupal Meetups Twitterbot is a small project that I worked on a few months ago, but hadn't got around to promoting yet. It’s intention is to provide one Twitter account where people can get the up to date news from various Drupal meetups.
Yesterday I was fixing a bug in an inherited Drupal 7 custom module, and I decided that I was going to add some tests to ensure that the bug was fixed and doesn’t get accidentially re-introduced in the future. The test though required me to have a particular content type and fields which are specific to this site, so weren’t present within the standard installation profile used to run tests.
-
-
I decided to convert the custom module into a Feature so that the content type and it’s fields could be added to it, and therefore present on the testing site once the module is installed.
-
-
To do this, I needed to expose the module to the Features API.
DrupalCamp Bristol 2017 - Early Bird Tickets, Call for Sessions, Sponsors
-
-
15th May 2017
-
-
-
-
-
In less than two months time, DrupalCamp Bristol will be back for our third year! (July seems to come around quicker each year). This is this year’s schedule and venues:
I’ve been a Drupal VM user for a long time, but lately I’ve been using a combination Drupal VM and Docker for my local development environment. There were a couple of issues preventing me from completely switching to Docker - one of which being that when I tried running of my Simpletest tests, a lot of them would fail where they would pass when run within Drupal VM.
-
-
Here’s an excerpt from my docker-compose.yml file:
This is an example of how my Nginx configuration looked to redirect from an old domain to a new one, and also to redirect from the root example.com domain to the canonical www subdomain.
Earlier this week I wrote a small PHP library called GmailFilterBuilder that allows you to write Gmail filters in PHP and export them to XML.
-
-I was already aware of a Ruby library called gmail-britta that does the same thing, but a) I’m not that familiar with Ruby so the syntax …
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/install-and-configure-subversion-svn-server-ubuntu/index.html b/docs/blog/install-and-configure-subversion-svn-server-ubuntu/index.html
deleted file mode 100644
index 6091790d..00000000
--- a/docs/blog/install-and-configure-subversion-svn-server-ubuntu/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/install-nomensa-media-player-drupal/index.html b/docs/blog/install-nomensa-media-player-drupal/index.html
deleted file mode 100644
index 1ecf6a0b..00000000
--- a/docs/blog/install-nomensa-media-player-drupal/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/installing-nagios-centos/index.html b/docs/blog/installing-nagios-centos/index.html
deleted file mode 100644
index 9078138b..00000000
--- a/docs/blog/installing-nagios-centos/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/leaving-nomensa-joining-precedent/index.html b/docs/blog/leaving-nomensa-joining-precedent/index.html
deleted file mode 100644
index 7c6a9c95..00000000
--- a/docs/blog/leaving-nomensa-joining-precedent/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/my-new-drupal-modules/index.html b/docs/blog/my-new-drupal-modules/index.html
deleted file mode 100644
index 5e714c96..00000000
--- a/docs/blog/my-new-drupal-modules/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/my-sublime-text-2-settings/index.html b/docs/blog/my-sublime-text-2-settings/index.html
deleted file mode 100644
index 2e15b91b..00000000
--- a/docs/blog/my-sublime-text-2-settings/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/nginx-redirects-with-query-string-arguments/index.html b/docs/blog/nginx-redirects-with-query-string-arguments/index.html
deleted file mode 100644
index f0a2bc53..00000000
--- a/docs/blog/nginx-redirects-with-query-string-arguments/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/open-sublime-text-2-mac-os-x-command-line/index.html b/docs/blog/open-sublime-text-2-mac-os-x-command-line/index.html
deleted file mode 100644
index e9d46e23..00000000
--- a/docs/blog/open-sublime-text-2-mac-os-x-command-line/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/docs/blog/page/10.html b/docs/blog/page/10.html
deleted file mode 100644
index 424a3780..00000000
--- a/docs/blog/page/10.html
+++ /dev/null
@@ -1,248 +0,0 @@
-
-
-
- Blog | Oliver Davies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Blog
-
-
-
-
Conditional Email Addresses in a Webform
-
-
6th May 2010
-
-
-
I created a new Webform to serve as a simple Contact form, but left the main configuration until after I created the form components. I added 'Name', 'Email', 'Subject' and 'Message' fields, as well as a 'Category' select list. Below 'Options', I entered each of my desired options in the …
Whilst working on my own portfolio/testimonial website, I decided to have a portfolio page displaying the name of each site and a thumbnail image. For this Blog post, I'll be using a site called Popcorn Strips which I built for a friend earlier this year as an example.
-
-I created a …
Style Drupal 6's Taxonomy Lists with PHP, CSS and jQuery
-
-
5th April 2010
-
-
-
Whilst developing this, and other Drupal websites for clients, I decided that I wanted to categorise content using the taxonomy system. However, I wasn't happy with the way that Drupal displayed the terms lists by default, and I started comparing this to other websites that I look at.
-
-To start with, …
For the past few weeks I’ve been working on a personal side project, based on Drupal VM. It’s called the Drupal VM Generator, and over the weekend I’ve added the final features and fixed the remaining issues, and tagged the 1.0.0 release.
I recently had my first experience using the Entityform module in a project. It was quite easy to configure with different form types, but then I needed to embed the form into an overlay. I was expecting to use the drupal_get_form() function and render it, but this didn’t work.
-
-
Here are the steps that I took to be able to load, render and embed the form.
As part of re-building this site with Sculpin, I wanted to automate the deployments, as in I wouldn't need to run a script like publish.sh locally and have that deploy my code onto my server. Not only did that mean that my local workflow was simpler (update, commit and push, …
Sculpin
-
-People may or may not know, but this site runs on Sculpin, a PHP based static site generator (this may be the first time that I've mentioned it on this site). The source code is hosted on GitHub, and I've listed the site on the Community page on the Sculpin …
This week, my first code patch was committed to Drupal core. The patch adds the user_has_role() function to the user module, to simplify the way to check whether a user in Drupal has been assigned a specific role. This is something that I normally write a custom function for each …
Include a Local Drupal Settings file for Environment Configuration and Overrides
-
-
20th December 2014
-
-
-
How to create and include a local settings file to define and override environment-specific variables, and keep sensitive things like your database credentials and API keys safe.
Include environment-specific settings files on Pantheon
-
-
27th November 2014
-
-
-
I was recently doing some work on a site hosted on Pantheon and came across an issue, for which part of the suggested fix was to ensure that the $base_url variable was explicitly defined within settings.php (this is also best practice on all Drupal sites).
-
-
The way that was recommended was by using a switch() function based on Pantheon's environment variable. For example:
Updating Features and Adding Components Using Drush
-
-
21st October 2014
-
-
-
If you use the Features module to manage your Drupal configuration, it can be time consuming to update features through the UI, especially if you are working on a remote server and need to keep downloading and uploading files.
-
-
If you re-create a feature through the UI, you'll be prompted to download a new archive of the feature in its entirety onto your local computer. You could either commit this into a local repository and then pull it remotely, or use a tool such as SCP to upload the archive onto the server and commit it from there. You can simplify this process by using Drush.
How to fix Vagrant Loading the Wrong Virtual Machine
-
-
6th October 2014
-
-
-
A few times recently, I've had instances where Vagrant seems to have forgotten which virtual machine it's supposed to load, probably due to renaming a project directory or the .vagrant directory being moved accidentally.
-
-
Here are the steps that I took to fix this and point Vagrant back at the correct VM.
This is just a quick post to thank everyone for their comments and congratulations after my previous post about joining the Drupal Association. I’m looking forward to my first day in the job tomorrow.
If you use Drush, it's likely that you've used the drush pm-download (or drush dl for short) command to start a new project. This command downloads projects from Drupal.org, but if you don't specify a project or type "drush dl drupal", the command will download the current stable version of Drupal core. Currently, this will be Drupal 7 with that being the current stable version of core at the time of writing this post.
Testing a patch file is usually a two-step process. First you download the patch file from the source, and then you run a separate command to apply it.
-
-
You can save time and typing by running the two commands on one line:
There are times when doing Drupal development when you need to run a custom PHP script, maybe moving data from one field to another, that doesn't warrant the time and effort to create a custom module. In this scenario, it would be quicker to write a .php script and bootstrap Drupal to gain access to functions like node_load() and db_query().
-
-
To bootstrap Drupal, you would need to add some additional lines of code to the stop of your script. Here is an alternative way.
Creating Local and Staging sites with Drupal's Domain Module Enabled
-
-
17th July 2013
-
-
-
The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database. The issue is that the domains are stored within the database so these are copied across when the data is migrated between environments, whereas the domains are obviously going to change.
-
-
Rather than changing the domain settings within the Domain module itself, the best solution I think is to use table prefixes and create a different domain table per environment.
Display Git Branch or Tag Names in your Bash Prompt
-
-
27th April 2013
-
-
-
Whilst watching Drupalize.me's recent Introduction to Git series, I thought it was useful the way that the current Git branch or tag name was displayed in the bash prompt. Here's how to do it.
Checking if a user is logged into Drupal (the right way)
-
-
9th January 2013
-
-
-
I see this regularly when working on Drupal sites when someone wants to check whether the current user is logged in to Drupal (authenticated) or not (anonymous).
How to use SASS and Compass in Drupal 7 using Sassy
-
-
6th December 2012
-
-
-
I've recently started using SASS rather than LESS to do my CSS preprocessing - namely due to its integration with Compass and it's built-in CSS3 mixins. Here are three modules that provide the ability to use SASS within Drupal.
I'm happy to announce that the Accessible Bristol website was launched this week, on Drupal 7.
-
-
The site has been developed over the past few months, and uses the User Relationships and Privatemsg modules to provide a community-based platform where people with an interest in accessibility can register and network with each other.
Sublime Text 2 has been my text editor of choice for the past few months, and I use it at home, in work, and on any virtual machines that I run. So rather than having to manually re-enter my settings each time, I thought that I'd document them here for future reference.
-
-
These preferences ensure that the code is compliant with Drupal coding standards - using two spaces instead of a tab, no trailing whitespace, blank line at the end of a file etc.
Yesterday evening I went along and spoke at the UnifiedDiff meetup in Cardiff, having offered previously to do a presentation providing an introduction to Drupal.
Install and Configure the Nomensa Accessible Media Player in Drupal
-
-
14th July 2012
-
-
-
This week I released the first version of the Nomensa Accessible Media Player module for Drupal 7. Here's some instructions of how to install and configure it.
Dividing Drupal's process and preprocess functions into separate files
-
-
24th May 2012
-
-
-
If you use a lot of process and preprocess functions within your Drupal theme, then your template.php can get very long and it can become difficult to find a certain piece of code.
-
-
Following the example of the Omega theme, I've started separating my process and preprocess functions into their own files. For example, mytheme_preprocess_node can be placed within a preprocess/node.inc file, and mytheme_process_page can be placed within process/page.inc.
Prevent Apache from displaying text files within a web browser
-
-
23rd May 2012
-
-
-
When you download Drupal, there are several text files that are placed in the root of your installation. You don't want or need these to be visible to anyone attempting to view them in a browser - especially CHANGELOG.txt as that includes the exact version of Drupal you are running and could therefore have security implications.
-
-
Rather than delete these files or change the file permissions manually for each file, I can add the following lines into my VirtualHost configuration.
Today, I had a situation where I was displaying a list of teasers for news article nodes. The article content type had several different fields assigned to it, including main and thumbnail images. In this case, I wanted to have different output and fields displayed when a teaser was displayed compared to when a complete node was displayed.
-
-
I have previously seen it done this way by adding this into in a node.tpl.php file:
A great post details that details the steps needed to install Nagios - a popular open source system and network monitoring software application - on CentOS.
-
-http://saylinux.net/story/009506/how-install-nagios-centos-55
- …
Create an Omega Subtheme with LESS CSS Preprocessor using Omega Tools and Drush
-
-
16th April 2012
-
-
-
In this tutorial I'll be showing how to create an Omega subtheme using the Omega Tools module, and have it working with the LESS CSS preprocessor.
-
-The first thing that I need to do is download the Omega theme and the Omega Tools and LESS modules, and then to enable both …
How to use Authorized Keys to Create a Passwordless SSH Connection
-
-
1st February 2012
-
-
-
If you're accessing Linux servers or automating tasks between servers, rather than having to enter your user password every time, you can also use SSH public key authentication. This is a simple process that involves creating a local key and storing it within the authorized_keys file on the remote server.
-
-
-Check …
As the vast majority of the Drupal websites that I currently work on are built on Drupal 7, I thought that it was time that I upgraded this site. Following the core upgrade process and the CCK migration process, everything was upgraded smoothly without any issues.
-
-I've upgraded a handful of …
How to Install and Configure Subversion (SVN) Server on Ubuntu
-
-
19th October 2011
-
-
-
Recently, I needed to set up a Subversion (SVN) server on a Ubuntu Linux server. This post is going to outline the steps taken, and the commands used, to install and configure the service.
-
-Note: As I was using Ubuntu, I was using the 'apt-get' command to download and install the …
Create Multigroups in Drupal 7 using Field Collections
-
-
28th August 2011
-
-
-
One of my favourite things lately in Drupal 6 has been CCK 3, and more specifically, the Content Multigroups sub-module. Basically this allows you to create a fieldset of various CCK fields, and then repeat that multiple times. For example, I use it on this site whist creating invoices for …
I've finally uploaded my first module onto Drupal.org!
-
-I've written many custom modules, although the vast majority of them are either small tweaks for my own sites, or company/site-specific modules that wouldn't be good to anyone else, so there would be nothing achieved by contributing them back to the community. Previously, …
My employer, Proctor & Stevenson, are going to be hosting the next Bristol & South West Drupal meetup on the 25th May at our offices.
-
-You can view more details, or register on our website.
- …
2 weeks ago, I handed in my notice of resignation to Horse & Country TVbecause I've been offered a new role at Proctor & Stevenson - a Marketing Design and Communications agency in Bristol.
-
-Proctors have an extensive client list - including BMW, Panasonic, the Open University and VOSA, and it's …
Replace the $page_id value with your Page ID number (unless you want to show the number of fans for this site).You can find your Page ID by logging into your Facebook account, going to 'Adverts and Pages', clicking 'Edit page', and looking at the URL.
-
-For example, mine is https://www.facebook.com/pages/edit/?id=143394365692197&sk=basic.
-
-I've also …
Easily Embed TypeKit Fonts into your Drupal Website
-
-
14th February 2011
-
-
-
To begin with, you will need to register for a TypeKit account - there is a free version if you just want to try it out.
-
-Next, you'll need to create a kit that contains the fonts that you want to use on your website. I've used FF Tisa Web Pro.
-
-Under …
Use Regular Expressions to Search and Replace in Coda or TextMate
-
-
4th November 2010
-
-
-
As in the original post, I'd generated a list of node ID values, and needed to add structure the SQL update statment formatted in a certain way. However, I changed my inital query slightly to out put the same nid value twice.
-
-SELECT nid, nid FROM node WHERE TYPE = 'blog' …
Create a Better Photo Gallery in Drupal - Part 2.1
-
-
22nd October 2010
-
-
-
Today, I realised that I hadn't published the code that I used to create the total figures of galleries and photos at the top of the gallery (I said at the end of Part 2 that I'd include it in Part 3, but I forgot). So, here it is:
-
-<?php
-
-// Queries …
The next part of the new gallery that I want to implement is to group the galleries by their respective categories. The first step is to edit my original photo_gallery view and add an additional display.
-
-I've called it 'Taxonomy', and it's similar to the original 'All Galleries' view. The differences …
Earlier this year, I posted a solution to an issue on the Drupal.org issue queue. Originally, I just posted the code back onto the issue, but have now created a patch that can easily be applied to any Drupal 6 installation. Here is a run-through of the process of creating and applying a patch. In this case, I made changes to the user_pass_validate() function that's found within modules/user/user.pages.inc.
The Inaugural Meetup for the South Wales Drupal User Group
-
-
26th September 2010
-
-
-
If you do Drupal, and you're in the area, come and join us for the first South Wales Drupal User Group Meetup!
-
-We'll be meeting in the communal area just outside of the SubHub HQ, at:
-
-4, The Studios
-3 Burt Street
-Cardiff
-CF10 5FZ
-
-For more information and to signup, visit http://groups.drupal.org/node/95104.
- …
Up until as recent as last week, whenever I added an image into one of my Blog posts, I was manually adding the caption below each image and styling it accordingly. That was until I installed the Image Caption module.
-
-The Image Caption module uses jQuery to dynamically add captions to …
At the end of my last post, I'd finished creating the first part of the new photo gallery, but I wanted to change the dates of the published photos to reflect the ones on the client's original website.
-
-Firstly, I'll refer to the previous list of published galleries that …
Recently, I converted a client's static HTML website, along with their Coppermine Photo Gallery, into a Drupal-powered website.
-
-Over the next few posts, I'll be replicating the process that I used during the conversion, and how I added some additional features to my Drupal gallery.
-
-To begin with, I created my photo …
Sorry for the lack of Blog posts lately, but my new job that I started a few weeks ago has certainly been keeping me busy! I've got a few more posts that I'm preparing content for, and I'll hopefully be back into my weekly-post routine before too long!
-
-Today, I'd like …
As a heavily-reliant Quicksilver user on my MacBook Pro, I was glad when I found the Teleport module for Drupal (due to Elliott Rothman's tweet).
-
-When you press a configurable hot-key, a jQuery dialog box appears where you can search for nodes by title or path, or directly enter the path …
Update: This can also be done using the Views Bulk Operations module.
-
-In preparation for my Blog posts being added to Drupal Planet, I needed to create a new Taxonomy term (or, in this case, tag) called 'Drupal Planet', and assign it to new content to imported into their aggregator. After …
Create Virtual Hosts on Mac OS X Using VirtualHostX
-
-
2nd July 2010
-
-
-
This isn't a Drupal related topic per se, but it is a walk-through of one of the applications that I use whilst doing Drupal development work. I assume, like most Mac OS X users, I use MAMP to run Apache, MySQL and PHP locally whilst developing. I also use virtual …
Change the Content Type of Multiple Nodes Using SQL
-
-
1st July 2010
-
-
-
In this post, I will be changing values within my Drupal 6 site's database to quickly change the content type of multiple nodes. I will be using a test development site with the core Blog module installed, and converting Blog posts to a custom content type called 'News article'.
-
-Before changing …
Create a Flickr Photo Gallery Using Feeds, CCK and Views
-
-
28th June 2010
-
-
-
In this tutorial, I'll show you how to create a photo gallery which uses photos imported from Flickr.
-
-The modules that I'll use to create the Gallery are:
-
-
-CCK
-Feeds
-Feeds Image Grabber
-FileField
-ImageAPI
-ImageCache
-ImageField
-Views
-
-
-The first thing that I did was to create a content type to store my imported images. I named it 'Photo', removed …
Aside from the obvious candidates such as Views, CCK etc, here are a list of 10 contributed modules that I currently use on each Drupal project.
-
-So, in no particular order:
-
-
-Admin: The admin module provides UI improvements to the standard Drupal admin interface. I've just upgraded to the new 6.x-2.0-beta4 version, …
Create a Block of Social Media Icons using CCK, Views and Nodequeue
-
-
23rd June 2010
-
-
-
I recently decided that I wanted to have a block displayed in a sidebar on my site containing icons and links to my social media profiles - Twitter, Facebook etc. I tried the Follow module, but it lacked the option to add extra networks such my Drupal.org account, and my …
Whilst uploading images for my Projects and Testimonials sections, I noticed that the Imagecache-scaled images weren't as high a quality the originals on my Mac. I did some searching online and found out that, by default, Drupal resamples uploaded jpgs to 75% of their original quality.
-
-To increase the quality of …
Quickly Import Multiples Images Using the Imagefield_Import Module
-
-
29th May 2010
-
-
-
Thanks to Bob at Mustardseed Media for tweeting about this module. It's undoubtedly saved me hours of work today alone!
-
-I've recently started a personal project converting a website to Drupal. It's currently a static HTML/CSS site which also uses the Coppermine Photo Gallery. As part of building the new website, …
Create a Slideshow of Multiple Images Using Fancy Slide
-
-
25th May 2010
-
-
-
Whilst updating my About page, I thought about creating a slideshow of several images instead of just the one static image. When I looking on Drupal.org, the only slideshow modules were to create slideshows of images that were attached to different nodes - not multiple images attached to one node. …
If you use the Zen theme, then you should also be using the Zenophile module!
-
-The Zenophile module allows you to very quickly create Zen subthemes from within your web browser, as well as editing options such as the site directory where it should be placed, the layout type (fixed or …
I'm happy to announce that the Accessible Bristol website was launched this week, on Drupal 7.
-
-
The site has been developed over the past few months, and uses the User Relationships and Privatemsg modules to provide a community-based platform where people with an interest in accessibility can register and network with each other.
-
-
-
- Install and Configure the Nomensa Accessible Media Player in Drupal
- https://www.oliverdavies.uk/blog/2012/07/14/install-nomensa-media-player-drupal/
- https://www.oliverdavies.uk/blog/2012/07/14/install-nomensa-media-player-drupal/
- Sat, 14 Jul 2012 00:00:00 +0000
-
This week I released the first version of the Nomensa Accessible Media Player module for Drupal 7. Here's some instructions of how to install and configure it.
-
-
-
- My new Drupal modules
- https://www.oliverdavies.uk/blog/2012/07/12/my-new-drupal-modules/
- https://www.oliverdavies.uk/blog/2012/07/12/my-new-drupal-modules/
- Thu, 12 Jul 2012 00:00:00 +0000
-
After a busy few days, I've released two new contrib Drupal modules.
I'm happy to announce that the Accessible Bristol website was launched this week, on Drupal 7.
-
-
The site has been developed over the past few months, and uses the User Relationships and Privatemsg modules to provide a community-based platform where people with an interest in accessibility can register and network with each other.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/apache.xml b/docs/blog/tags/apache.xml
deleted file mode 100644
index 27c022fe..00000000
--- a/docs/blog/tags/apache.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Prevent Apache from displaying text files within a web browser
- https://www.oliverdavies.uk/blog/2012/05/23/prevent-apache-displaying-text-files-within-web-browser/
- https://www.oliverdavies.uk/blog/2012/05/23/prevent-apache-displaying-text-files-within-web-browser/
- Wed, 23 May 2012 00:00:00 +0000
-
When you download Drupal, there are several text files that are placed in the root of your installation. You don't want or need these to be visible to anyone attempting to view them in a browser - especially CHANGELOG.txt as that includes the exact version of Drupal you are running and could therefore have security implications.
-
-
Rather than delete these files or change the file permissions manually for each file, I can add the following lines into my VirtualHost configuration.
-
-
-
- Forward one domain to another using mod_rewrite and .htaccess
- https://www.oliverdavies.uk/blog/2012/05/23/forward-one-domain-another-using-modrewrite-and-htaccess/
- https://www.oliverdavies.uk/blog/2012/05/23/forward-one-domain-another-using-modrewrite-and-htaccess/
- Wed, 23 May 2012 00:00:00 +0000
-
How to use the .htaccess file to forward to a different domain.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/code.xml b/docs/blog/tags/code.xml
deleted file mode 100644
index e22c1bb6..00000000
--- a/docs/blog/tags/code.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Dividing Drupal's process and preprocess functions into separate files
- https://www.oliverdavies.uk/blog/2012/05/24/dividing-drupals-process-and-preprocess-functions-separate-files/
- https://www.oliverdavies.uk/blog/2012/05/24/dividing-drupals-process-and-preprocess-functions-separate-files/
- Thu, 24 May 2012 00:00:00 +0000
-
If you use a lot of process and preprocess functions within your Drupal theme, then your template.php can get very long and it can become difficult to find a certain piece of code.
-
-
Following the example of the Omega theme, I've started separating my process and preprocess functions into their own files. For example, mytheme_preprocess_node can be placed within a preprocess/node.inc file, and mytheme_process_page can be placed within process/page.inc.
-
-
-
- Writing a .info file for a Drupal 7 theme
- https://www.oliverdavies.uk/blog/2012/05/23/writing-info-file-drupal-7-theme/
- https://www.oliverdavies.uk/blog/2012/05/23/writing-info-file-drupal-7-theme/
- Wed, 23 May 2012 00:00:00 +0000
-
An example .info file for a Drupal 7 theme.
-
-
-
- Prevent Apache from displaying text files within a web browser
- https://www.oliverdavies.uk/blog/2012/05/23/prevent-apache-displaying-text-files-within-web-browser/
- https://www.oliverdavies.uk/blog/2012/05/23/prevent-apache-displaying-text-files-within-web-browser/
- Wed, 23 May 2012 00:00:00 +0000
-
When you download Drupal, there are several text files that are placed in the root of your installation. You don't want or need these to be visible to anyone attempting to view them in a browser - especially CHANGELOG.txt as that includes the exact version of Drupal you are running and could therefore have security implications.
-
-
Rather than delete these files or change the file permissions manually for each file, I can add the following lines into my VirtualHost configuration.
-
-
-
- Forward one domain to another using mod_rewrite and .htaccess
- https://www.oliverdavies.uk/blog/2012/05/23/forward-one-domain-another-using-modrewrite-and-htaccess/
- https://www.oliverdavies.uk/blog/2012/05/23/forward-one-domain-another-using-modrewrite-and-htaccess/
- Wed, 23 May 2012 00:00:00 +0000
-
How to use the .htaccess file to forward to a different domain.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/compass.xml b/docs/blog/tags/compass.xml
deleted file mode 100644
index a1ff7e9c..00000000
--- a/docs/blog/tags/compass.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Include CSS Fonts by Using a SASS each Loop
- https://www.oliverdavies.uk/blog/2014/11/18/include-css-fonts-using-sass-each-loop/
- https://www.oliverdavies.uk/blog/2014/11/18/include-css-fonts-using-sass-each-loop/
- Tue, 18 Nov 2014 00:00:00 +0000
-
How to use an @each loop in SASS to quickly include multiple font files within your stylesheet.
-
-
-
- How to use SASS and Compass in Drupal 7 using Sassy
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- Thu, 06 Dec 2012 00:00:00 +0000
-
I've recently started using SASS rather than LESS to do my CSS preprocessing - namely due to its integration with Compass and it's built-in CSS3 mixins. Here are three modules that provide the ability to use SASS within Drupal.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/css.xml b/docs/blog/tags/css.xml
deleted file mode 100644
index f377920b..00000000
--- a/docs/blog/tags/css.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- How to use SASS and Compass in Drupal 7 using Sassy
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- Thu, 06 Dec 2012 00:00:00 +0000
-
I've recently started using SASS rather than LESS to do my CSS preprocessing - namely due to its integration with Compass and it's built-in CSS3 mixins. Here are three modules that provide the ability to use SASS within Drupal.
The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database. The issue is that the domains are stored within the database so these are copied across when the data is migrated between environments, whereas the domains are obviously going to change.
-
-
Rather than changing the domain settings within the Domain module itself, the best solution I think is to use table prefixes and create a different domain table per environment.
I’ve been a Drupal VM user for a long time, but lately I’ve been using a combination Drupal VM and Docker for my local development environment. There were a couple of issues preventing me from completely switching to Docker - one of which being that when I tried running of my Simpletest tests, a lot of them would fail where they would pass when run within Drupal VM.
-
-
Here’s an excerpt from my docker-compose.yml file:
The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database. The issue is that the domains are stored within the database so these are copied across when the data is migrated between environments, whereas the domains are obviously going to change.
-
-
Rather than changing the domain settings within the Domain module itself, the best solution I think is to use table prefixes and create a different domain table per environment.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/drupal-6.xml b/docs/blog/tags/drupal-6.xml
deleted file mode 100644
index 699e2e9f..00000000
--- a/docs/blog/tags/drupal-6.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Include a Local Drupal Settings file for Environment Configuration and Overrides
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- Sat, 20 Dec 2014 00:00:00 +0000
-
How to create and include a local settings file to define and override environment-specific variables, and keep sensitive things like your database credentials and API keys safe.
-
-
-
- Checking if a user is logged into Drupal (the right way)
- https://www.oliverdavies.uk/blog/2013/01/09/checking-if-user-logged-drupal-right-way/
- https://www.oliverdavies.uk/blog/2013/01/09/checking-if-user-logged-drupal-right-way/
- Wed, 09 Jan 2013 00:00:00 +0000
-
I see this regularly when working on Drupal sites when someone wants to check whether the current user is logged in to Drupal (authenticated) or not (anonymous).
-
-
-
- My new Drupal modules
- https://www.oliverdavies.uk/blog/2012/07/12/my-new-drupal-modules/
- https://www.oliverdavies.uk/blog/2012/07/12/my-new-drupal-modules/
- Thu, 12 Jul 2012 00:00:00 +0000
-
After a busy few days, I've released two new contrib Drupal modules.
-
-
-
- Easily Embed TypeKit Fonts into your Drupal Website
- https://www.oliverdavies.uk/blog/2011/02/14/easily-embed-typekit-fonts-your-drupal-website/
- https://www.oliverdavies.uk/blog/2011/02/14/easily-embed-typekit-fonts-your-drupal-website/
- Mon, 14 Feb 2011 00:00:00 +0000
-
-
-
- How to Create and Apply Patches
- https://www.oliverdavies.uk/blog/2010/10/10/create-and-apply-patches/
- https://www.oliverdavies.uk/blog/2010/10/10/create-and-apply-patches/
- Sun, 10 Oct 2010 00:00:00 +0000
-
Earlier this year, I posted a solution to an issue on the Drupal.org issue queue. Originally, I just posted the code back onto the issue, but have now created a patch that can easily be applied to any Drupal 6 installation. Here is a run-through of the process of creating and applying a patch. In this case, I made changes to the user_pass_validate() function that's found within modules/user/user.pages.inc.
-
-
-
- Review of the Image Caption Module
- https://www.oliverdavies.uk/blog/2010/08/20/review-image-caption-module/
- https://www.oliverdavies.uk/blog/2010/08/20/review-image-caption-module/
- Fri, 20 Aug 2010 00:00:00 +0000
-
-
-
- Create a Better Photo Gallery in Drupal - Part 2
- https://www.oliverdavies.uk/blog/2010/08/17/create-better-photo-gallery-drupal-part-2/
- https://www.oliverdavies.uk/blog/2010/08/17/create-better-photo-gallery-drupal-part-2/
- Tue, 17 Aug 2010 00:00:00 +0000
-
-
-
- Create a Better Photo Gallery in Drupal - Part 1
- https://www.oliverdavies.uk/blog/2010/08/11/create-better-photo-gallery-drupal-part-1/
- https://www.oliverdavies.uk/blog/2010/08/11/create-better-photo-gallery-drupal-part-1/
- Wed, 11 Aug 2010 00:00:00 +0000
-
-
-
- Review of the Admin:hover Module
- https://www.oliverdavies.uk/blog/2010/08/10/review-adminhover-module/
- https://www.oliverdavies.uk/blog/2010/08/10/review-adminhover-module/
- Tue, 10 Aug 2010 00:00:00 +0000
-
-
-
- Review of the Teleport Module
- https://www.oliverdavies.uk/blog/2010/07/12/review-teleport-module/
- https://www.oliverdavies.uk/blog/2010/07/12/review-teleport-module/
- Mon, 12 Jul 2010 00:00:00 +0000
-
-
-
-
\ No newline at end of file
diff --git a/docs/blog/tags/drupal-6/index.html b/docs/blog/tags/drupal-6/index.html
deleted file mode 100644
index fcaf407d..00000000
--- a/docs/blog/tags/drupal-6/index.html
+++ /dev/null
@@ -1,374 +0,0 @@
-
-
-
- Tag Archive | Oliver Davies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/drupal-7.xml b/docs/blog/tags/drupal-7.xml
deleted file mode 100644
index 2a00adfd..00000000
--- a/docs/blog/tags/drupal-7.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:08:59 +0000
-
- Turning Your Custom Drupal Module into a Feature
- https://www.oliverdavies.uk/blog/2017/05/20/turning-drupal-module-into-feature/
- https://www.oliverdavies.uk/blog/2017/05/20/turning-drupal-module-into-feature/
- Sat, 20 May 2017 00:00:00 +0000
-
Yesterday I was fixing a bug in an inherited Drupal 7 custom module, and I decided that I was going to add some tests to ensure that the bug was fixed and doesn’t get accidentially re-introduced in the future. The test though required me to have a particular content type and fields which are specific to this site, so weren’t present within the standard installation profile used to run tests.
-
-
I decided to convert the custom module into a Feature so that the content type and it’s fields could be added to it, and therefore present on the testing site once the module is installed.
-
-
To do this, I needed to expose the module to the Features API.
How to use the xautoload module to autoload migration classes within your Drupal 7 migration modules.
-
-
-
- Programmatically Load an Entityform in Drupal 7
- https://www.oliverdavies.uk/blog/2015/12/22/programmatically-load-an-entityform-in-drupal-7/
- https://www.oliverdavies.uk/blog/2015/12/22/programmatically-load-an-entityform-in-drupal-7/
- Tue, 22 Dec 2015 00:00:00 +0000
-
I recently had my first experience using the Entityform module in a project. It was quite easy to configure with different form types, but then I needed to embed the form into an overlay. I was expecting to use the drupal_get_form() function and render it, but this didn’t work.
-
-
Here are the steps that I took to be able to load, render and embed the form.
-
-
-
- How to Define a Minimum Drupal Core Version
- https://www.oliverdavies.uk/blog/2015/04/03/how-to-define-a-minimum-drupal-core-version/
- https://www.oliverdavies.uk/blog/2015/04/03/how-to-define-a-minimum-drupal-core-version/
- Fri, 03 Apr 2015 00:00:00 +0000
-
-
-
- Include a Local Drupal Settings file for Environment Configuration and Overrides
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- Sat, 20 Dec 2014 00:00:00 +0000
-
How to create and include a local settings file to define and override environment-specific variables, and keep sensitive things like your database credentials and API keys safe.
-
-
-
- Creating and using custom tokens in Drupal 7
- https://www.oliverdavies.uk/blog/2013/02/16/creating-and-using-custom-tokens-drupal-7/
- https://www.oliverdavies.uk/blog/2013/02/16/creating-and-using-custom-tokens-drupal-7/
- Sat, 16 Feb 2013 00:00:00 +0000
-
This post outlines the steps required to create your own custom tokens in Drupal.
-
-
-
- Checking if a user is logged into Drupal (the right way)
- https://www.oliverdavies.uk/blog/2013/01/09/checking-if-user-logged-drupal-right-way/
- https://www.oliverdavies.uk/blog/2013/01/09/checking-if-user-logged-drupal-right-way/
- Wed, 09 Jan 2013 00:00:00 +0000
-
I see this regularly when working on Drupal sites when someone wants to check whether the current user is logged in to Drupal (authenticated) or not (anonymous).
-
-
-
- How to use SASS and Compass in Drupal 7 using Sassy
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- Thu, 06 Dec 2012 00:00:00 +0000
-
I've recently started using SASS rather than LESS to do my CSS preprocessing - namely due to its integration with Compass and it's built-in CSS3 mixins. Here are three modules that provide the ability to use SASS within Drupal.
-
-
-
- Display a Custom Menu in a Drupal 7 Theme Template File
- https://www.oliverdavies.uk/blog/2012/08/18/display-custom-menu-drupal-7-theme-template-file/
- https://www.oliverdavies.uk/blog/2012/08/18/display-custom-menu-drupal-7-theme-template-file/
- Sat, 18 Aug 2012 00:00:00 +0000
-
For reference, this is the code needed to display a menu in a Drupal 7 template file, including the navigation ARIA role.
-
-
-
- My new Drupal modules
- https://www.oliverdavies.uk/blog/2012/07/12/my-new-drupal-modules/
- https://www.oliverdavies.uk/blog/2012/07/12/my-new-drupal-modules/
- Thu, 12 Jul 2012 00:00:00 +0000
-
After a busy few days, I've released two new contrib Drupal modules.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/drupal-8.xml b/docs/blog/tags/drupal-8.xml
deleted file mode 100644
index 40c5aed1..00000000
--- a/docs/blog/tags/drupal-8.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Include a Local Drupal Settings file for Environment Configuration and Overrides
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- Sat, 20 Dec 2014 00:00:00 +0000
-
How to create and include a local settings file to define and override environment-specific variables, and keep sensitive things like your database credentials and API keys safe.
This is just a quick post to thank everyone for their comments and congratulations after my previous post about joining the Drupal Association. I’m looking forward to my first day in the job tomorrow.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/drupal-planet.xml b/docs/blog/tags/drupal-planet.xml
deleted file mode 100644
index 359711d5..00000000
--- a/docs/blog/tags/drupal-planet.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:08:59 +0000
-
- Turning Your Custom Drupal Module into a Feature
- https://www.oliverdavies.uk/blog/2017/05/20/turning-drupal-module-into-feature/
- https://www.oliverdavies.uk/blog/2017/05/20/turning-drupal-module-into-feature/
- Sat, 20 May 2017 00:00:00 +0000
-
Yesterday I was fixing a bug in an inherited Drupal 7 custom module, and I decided that I was going to add some tests to ensure that the bug was fixed and doesn’t get accidentially re-introduced in the future. The test though required me to have a particular content type and fields which are specific to this site, so weren’t present within the standard installation profile used to run tests.
-
-
I decided to convert the custom module into a Feature so that the content type and it’s fields could be added to it, and therefore present on the testing site once the module is installed.
-
-
To do this, I needed to expose the module to the Features API.
-
-
-
- DrupalCamp Bristol 2017 - Early Bird Tickets, Call for Sessions, Sponsors
- https://www.oliverdavies.uk/blog/2017/05/15/drupalcamp-bristol-early-bird-tickets-sessions-sponsors/
- https://www.oliverdavies.uk/blog/2017/05/15/drupalcamp-bristol-early-bird-tickets-sessions-sponsors/
- Mon, 15 May 2017 00:00:00 +0000
-
-
-
In less than two months time, DrupalCamp Bristol will be back for our third year! (July seems to come around quicker each year). This is this year’s schedule and venues:
I’ve been a Drupal VM user for a long time, but lately I’ve been using a combination Drupal VM and Docker for my local development environment. There were a couple of issues preventing me from completely switching to Docker - one of which being that when I tried running of my Simpletest tests, a lot of them would fail where they would pass when run within Drupal VM.
-
-
Here’s an excerpt from my docker-compose.yml file:
How to use the xautoload module to autoload migration classes within your Drupal 7 migration modules.
-
-
-
- Announcing the Drupal VM Generator
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- Mon, 15 Feb 2016 00:00:00 +0000
-
For the past few weeks I’ve been working on a personal side project, based on Drupal VM. It’s called the Drupal VM Generator, and over the weekend I’ve added the final features and fixed the remaining issues, and tagged the 1.0.0 release.
-
-
-
- Programmatically Load an Entityform in Drupal 7
- https://www.oliverdavies.uk/blog/2015/12/22/programmatically-load-an-entityform-in-drupal-7/
- https://www.oliverdavies.uk/blog/2015/12/22/programmatically-load-an-entityform-in-drupal-7/
- Tue, 22 Dec 2015 00:00:00 +0000
-
I recently had my first experience using the Entityform module in a project. It was quite easy to configure with different form types, but then I needed to embed the form into an overlay. I was expecting to use the drupal_get_form() function and render it, but this didn’t work.
-
-
Here are the steps that I took to be able to load, render and embed the form.
-
-
-
- How to Define a Minimum Drupal Core Version
- https://www.oliverdavies.uk/blog/2015/04/03/how-to-define-a-minimum-drupal-core-version/
- https://www.oliverdavies.uk/blog/2015/04/03/how-to-define-a-minimum-drupal-core-version/
- Fri, 03 Apr 2015 00:00:00 +0000
-
-
-
- Include a Local Drupal Settings file for Environment Configuration and Overrides
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- Sat, 20 Dec 2014 00:00:00 +0000
-
How to create and include a local settings file to define and override environment-specific variables, and keep sensitive things like your database credentials and API keys safe.
-
-
-
- Include environment-specific settings files on Pantheon
- https://www.oliverdavies.uk/blog/2014/11/27/pantheon-settings-files/
- https://www.oliverdavies.uk/blog/2014/11/27/pantheon-settings-files/
- Thu, 27 Nov 2014 00:00:00 +0000
-
I was recently doing some work on a site hosted on Pantheon and came across an issue, for which part of the suggested fix was to ensure that the $base_url variable was explicitly defined within settings.php (this is also best practice on all Drupal sites).
-
-
The way that was recommended was by using a switch() function based on Pantheon's environment variable. For example:
-
-
-
- Using Remote Files when Developing Locally with Stage File Proxy Module
- https://www.oliverdavies.uk/blog/2014/11/20/using-remote-files-when-developing-locally-with-stage-file-proxy-module/
- https://www.oliverdavies.uk/blog/2014/11/20/using-remote-files-when-developing-locally-with-stage-file-proxy-module/
- Thu, 20 Nov 2014 00:00:00 +0000
-
How to install and configure the Stage File Proxy module to serve remote images on your local Drupal site.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/drupal-vm-generator.xml b/docs/blog/tags/drupal-vm-generator.xml
deleted file mode 100644
index 5129d0b4..00000000
--- a/docs/blog/tags/drupal-vm-generator.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:08:59 +0000
-
- Drupal VM Generator 2.9.1 Released
- https://www.oliverdavies.uk/blog/2016/12/30/drupal-vm-generator-291-released/
- https://www.oliverdavies.uk/blog/2016/12/30/drupal-vm-generator-291-released/
- Fri, 30 Dec 2016 00:00:00 +0000
-
I spent some time yesterday working on the Drupal VM Generator, and have released versions 2.8.1, 2.9.0 and 2.9.1.
-
-
-
- Announcing the Drupal VM Generator
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- Mon, 15 Feb 2016 00:00:00 +0000
-
For the past few weeks I’ve been working on a personal side project, based on Drupal VM. It’s called the Drupal VM Generator, and over the weekend I’ve added the final features and fixed the remaining issues, and tagged the 1.0.0 release.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/drupal-vm.xml b/docs/blog/tags/drupal-vm.xml
deleted file mode 100644
index 8800dc48..00000000
--- a/docs/blog/tags/drupal-vm.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:08:59 +0000
-
- Announcing the Drupal VM Generator
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- Mon, 15 Feb 2016 00:00:00 +0000
-
For the past few weeks I’ve been working on a personal side project, based on Drupal VM. It’s called the Drupal VM Generator, and over the weekend I’ve added the final features and fixed the remaining issues, and tagged the 1.0.0 release.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/drupal.xml b/docs/blog/tags/drupal.xml
deleted file mode 100644
index 2d4ef1f7..00000000
--- a/docs/blog/tags/drupal.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:08:59 +0000
-
- Turning Your Custom Drupal Module into a Feature
- https://www.oliverdavies.uk/blog/2017/05/20/turning-drupal-module-into-feature/
- https://www.oliverdavies.uk/blog/2017/05/20/turning-drupal-module-into-feature/
- Sat, 20 May 2017 00:00:00 +0000
-
Yesterday I was fixing a bug in an inherited Drupal 7 custom module, and I decided that I was going to add some tests to ensure that the bug was fixed and doesn’t get accidentially re-introduced in the future. The test though required me to have a particular content type and fields which are specific to this site, so weren’t present within the standard installation profile used to run tests.
-
-
I decided to convert the custom module into a Feature so that the content type and it’s fields could be added to it, and therefore present on the testing site once the module is installed.
-
-
To do this, I needed to expose the module to the Features API.
-
-
-
- DrupalCamp Bristol 2017 - Early Bird Tickets, Call for Sessions, Sponsors
- https://www.oliverdavies.uk/blog/2017/05/15/drupalcamp-bristol-early-bird-tickets-sessions-sponsors/
- https://www.oliverdavies.uk/blog/2017/05/15/drupalcamp-bristol-early-bird-tickets-sessions-sponsors/
- Mon, 15 May 2017 00:00:00 +0000
-
-
-
In less than two months time, DrupalCamp Bristol will be back for our third year! (July seems to come around quicker each year). This is this year’s schedule and venues:
I’ve been a Drupal VM user for a long time, but lately I’ve been using a combination Drupal VM and Docker for my local development environment. There were a couple of issues preventing me from completely switching to Docker - one of which being that when I tried running of my Simpletest tests, a lot of them would fail where they would pass when run within Drupal VM.
-
-
Here’s an excerpt from my docker-compose.yml file:
How to use the xautoload module to autoload migration classes within your Drupal 7 migration modules.
-
-
-
- Announcing the Drupal VM Generator
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- Mon, 15 Feb 2016 00:00:00 +0000
-
For the past few weeks I’ve been working on a personal side project, based on Drupal VM. It’s called the Drupal VM Generator, and over the weekend I’ve added the final features and fixed the remaining issues, and tagged the 1.0.0 release.
-
-
-
- Programmatically Load an Entityform in Drupal 7
- https://www.oliverdavies.uk/blog/2015/12/22/programmatically-load-an-entityform-in-drupal-7/
- https://www.oliverdavies.uk/blog/2015/12/22/programmatically-load-an-entityform-in-drupal-7/
- Tue, 22 Dec 2015 00:00:00 +0000
-
I recently had my first experience using the Entityform module in a project. It was quite easy to configure with different form types, but then I needed to embed the form into an overlay. I was expecting to use the drupal_get_form() function and render it, but this didn’t work.
-
-
Here are the steps that I took to be able to load, render and embed the form.
-
-
-
- How to Define a Minimum Drupal Core Version
- https://www.oliverdavies.uk/blog/2015/04/03/how-to-define-a-minimum-drupal-core-version/
- https://www.oliverdavies.uk/blog/2015/04/03/how-to-define-a-minimum-drupal-core-version/
- Fri, 03 Apr 2015 00:00:00 +0000
-
-
-
- Include a Local Drupal Settings file for Environment Configuration and Overrides
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- Sat, 20 Dec 2014 00:00:00 +0000
-
How to create and include a local settings file to define and override environment-specific variables, and keep sensitive things like your database credentials and API keys safe.
-
-
-
- Include environment-specific settings files on Pantheon
- https://www.oliverdavies.uk/blog/2014/11/27/pantheon-settings-files/
- https://www.oliverdavies.uk/blog/2014/11/27/pantheon-settings-files/
- Thu, 27 Nov 2014 00:00:00 +0000
-
I was recently doing some work on a site hosted on Pantheon and came across an issue, for which part of the suggested fix was to ensure that the $base_url variable was explicitly defined within settings.php (this is also best practice on all Drupal sites).
-
-
The way that was recommended was by using a switch() function based on Pantheon's environment variable. For example:
-
-
-
- Using Remote Files when Developing Locally with Stage File Proxy Module
- https://www.oliverdavies.uk/blog/2014/11/20/using-remote-files-when-developing-locally-with-stage-file-proxy-module/
- https://www.oliverdavies.uk/blog/2014/11/20/using-remote-files-when-developing-locally-with-stage-file-proxy-module/
- Thu, 20 Nov 2014 00:00:00 +0000
-
How to install and configure the Stage File Proxy module to serve remote images on your local Drupal site.
In less than two months time, DrupalCamp Bristol will be back for our third year! (July seems to come around quicker each year). This is this year’s schedule and venues:
In less than two months time, DrupalCamp Bristol will be back for our third year! (July seems to come around quicker each year). This is this year’s schedule and venues:
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/drush.xml b/docs/blog/tags/drush.xml
deleted file mode 100644
index 02ff62cc..00000000
--- a/docs/blog/tags/drush.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Updating Features and Adding Components Using Drush
- https://www.oliverdavies.uk/blog/2014/10/21/updating-features-and-adding-components-using-drush/
- https://www.oliverdavies.uk/blog/2014/10/21/updating-features-and-adding-components-using-drush/
- Tue, 21 Oct 2014 00:00:00 +0000
-
If you use the Features module to manage your Drupal configuration, it can be time consuming to update features through the UI, especially if you are working on a remote server and need to keep downloading and uploading files.
-
-
If you re-create a feature through the UI, you'll be prompted to download a new archive of the feature in its entirety onto your local computer. You could either commit this into a local repository and then pull it remotely, or use a tool such as SCP to upload the archive onto the server and commit it from there. You can simplify this process by using Drush.
-
-
-
- Download Different Versions of Drupal with Drush
- https://www.oliverdavies.uk/blog/2013/12/31/download-different-versions-drupal-drush/
- https://www.oliverdavies.uk/blog/2013/12/31/download-different-versions-drupal-drush/
- Tue, 31 Dec 2013 00:00:00 +0000
-
If you use Drush, it's likely that you've used the drush pm-download (or drush dl for short) command to start a new project. This command downloads projects from Drupal.org, but if you don't specify a project or type "drush dl drupal", the command will download the current stable version of Drupal core. Currently, this will be Drupal 7 with that being the current stable version of core at the time of writing this post.
There are times when doing Drupal development when you need to run a custom PHP script, maybe moving data from one field to another, that doesn't warrant the time and effort to create a custom module. In this scenario, it would be quicker to write a .php script and bootstrap Drupal to gain access to functions like node_load() and db_query().
-
-
To bootstrap Drupal, you would need to add some additional lines of code to the stop of your script. Here is an alternative way.
-
-
-
- Create a Zen Sub-theme Using Drush
- https://www.oliverdavies.uk/blog/2013/09/06/create-a-zen-sub-theme-using-drush/
- https://www.oliverdavies.uk/blog/2013/09/06/create-a-zen-sub-theme-using-drush/
- Fri, 06 Sep 2013 00:00:00 +0000
-
How to use Drush to quickly build a new sub-theme of Zen.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/entityform.xml b/docs/blog/tags/entityform.xml
deleted file mode 100644
index a44fb340..00000000
--- a/docs/blog/tags/entityform.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:08:59 +0000
-
- Programmatically Load an Entityform in Drupal 7
- https://www.oliverdavies.uk/blog/2015/12/22/programmatically-load-an-entityform-in-drupal-7/
- https://www.oliverdavies.uk/blog/2015/12/22/programmatically-load-an-entityform-in-drupal-7/
- Tue, 22 Dec 2015 00:00:00 +0000
-
I recently had my first experience using the Entityform module in a project. It was quite easy to configure with different form types, but then I needed to embed the form into an overlay. I was expecting to use the drupal_get_form() function and render it, but this didn’t work.
-
-
Here are the steps that I took to be able to load, render and embed the form.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/features.xml b/docs/blog/tags/features.xml
deleted file mode 100644
index a25274f7..00000000
--- a/docs/blog/tags/features.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:08:59 +0000
-
- Turning Your Custom Drupal Module into a Feature
- https://www.oliverdavies.uk/blog/2017/05/20/turning-drupal-module-into-feature/
- https://www.oliverdavies.uk/blog/2017/05/20/turning-drupal-module-into-feature/
- Sat, 20 May 2017 00:00:00 +0000
-
Yesterday I was fixing a bug in an inherited Drupal 7 custom module, and I decided that I was going to add some tests to ensure that the bug was fixed and doesn’t get accidentially re-introduced in the future. The test though required me to have a particular content type and fields which are specific to this site, so weren’t present within the standard installation profile used to run tests.
-
-
I decided to convert the custom module into a Feature so that the content type and it’s fields could be added to it, and therefore present on the testing site once the module is installed.
-
-
To do this, I needed to expose the module to the Features API.
-
-
-
- Updating Features and Adding Components Using Drush
- https://www.oliverdavies.uk/blog/2014/10/21/updating-features-and-adding-components-using-drush/
- https://www.oliverdavies.uk/blog/2014/10/21/updating-features-and-adding-components-using-drush/
- Tue, 21 Oct 2014 00:00:00 +0000
-
If you use the Features module to manage your Drupal configuration, it can be time consuming to update features through the UI, especially if you are working on a remote server and need to keep downloading and uploading files.
-
-
If you re-create a feature through the UI, you'll be prompted to download a new archive of the feature in its entirety onto your local computer. You could either commit this into a local repository and then pull it remotely, or use a tool such as SCP to upload the archive onto the server and commit it from there. You can simplify this process by using Drush.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/git.xml b/docs/blog/tags/git.xml
deleted file mode 100644
index b08d99e1..00000000
--- a/docs/blog/tags/git.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:08:59 +0000
-
- Updating Forked Repositories on GitHub
- https://www.oliverdavies.uk/blog/2015/06/18/updating-forked-repositories-on-github/
- https://www.oliverdavies.uk/blog/2015/06/18/updating-forked-repositories-on-github/
- Thu, 18 Jun 2015 11:35:00 +0000
-
-
-
- git format-patch is your Friend
- https://www.oliverdavies.uk/blog/2014/05/21/git-format-patch/
- https://www.oliverdavies.uk/blog/2014/05/21/git-format-patch/
- Wed, 21 May 2014 00:00:00 +0000
-
An explanation of the "git format-patch" command, and how it could be used in Drupal's Git workflow.
-
-
-
- DrupalCamp London: What is Git Flow?
- https://www.oliverdavies.uk/blog/2014/03/03/what-git-flow/
- https://www.oliverdavies.uk/blog/2014/03/03/what-git-flow/
- Mon, 03 Mar 2014 00:00:00 +0000
-
Here are my slides from my "What is Git Flow?" session at DrupalCamp London.
-
-
-
- DrupalCamp London 2014
- https://www.oliverdavies.uk/blog/2014/02/09/drupalcamp-london-2014/
- https://www.oliverdavies.uk/blog/2014/02/09/drupalcamp-london-2014/
- Sun, 09 Feb 2014 00:00:00 +0000
-
It's all booked, I'm going to be attending DrupalCamp London this year, my first DrupalCamp!
-
-
-
- Some Useful Git Aliases
- https://www.oliverdavies.uk/blog/2014/01/15/some-useful-git-aliases/
- https://www.oliverdavies.uk/blog/2014/01/15/some-useful-git-aliases/
- Wed, 15 Jan 2014 00:00:00 +0000
-
Here are some bash aliases that I use and find helpful for quickly writing Git and Git Flow commands.
-
-
-
- Quickly Apply Patches Using Git and curl or wget
- https://www.oliverdavies.uk/blog/2013/12/24/quickly-apply-patches-using-git-and-curl-or-wget/
- https://www.oliverdavies.uk/blog/2013/12/24/quickly-apply-patches-using-git-and-curl-or-wget/
- Tue, 24 Dec 2013 00:00:00 +0000
-
Testing a patch file is usually a two-step process. First you download the patch file from the source, and then you run a separate command to apply it.
-
-
You can save time and typing by running the two commands on one line:
-
-
-
- Display Git Branch or Tag Names in your Bash Prompt
- https://www.oliverdavies.uk/blog/2013/04/27/display-git-branch-or-tag-names-your-bash-prompt/
- https://www.oliverdavies.uk/blog/2013/04/27/display-git-branch-or-tag-names-your-bash-prompt/
- Sat, 27 Apr 2013 00:00:00 +0000
-
Whilst watching Drupalize.me's recent Introduction to Git series, I thought it was useful the way that the current Git branch or tag name was displayed in the bash prompt. Here's how to do it.
Earlier this week I moved this site from my personal Linode server to GitHub Pages.
-
-
This made sense as I already kept the source code in on GitHub, the issue was that GitHub Pages doesn’t know how to dynamically parse and generate a Sculpin site like it does with some other static site generators. It can though parse and serve HTML files, which is what Sculpin generates. It’s just a case of how those files are added to GitHub.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/less.xml b/docs/blog/tags/less.xml
deleted file mode 100644
index b76ef5c4..00000000
--- a/docs/blog/tags/less.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- How to use SASS and Compass in Drupal 7 using Sassy
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- Thu, 06 Dec 2012 00:00:00 +0000
-
I've recently started using SASS rather than LESS to do my CSS preprocessing - namely due to its integration with Compass and it's built-in CSS3 mixins. Here are three modules that provide the ability to use SASS within Drupal.
-
-
-
- Create an Omega Subtheme with LESS CSS Preprocessor using Omega Tools and Drush
- https://www.oliverdavies.uk/blog/2012/04/16/create-omega-subtheme-less-css-preprocessor-using-omega-tools-and-drush/
- https://www.oliverdavies.uk/blog/2012/04/16/create-omega-subtheme-less-css-preprocessor-using-omega-tools-and-drush/
- Mon, 16 Apr 2012 00:00:00 +0000
-
-
-
-
\ No newline at end of file
diff --git a/docs/blog/tags/less/index.html b/docs/blog/tags/less/index.html
deleted file mode 100644
index 57eba790..00000000
--- a/docs/blog/tags/less/index.html
+++ /dev/null
@@ -1,206 +0,0 @@
-
-
-
- Tag Archive | Oliver Davies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/modules.xml b/docs/blog/tags/modules.xml
deleted file mode 100644
index 94260b45..00000000
--- a/docs/blog/tags/modules.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- How to Create and Apply Patches
- https://www.oliverdavies.uk/blog/2010/10/10/create-and-apply-patches/
- https://www.oliverdavies.uk/blog/2010/10/10/create-and-apply-patches/
- Sun, 10 Oct 2010 00:00:00 +0000
-
Earlier this year, I posted a solution to an issue on the Drupal.org issue queue. Originally, I just posted the code back onto the issue, but have now created a patch that can easily be applied to any Drupal 6 installation. Here is a run-through of the process of creating and applying a patch. In this case, I made changes to the user_pass_validate() function that's found within modules/user/user.pages.inc.
This is an example of how my Nginx configuration looked to redirect from an old domain to a new one, and also to redirect from the root example.com domain to the canonical www subdomain.
Yesterday was my last day working at Nomensa. Next week, I'll be starting as a Senior Developer at Precedent.
-
-
-
- Accessible Bristol site launched
- https://www.oliverdavies.uk/blog/2012/11/15/accessible-bristol-site-launched/
- https://www.oliverdavies.uk/blog/2012/11/15/accessible-bristol-site-launched/
- Thu, 15 Nov 2012 00:00:00 +0000
-
I'm happy to announce that the Accessible Bristol website was launched this week, on Drupal 7.
-
-
The site has been developed over the past few months, and uses the User Relationships and Privatemsg modules to provide a community-based platform where people with an interest in accessibility can register and network with each other.
-
-
-
- Install and Configure the Nomensa Accessible Media Player in Drupal
- https://www.oliverdavies.uk/blog/2012/07/14/install-nomensa-media-player-drupal/
- https://www.oliverdavies.uk/blog/2012/07/14/install-nomensa-media-player-drupal/
- Sat, 14 Jul 2012 00:00:00 +0000
-
This week I released the first version of the Nomensa Accessible Media Player module for Drupal 7. Here's some instructions of how to install and configure it.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/pantheon.xml b/docs/blog/tags/pantheon.xml
deleted file mode 100644
index 02c10f09..00000000
--- a/docs/blog/tags/pantheon.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Include environment-specific settings files on Pantheon
- https://www.oliverdavies.uk/blog/2014/11/27/pantheon-settings-files/
- https://www.oliverdavies.uk/blog/2014/11/27/pantheon-settings-files/
- Thu, 27 Nov 2014 00:00:00 +0000
-
I was recently doing some work on a site hosted on Pantheon and came across an issue, for which part of the suggested fix was to ensure that the $base_url variable was explicitly defined within settings.php (this is also best practice on all Drupal sites).
-
-
The way that was recommended was by using a switch() function based on Pantheon's environment variable. For example:
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/patches.xml b/docs/blog/tags/patches.xml
deleted file mode 100644
index b53d6e75..00000000
--- a/docs/blog/tags/patches.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- git format-patch is your Friend
- https://www.oliverdavies.uk/blog/2014/05/21/git-format-patch/
- https://www.oliverdavies.uk/blog/2014/05/21/git-format-patch/
- Wed, 21 May 2014 00:00:00 +0000
-
An explanation of the "git format-patch" command, and how it could be used in Drupal's Git workflow.
-
-
-
- How to Create and Apply Patches
- https://www.oliverdavies.uk/blog/2010/10/10/create-and-apply-patches/
- https://www.oliverdavies.uk/blog/2010/10/10/create-and-apply-patches/
- Sun, 10 Oct 2010 00:00:00 +0000
-
Earlier this year, I posted a solution to an issue on the Drupal.org issue queue. Originally, I just posted the code back onto the issue, but have now created a patch that can easily be applied to any Drupal 6 installation. Here is a run-through of the process of creating and applying a patch. In this case, I made changes to the user_pass_validate() function that's found within modules/user/user.pages.inc.
This is just a quick post to thank everyone for their comments and congratulations after my previous post about joining the Drupal Association. I’m looking forward to my first day in the job tomorrow.
-
-
-
- Drupal Association
- https://www.oliverdavies.uk/blog/2014/05/03/drupal-association/
- https://www.oliverdavies.uk/blog/2014/05/03/drupal-association/
- Sat, 03 May 2014 00:00:00 +0000
-
Earlier this week I moved this site from my personal Linode server to GitHub Pages.
-
-
This made sense as I already kept the source code in on GitHub, the issue was that GitHub Pages doesn’t know how to dynamically parse and generate a Sculpin site like it does with some other static site generators. It can though parse and serve HTML files, which is what Sculpin generates. It’s just a case of how those files are added to GitHub.
The Drupal Meetups Twitterbot is a small project that I worked on a few months ago, but hadn't got around to promoting yet. It’s intention is to provide one Twitter account where people can get the up to date news from various Drupal meetups.
There are times when doing Drupal development when you need to run a custom PHP script, maybe moving data from one field to another, that doesn't warrant the time and effort to create a custom module. In this scenario, it would be quicker to write a .php script and bootstrap Drupal to gain access to functions like node_load() and db_query().
-
-
To bootstrap Drupal, you would need to add some additional lines of code to the stop of your script. Here is an alternative way.
-
-
-
- Checking if a user is logged into Drupal (the right way)
- https://www.oliverdavies.uk/blog/2013/01/09/checking-if-user-logged-drupal-right-way/
- https://www.oliverdavies.uk/blog/2013/01/09/checking-if-user-logged-drupal-right-way/
- Wed, 09 Jan 2013 00:00:00 +0000
-
I see this regularly when working on Drupal sites when someone wants to check whether the current user is logged in to Drupal (authenticated) or not (anonymous).
-
-
-
- Display a Custom Menu in a Drupal 7 Theme Template File
- https://www.oliverdavies.uk/blog/2012/08/18/display-custom-menu-drupal-7-theme-template-file/
- https://www.oliverdavies.uk/blog/2012/08/18/display-custom-menu-drupal-7-theme-template-file/
- Sat, 18 Aug 2012 00:00:00 +0000
-
For reference, this is the code needed to display a menu in a Drupal 7 template file, including the navigation ARIA role.
-
-
-
- Display the Number of Facebook fans in PHP
- https://www.oliverdavies.uk/blog/2011/03/15/display-number-facebook-fans-php/
- https://www.oliverdavies.uk/blog/2011/03/15/display-number-facebook-fans-php/
- Tue, 15 Mar 2011 00:00:00 +0000
-
-
-
-
\ No newline at end of file
diff --git a/docs/blog/tags/php/index.html b/docs/blog/tags/php/index.html
deleted file mode 100644
index f8c488c9..00000000
--- a/docs/blog/tags/php/index.html
+++ /dev/null
@@ -1,254 +0,0 @@
-
-
-
- Tag Archive | Oliver Davies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/preprocessing.xml b/docs/blog/tags/preprocessing.xml
deleted file mode 100644
index 51fac195..00000000
--- a/docs/blog/tags/preprocessing.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- How to use SASS and Compass in Drupal 7 using Sassy
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- Thu, 06 Dec 2012 00:00:00 +0000
-
I've recently started using SASS rather than LESS to do my CSS preprocessing - namely due to its integration with Compass and it's built-in CSS3 mixins. Here are three modules that provide the ability to use SASS within Drupal.
-
-
-
- Dividing Drupal's process and preprocess functions into separate files
- https://www.oliverdavies.uk/blog/2012/05/24/dividing-drupals-process-and-preprocess-functions-separate-files/
- https://www.oliverdavies.uk/blog/2012/05/24/dividing-drupals-process-and-preprocess-functions-separate-files/
- Thu, 24 May 2012 00:00:00 +0000
-
If you use a lot of process and preprocess functions within your Drupal theme, then your template.php can get very long and it can become difficult to find a certain piece of code.
-
-
Following the example of the Omega theme, I've started separating my process and preprocess functions into their own files. For example, mytheme_preprocess_node can be placed within a preprocess/node.inc file, and mytheme_process_page can be placed within process/page.inc.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/sass.xml b/docs/blog/tags/sass.xml
deleted file mode 100644
index 356067f8..00000000
--- a/docs/blog/tags/sass.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Include CSS Fonts by Using a SASS each Loop
- https://www.oliverdavies.uk/blog/2014/11/18/include-css-fonts-using-sass-each-loop/
- https://www.oliverdavies.uk/blog/2014/11/18/include-css-fonts-using-sass-each-loop/
- Tue, 18 Nov 2014 00:00:00 +0000
-
How to use an @each loop in SASS to quickly include multiple font files within your stylesheet.
-
-
-
- How to use SASS and Compass in Drupal 7 using Sassy
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- https://www.oliverdavies.uk/blog/2012/12/06/use-sass-and-compass-drupal-7-using-sassy/
- Thu, 06 Dec 2012 00:00:00 +0000
-
I've recently started using SASS rather than LESS to do my CSS preprocessing - namely due to its integration with Compass and it's built-in CSS3 mixins. Here are three modules that provide the ability to use SASS within Drupal.
Earlier this week I moved this site from my personal Linode server to GitHub Pages.
-
-
This made sense as I already kept the source code in on GitHub, the issue was that GitHub Pages doesn’t know how to dynamically parse and generate a Sculpin site like it does with some other static site generators. It can though parse and serve HTML files, which is what Sculpin generates. It’s just a case of how those files are added to GitHub.
-
-
-
- Easier Sculpin Commands with Composer and NPM Scripts
- https://www.oliverdavies.uk/blog/2017/01/07/easier-sculpin-commands-with-composer-and-npm-scripts/
- https://www.oliverdavies.uk/blog/2017/01/07/easier-sculpin-commands-with-composer-and-npm-scripts/
- Sat, 07 Jan 2017 00:00:00 +0000
-
In this video, I show you how I've simplied my Sculpin and Gulp workflow using custom Composer and NPM scripts.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/settings.php.xml b/docs/blog/tags/settings.php.xml
deleted file mode 100644
index e44acd06..00000000
--- a/docs/blog/tags/settings.php.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Include a Local Drupal Settings file for Environment Configuration and Overrides
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- https://www.oliverdavies.uk/blog/2014/12/20/include-local-drupal-settings-file-environment-configuration-and-overrides/
- Sat, 20 Dec 2014 00:00:00 +0000
-
How to create and include a local settings file to define and override environment-specific variables, and keep sensitive things like your database credentials and API keys safe.
-
-
-
- Include environment-specific settings files on Pantheon
- https://www.oliverdavies.uk/blog/2014/11/27/pantheon-settings-files/
- https://www.oliverdavies.uk/blog/2014/11/27/pantheon-settings-files/
- Thu, 27 Nov 2014 00:00:00 +0000
-
I was recently doing some work on a site hosted on Pantheon and came across an issue, for which part of the suggested fix was to ensure that the $base_url variable was explicitly defined within settings.php (this is also best practice on all Drupal sites).
-
-
The way that was recommended was by using a switch() function based on Pantheon's environment variable. For example:
I’ve been a Drupal VM user for a long time, but lately I’ve been using a combination Drupal VM and Docker for my local development environment. There were a couple of issues preventing me from completely switching to Docker - one of which being that when I tried running of my Simpletest tests, a lot of them would fail where they would pass when run within Drupal VM.
-
-
Here’s an excerpt from my docker-compose.yml file:
-
-
-
- Some useful links for using SimpleTest in Drupal
- https://www.oliverdavies.uk/blog/2013/06/13/some-useful-links-using-simpletest-drupal/
- https://www.oliverdavies.uk/blog/2013/06/13/some-useful-links-using-simpletest-drupal/
- Thu, 13 Jun 2013 00:00:00 +0000
-
Here are some useful links that I've found when researching about unit testing in Drupal using SimpleTest.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/sublime-text.xml b/docs/blog/tags/sublime-text.xml
deleted file mode 100644
index 711f1198..00000000
--- a/docs/blog/tags/sublime-text.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- The Quickest way to Install Sublime Text 2 in Ubuntu
- https://www.oliverdavies.uk/blog/2013/03/02/quickest-way-install-sublime-text-2-ubuntu/
- https://www.oliverdavies.uk/blog/2013/03/02/quickest-way-install-sublime-text-2-ubuntu/
- Sat, 02 Mar 2013 00:00:00 +0000
-
After reading numerous blog posts about how to install Sublime Text 2 in Ubuntu, this is definitely the quickest way!
-
-
-
- Open Sublime Text 2 from the Mac OS X Command Line
- https://www.oliverdavies.uk/blog/2012/11/17/open-sublime-text-2-mac-os-x-command-line/
- https://www.oliverdavies.uk/blog/2012/11/17/open-sublime-text-2-mac-os-x-command-line/
- Sat, 17 Nov 2012 00:00:00 +0000
-
How to open Sublime Text from the command line.
-
-
-
- My Sublime Text 2 settings
- https://www.oliverdavies.uk/blog/2012/10/25/my-sublime-text-2-settings/
- https://www.oliverdavies.uk/blog/2012/10/25/my-sublime-text-2-settings/
- Thu, 25 Oct 2012 00:00:00 +0000
-
Sublime Text 2 has been my text editor of choice for the past few months, and I use it at home, in work, and on any virtual machines that I run. So rather than having to manually re-enter my settings each time, I thought that I'd document them here for future reference.
-
-
These preferences ensure that the code is compliant with Drupal coding standards - using two spaces instead of a tab, no trailing whitespace, blank line at the end of a file etc.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/symfony.xml b/docs/blog/tags/symfony.xml
deleted file mode 100644
index 4b24c9ce..00000000
--- a/docs/blog/tags/symfony.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:08:59 +0000
-
- Announcing the Drupal VM Generator
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- https://www.oliverdavies.uk/blog/2016/02/15/announcing-the-drupal-vm-generator/
- Mon, 15 Feb 2016 00:00:00 +0000
-
For the past few weeks I’ve been working on a personal side project, based on Drupal VM. It’s called the Drupal VM Generator, and over the weekend I’ve added the final features and fixed the remaining issues, and tagged the 1.0.0 release.
The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database. The issue is that the domains are stored within the database so these are copied across when the data is migrated between environments, whereas the domains are obviously going to change.
-
-
Rather than changing the domain settings within the Domain module itself, the best solution I think is to use table prefixes and create a different domain table per environment.
Yesterday evening I went along and spoke at the UnifiedDiff meetup in Cardiff, having offered previously to do a presentation providing an introduction to Drupal.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/terminal.xml b/docs/blog/tags/terminal.xml
deleted file mode 100644
index 8dc8a7fd..00000000
--- a/docs/blog/tags/terminal.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Display Git Branch or Tag Names in your Bash Prompt
- https://www.oliverdavies.uk/blog/2013/04/27/display-git-branch-or-tag-names-your-bash-prompt/
- https://www.oliverdavies.uk/blog/2013/04/27/display-git-branch-or-tag-names-your-bash-prompt/
- Sat, 27 Apr 2013 00:00:00 +0000
-
Whilst watching Drupalize.me's recent Introduction to Git series, I thought it was useful the way that the current Git branch or tag name was displayed in the bash prompt. Here's how to do it.
-
-
-
- Open Sublime Text 2 from the Mac OS X Command Line
- https://www.oliverdavies.uk/blog/2012/11/17/open-sublime-text-2-mac-os-x-command-line/
- https://www.oliverdavies.uk/blog/2012/11/17/open-sublime-text-2-mac-os-x-command-line/
- Sat, 17 Nov 2012 00:00:00 +0000
-
I’ve been a Drupal VM user for a long time, but lately I’ve been using a combination Drupal VM and Docker for my local development environment. There were a couple of issues preventing me from completely switching to Docker - one of which being that when I tried running of my Simpletest tests, a lot of them would fail where they would pass when run within Drupal VM.
-
-
Here’s an excerpt from my docker-compose.yml file:
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/theming.xml b/docs/blog/tags/theming.xml
deleted file mode 100644
index 03c5c7cd..00000000
--- a/docs/blog/tags/theming.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- Create a Zen Sub-theme Using Drush
- https://www.oliverdavies.uk/blog/2013/09/06/create-a-zen-sub-theme-using-drush/
- https://www.oliverdavies.uk/blog/2013/09/06/create-a-zen-sub-theme-using-drush/
- Fri, 06 Sep 2013 00:00:00 +0000
-
How to use Drush to quickly build a new sub-theme of Zen.
-
-
-
- Dividing Drupal's process and preprocess functions into separate files
- https://www.oliverdavies.uk/blog/2012/05/24/dividing-drupals-process-and-preprocess-functions-separate-files/
- https://www.oliverdavies.uk/blog/2012/05/24/dividing-drupals-process-and-preprocess-functions-separate-files/
- Thu, 24 May 2012 00:00:00 +0000
-
If you use a lot of process and preprocess functions within your Drupal theme, then your template.php can get very long and it can become difficult to find a certain piece of code.
-
-
Following the example of the Omega theme, I've started separating my process and preprocess functions into their own files. For example, mytheme_preprocess_node can be placed within a preprocess/node.inc file, and mytheme_process_page can be placed within process/page.inc.
-
-
-
- Writing a .info file for a Drupal 7 theme
- https://www.oliverdavies.uk/blog/2012/05/23/writing-info-file-drupal-7-theme/
- https://www.oliverdavies.uk/blog/2012/05/23/writing-info-file-drupal-7-theme/
- Wed, 23 May 2012 00:00:00 +0000
-
An example .info file for a Drupal 7 theme.
-
-
-
- Create an Omega Subtheme with LESS CSS Preprocessor using Omega Tools and Drush
- https://www.oliverdavies.uk/blog/2012/04/16/create-omega-subtheme-less-css-preprocessor-using-omega-tools-and-drush/
- https://www.oliverdavies.uk/blog/2012/04/16/create-omega-subtheme-less-css-preprocessor-using-omega-tools-and-drush/
- Mon, 16 Apr 2012 00:00:00 +0000
-
-
-
-
\ No newline at end of file
diff --git a/docs/blog/tags/theming/index.html b/docs/blog/tags/theming/index.html
deleted file mode 100644
index 3626eb51..00000000
--- a/docs/blog/tags/theming/index.html
+++ /dev/null
@@ -1,222 +0,0 @@
-
-
-
- Tag Archive | Oliver Davies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
The Drupal Meetups Twitterbot is a small project that I worked on a few months ago, but hadn't got around to promoting yet. It’s intention is to provide one Twitter account where people can get the up to date news from various Drupal meetups.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/vagrant.xml b/docs/blog/tags/vagrant.xml
deleted file mode 100644
index 489c834f..00000000
--- a/docs/blog/tags/vagrant.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- How to fix Vagrant Loading the Wrong Virtual Machine
- https://www.oliverdavies.uk/blog/2014/10/06/fix-vagrant-loading-wrong-virtual-machine/
- https://www.oliverdavies.uk/blog/2014/10/06/fix-vagrant-loading-wrong-virtual-machine/
- Mon, 06 Oct 2014 00:00:00 +0000
-
A few times recently, I've had instances where Vagrant seems to have forgotten which virtual machine it's supposed to load, probably due to renaming a project directory or the .vagrant directory being moved accidentally.
-
-
Here are the steps that I took to fix this and point Vagrant back at the correct VM.
-
-
-
- Currently have limited part-time capacity
-
-
-
-
- Currently no spare full-time capacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/blog/tags/virtualbox.xml b/docs/blog/tags/virtualbox.xml
deleted file mode 100644
index d30225e7..00000000
--- a/docs/blog/tags/virtualbox.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- Oliver Davies
- https://www.oliverdavies.uk
- en
- Oliver Davies, Drupal Developer
- Mon, 24 Jul 2017 19:09:00 +0000
-
- How to fix Vagrant Loading the Wrong Virtual Machine
- https://www.oliverdavies.uk/blog/2014/10/06/fix-vagrant-loading-wrong-virtual-machine/
- https://www.oliverdavies.uk/blog/2014/10/06/fix-vagrant-loading-wrong-virtual-machine/
- Mon, 06 Oct 2014 00:00:00 +0000
-
A few times recently, I've had instances where Vagrant seems to have forgotten which virtual machine it's supposed to load, probably due to renaming a project directory or the .vagrant directory being moved accidentally.
-
-
Here are the steps that I took to fix this and point Vagrant back at the correct VM.
Lead Drupal Developer
- from
- November 2015
- to
- May 2016 (Remote).
-
-
-
-
Working on various Drupal 7 projects for clients including Greater London Authority (http://www.london.gov.uk), British Land and British Council, as well as various retainer contracts.
-
-
Working on internal Drupal 8 learning initiatives, focussing on custom module development and data migration.
-
-
Initial development of a CLI application for generating new and auditing existing codebases to ensure consistency across projects. This uses various Symfony components - mainly the Console and Filesystem components.
Senior Drupal Developer
- from
- July 2015
- to
- November 2015 (Bristol, England).
-
-
-
-
Full-stack Drupal development, focussing on data migration.
-
-
Lead Developer of the road.cc rebuild project onto Drupal 7, including working with non-Drupal PHP applications and utilising of Symfony components, and interacting with Drupal via REST.
My name is Oliver Davies (aka opdavies) - a full-stack Web Developer and System Administrator based in Wales, UK.
-
-
I specialise in open-source PHP technologies. I’m an Acquia certified Drupal Developer but also work with Symfony, Silex, Laravel and Sculpin. I’m a Senior Developer at Microserve, former Developer at the Drupal Association, part-time freelancer, open source contributor and advocate, mentor and conference speaker.
It contains information about the project such as installation instructions, but also integrates with GitHub to provide a download link to the latest drupalvm.phar file, and provides a manifest file for the self:update command to use.
-
-
I’ve also started adding articles onto the site to coincide with new releases and announcements.
Oliver Davies (@opdavies) has been building websites since 2007, specialising in PHP and Drupal since 2008, and more recently also working with Symfony, Silex, Laravel and Sculpin. He is a Senior Developer at Microserve, a Drupal core contributor and mentor, and an open source and contribution advocate.
-
-
He regularly blogs and gives talks about web development and systems administration, maintains and contributes to various open source projects, and co-organises the Drupal Bristol and PHPSW meetups and DrupalCamp Bristol conference.
Sculpin is a static site generator written in PHP. It converts Markdown files, Twig templates and standard HTML into a static HTML site that can be easily deployed.
-
-
This talk will cover a little of the background to Sculpin and what it is, and then will move into some demonstrations of how to build a Sculpin site and what it can do!
As part of their CMS Dance-Off, I was selected to speak about Drupal alongside other speakers representing Umbraco, Sitecore and Episerver.
-
-
The points to cover were:
-
-
-
How does your CMS store configuration data, 'structure' and content?
-
How do you manage source-control, versioning and deployment?
-
How do you manage multiple simultaneous editors and/or developers?
-
How do you manage upgrades?
-
What are the 3 best things about your CMS?
-
What are the 3 worst things about your CMS?
-
What does the future of your CMS look like?
-
-
-
In each point, tried to cover the differences between Drupal core and developing a project using Drupal, as well as between Drupal 7 and Drupal 8, as things like source control and versioning would be approached differently.
You’ve built your application, and now you just need to deploy it. There are various ways that this could be done – from (S)FTP, to SCP and rsync, to running commands like “git pull” and “composer install” directly on the server (not recommended).
-
-
My favourite deployment tool of late is Fabric – a Python based command line tool for running commands locally as well as on remote servers. It’s language and framework agnostic, and unopinionated so you define the steps and workflow that you need – from a basic few-step deployment to a full Capistrano style zero-downtime deployment.
-
-
This talk will cover some introduction to Fabric and how to write your own fabfiles, and then look at some examples of different use case deployments for your PHP project.
Drupal 8 was (finally) released on November 19th 2015, after almost 4 years of work and code commits by over 3,200 different contributors. Whilst it’s pretty much the same as the Drupal that we know and, hopefully, love, a lot has changed behind the scenes and under the hood!
-
-
In this talk, I'll highlight some of the new features and improvements in Drupal 8, and discuss some of the benefits to Drupal site builders, themers, and module developers. I'll also talk about some of the non-technical changes and the cultural shift from "not invented here" to "proudly found elsewhere", and how we are rejoining the PHP herd.
This was a ten minute lightning talk, designed to highlight the major changes coming in Drupal 8.
-
-
I categorised the technical changes into groups for site builders, developers and themers, and also highlighted the cultural shift from "not invented here" to "proudly found elsewhere" and the benefits that brings.
After an introduction to Drupal VM itself and the Drupal VM Generator, we’ll jump into the code and see how Symfony Console applications are structured, how to write new commands, and how to integrate additional libraries like Guzzle, Twig and other Symfony components - whilst referencing code from the Drupal VM Generator project.
If you’ve moved a site from Drupal 6 to 7, the chances are that you’ve either used the upgrade path to update your old site in-place, or you built a new site from scratch and used the Migrate module from contrib to migrate your data from the old database.
-
-
In Drupal 8, things have changed as there’s no upgrade path from Drupal 7 and the Migrate module has been moved into core, though there are still migration related modules available in contrib.
-
-
This talk will look at the core Migrate module and how it implements Drupal 8 features such as YAML and the plugin and configuration systems, and how to write your own migrations to get your data into Drupal 8.
One of the main outcomes of Drupal 8 was “getting off the island” with third-party code included in core and adopting modern best practices from the wider PHP ecosystem - including Composer, PHP’s dependency manager.
-
-
Included to manage core’s dependencies, it has also gained traction in the contrib space with the creation of the Drupal Composer project, and the Drupal Packagist and now native endpoints on Drupal.org exposing contrib project metadata.
-
-
In this session, I'll show how to fully manage a Drupal 7 or Drupal 8 website including contributed modules and themes and external libraries with Composer.
I regularly speak at conferences and user groups about a range of subjects including Drupal, Sculpin and Git. If you would like to me to speak at your group or conference, please get in touch.
-
-
There is also information about events that I’ve attended and spoken at on my Lanyrd and Joind.in profiles.
Building a Drupal application? You no longer need to download archives to add new modules or update core, or deal with Drupal specific tools to manage your codebase.
-
-
With Drupal "getting off the island" there has been an increase in the adoption of common PHP tools within the Drupal ecosystem.
-
-
In this lightning talk, I’ll show how to build a Drupal application using Composer for dependency management.
Sculpin is a static site generator written in PHP, and based on Symfony components. It uses YAML and Twig, which makes it very appealing to Drupal people wanting to learn these in preparation for Drupal 8.
-
-
This session covered how to install Sculpin itself, as well as how to use it to build a static site from Markdown, HTML and Twig templates. We also covered Sculpin concepts such as content types, themes and partials, and Twig layouts, blocks and inheritance, as well as some tips and tricks that I've found whilst developing with Sculpin.
Test Driven Drupal Development with SimpleTest and PHPUnit
-
-
Testing is important. Why? It allows developers to add new features and edit and refactor existing code without the worry of adding regressions, reduces the reliance on manual testing to discover bugs, and by taking a test driven approach, your implementation code is leaner as you only write what is needed for your tests to pass.
-
-
Drupal 7 includes the SimpleTest module for unit and functional testing, whilst Drupal 8 also includes and supports PHPUnit - the defacto PHP testing framework, used by other PHP projects including Symfony and Laravel - making it easier for people to test their code. And with testing being one of the Drupal core gates with tests needing to be included with every new feature or bug fix, and core’s 100% pass rate policy, testing has become an essential skill when contributing to core, or when working on your own projects.
-
-
In this talk, we’ll cover the methodology and terminology involved with automated testing, and then take a test driven approach to creating a new Drupal module.
Oliver is a skilled Drupal developer with a passion for the Drupal community. As his direct supervisor, I was able to watch Oliver grow with the Drupal Association and contribute an amazing amount of effort and integrity to all of his work.
-
-
Everything we have thrown at Oliver, he has approached with an open and flexible mind that has allowed him to work on a wide range of projects and features for Drupal products.
Oliver has been an outstanding contributor to the Drupal Association team. He is a talented developer who writes great code and applies his curiosity and love of learning to every project. He is also a fantastic team member, who gives to the team as much as he gets.
-
-
Oliver is the embodiment of everything good about the Drupal community.
Oliver is a flexible and hardworking developer, with a terrific knowledge of Drupal. He promotes accessibility best practice within the Drupal community, and is always happy to share his knowledge with other people.
We used Oliver on a number of occasions throughout 2012 and I have to say we've been delighted with his work. His skills working with Drupal are excellent particularly with custom module development and we wouldn’t hesitate to recommend him others.
-
-
-
-
Daniel Easterbrook
-
-
-
-
Digital Strategy Consultant
-
-
-
-
Oliver is seasoned Drupal and all round highly skilled and experienced web developer. I have worked with Oliver on an important project where he was reliable, prompt and ensured strict client deadline delivery and confidentiality at all times.
-
-
-
-
Brian Hartwell
-
-
-
-
Interactive Creative Director
-
-
-
-
Oliver was great to work with. He has expert knowledge with Drupal and delivered exactly what we were looking for on time. He's understanding, friendly and easy to get along with. I would enjoy working with him again in the future.
-
-
-
-
Marlon Duncanson
-
-
-
-
Brand & Web Specialist
-
-
-
-
Oliver is a great guy and really easy to work with. He really goes the extra mile to make sure the project is done properly. I would recommend him and will not hesitate to use him again in future.
Oliver was fantastic to work with - pro-active and highly responsive, he worked well remotely and as part of a project team. His understanding of the project requirement(s) and ability to translate it into working code was essential and he delivered.