Report from Drupal Camp Islamabad
After Drupal Camp Lahore and Drupal Camp Islamabad earlier this year, I was once again inivited to Drupal Camp Islamabad to present a session on Drupal 8 as a framework.
After Drupal Camp Lahore and Drupal Camp Islamabad earlier this year, I was once again inivited to Drupal Camp Islamabad to present a session on Drupal 8 as a framework.
At PreviousNext we rely heavily on vagrant for development environments and phing for performing automated tasks to speed up site building and project development. These tools are hugely beneficial in the long run. In this blog we'll have a look at how we as drupal core developers can automate the tedious tasks like site install/ re-install, testing, coding standards validation and enable modules.
Although Drupal 8 has had a Conditions Plugin API for a several months, it wasn't until during DrupalCon Austin sprint we managed to get blocks to use the Conditions Plugin API for block visibility.
The great thing about Condition Plugins, is they are re-usable chunks of code, and many contrib projects will be able to take advantage of them (Page Manager, Panels, Rules anyone?)
In this post, I show how you can create an example Page Message module that uses a RequestPath condition plugin to show a message on a configured page.
When working with the Search API Drupal module, sometimes we need to programmatically add information that is not available for indexing as a field. Lucky we can write our own custom pre-processor to provide this information to the index.
Our client had some very specific requirements for their project. They needed to be able to insert links to files and they needed to keep the same URL for those files even if the file changed. Those familiar with Drupal will know that by default, Drupal will suffix the newer version of the filename with _0, _1 etc which obviously breaks the URL. Here's how we worked around the issue...
One of the key goals of namespaces in PHP is to avoid collisions between class and function names between different libraries. Using namespaces and the PSR-0/4 standard creates a clean and simple way of sharing code across projects. This is a core part of the Drupal 8 architecture.
This approach has been a large factor in the PHP Renaissance and the huge amount of sharing of code across PHP external libraries.
In this post, I will show how we can leverage external libraries in existing Drupal 7 sites, using similar techniques to how it is being done in Drupal 8.
In Drupal we use object-oriented page and form callbacks to ease our programmning burden This is a nice improvement that allows us to encapsulate the functionality of one or many page callbacks into objects, with all the benefits that brings. Is it possible for us to us object-oriented page callbacks in Drupal 7? With a few tricks, yes it is. This article shows you how.
This is part of a continuing series of using Drupal 8 programming techniques in Drupal 7.
Drupal 8 embraces modern PHP with all the trimmings, shedding the baggage of supporting earlier PHP versions and embracing the new object-oriented features.
One such feature is namespaced objects and the PSR-0 standard for autoloader compatability.
But if you know your project will run on a recent version of PHP, there's no reason you can't write your custom modules using PSR-0 now, in Drupal 7
Friday February 14th is the DrupalSouth Code Sprint, and PreviousNext are descending en masse to Wellington, New Zealand, to participate.
As a team we've been discussing what we'd like to sprint on. We've collectively agreed that the sprint would be an opportune time to work on porting some of our favourite contrib modules to Drupal 8.
Read on to find out our plans and how you can get involved.
Previously I have demonstrated how to create a new route controller in Using Drupal 8's new route controllers then how to restrict access to it in Controlling Access to Drupal 8 Routes with Access Checks. But that's not where the fun ends!
What about when we need to create a route dynamically. For example, if we need to create routes for content types that we don't know will exist in advance? In Drupal 7, we created dynamic routes with a foreach loop in hook_menu(). In Drupal 8, we can do all this and more with a RouteSubscriber.
Drupal 8 comes with many new concepts. A lot of work has gone into expanding on Entities and forms. One such concept is the EntityFormController. The EntityFormController is a controller class for the management of forms for entities. Say for example your module Foo defines an entity Bar. Say you want to provide a form for this entity so that users can set some properties or field values. In the past you would have created a hook_menu item to a drupal_get_form callback. In Drupal 8 we do it a better way. We define a class which implements the EntityFormController. The base class provides some pre-built entity goodness, and we can extend the class to add whatever we need.
What are the core skills, tools and practices you will need to be Drupal 8 ready? How do you get them now? This summary is a companion to PreviousNext's DrupalCon presentation "Drupal 8 Ready".