How we iteratively refactored an existing Drupal site

_nolocation
saschaeggi

In the beginning of 2016, we took over an existing D7 site with the aim to add new features as well as take care of maintenance.

After inspecting the code, the site building and the frontend, we discovered that the process used to build it did not match our own practice. We were faced with the choice to implement new features in the existing workflow or refactor what we needed without breaking the existing features.

The main problems that we encountered stems from the workflow used. While at Amazee Labs we start by site building and apply styles to a working website, the website was based on a frontend prototype, which was loaded into the theme fully compiled. Drupal was then modified to output the markup to match. In this talk we want to present different methods and strategies that were used to work with and work around the existing codebase.

 

We will talk about topics such as:

  • Working with a new theme while keeping the old theme functioning

  • Overwriting certain form elements’ theme functions without breaking existing forms

  • Overwrite templates and theme functions back to drupal’s initial code

  • Work with the aim to one day decouple both themes without breaking anything

  • The cons of working that way and the problem with frontend regressions

This talk assumes that you are familiar with Drupal’s codebase. We will talk about PHP code, JS compilation, templating and a whole stack of modules. You will also learn about the potential pitfalls of creating Drupal site in collaboration with another agency for the frontend implementation and what can be done to mitigate the risks.

Session Track

Site Building

Experience Level

Advanced

Drupal Version