I was asked at Drupalcamp London how to identify where parts of a panel come from. Whether you need to change something on a site you inherited, are looking to trace your steps back on something you created long ago, or need to understand how to fix a colleague's mistake, it can be helpful to have a toolkit of methods to find out what produces all sorts of mystery content - not just for panels, but also views, blocks, fields, and the like.
This is part 3 in my series of articles about creating a custom field. I recommend reading Part 1: Field type and Part 2: Field widget first, if you have not done so already. After creating the field type and field widget it is now time to complete the set by creating the field formatter. ##a) Create the file The field type must be located as follows: /lib/Drupal/ /Plugin/field/formatter/ .php
N.B. The field formatter...
This is part 2 in my series of articles about Drupal widgets, and specifically creating a custom field. I recommend reading Part 1: Field type first, if you have not done so already. After creating the field type it is now time to create the field widget. ##a) Create the file The field widget must be located as follows: /lib/Drupal/ /Plugin/field/widget/ .php N.B. The field widget name should be in CamelCase. ##b) Add Contains, namespace...
Having written articles on how to create a Drupal 8 field type, field widget and field formatter I thought that now is the time to explain why you might want to create a custom field type. More specifically, why I have created a custom field. To provide some context: my pet Drupal 8 project is to produce a companion site for players of the Fantasy Football (soccer) game Fantasy Premier League (N.B. this is not...
I have been experimenting with the Alpha release of Drupal 8 and so I'm sharing some of my experiences so that you can avoid the pitfalls I have encountered. First I would like to give credit to the two articles I used during the exercise: * Upgrading Code Snippets Module to Drupal 8: Creating a Custom Field * D7 to D8 upgrade: fields, widgets and formatters Hopefully this article will provide a third point-of-view to...
Previously on this website I have written about rendering blocks programmatically and adding things to content to be managed alongside fields. It's time to combine the two! On many projects, we find ourselves needing to render a block consistently across all content of a certain type. For example: Are you trying to place advertising blocks or fixed javascript code between the fields in the content of a page, not just shoved into regions around the...
If you have a Drupal 7 site, then you should be using the [Entity cache][ec] module, here's why: Lots and lots of things in Drupal are 'entities', such as the content, the users, the taxonomy terms and if you're using contrib modules like [Field collection][fc] or [ECK][eck], then those are entities too. Most of the time you have some fields on those entities, then every time Drupal needs to load one up, it'll also have...
Sometimes as a module developer you need to have some code execute periodically, like maybe every day or even once a week. This might be to optimise an external system, or pull in some external data or to compute some statistics every day etc. Drupal provides a very simple way of doing this: hook_cron
but if you want your code to only execute say once a day or after 6pm only, then you have to...
There are a few write-ups about using Aegir to automate your deployment process notably one from Mig5: Zero-touch Drupal deployment with Jenkins, Aegir, Git, Fabric and Drush. I recently wanted to set this up for our own project, but felt like I could make some improvements. I don’t like deploying branches, because it can be really hard to actually find out what was deployed at a later date, and you can’t reliably re-deploy that previous...
Sorry if you are expecting the 'solution' to be given in this post, but this is basically a brain-dump of where I'm at with this problem, and my thoughts on how I might go about solving it. ### Background First up, a little background on Computerminds and the sort of development we do. We tend to take on a mixture of projects, we have projects where we'll be completely responsible for the entire technology stack...