 [ ← blog / drupal ](/) Jul 18, 2023  ·  \#drupal  ·  2 min read 

# Retrofit's next milestone: Drupal 7 theme support



It has been a little over a month since I [announced Retrofit](https://mglaman.dev/blog/retrofit-running-legacy-drupal-7-code-your-drupal-10-site). The project provides a compatibility layer to allow legacy Drupal 7 code to run within a Drupal 10 code base. Since Retrofit was first released, I was able to add support for [theme functions](https://github.com/mglaman/retrofit-drupal/commit/2fa74a07bec95db8543d1a55e99b98e701146426) and [PHPTemplate template files](https://github.com/mglaman/retrofit-drupal/commit/00910c21bf4439f9fb8696d394450f8b90389029) so that existing `hook_theme` declarations work with minimal modifications. Since then, I have been trying to decide on the next milestone for the project. What compatibility support can Retrofit provide to unlock the most benefit to organizations upgrading from Drupal 7? Themes!

## Theme support in Retrofit

In my experience, it has generally been a pattern that any site upgrade entails a redesign. But, that has been because the upgrade was treated as a re-platform versus a software upgrade. Retrofit is meant to make the transition off of Drupal 7 as an upgrade and not a re-platform.

One major challenge surrounds enforcing asset libraries for attaching CSS and JavaScript to the page. In Drupal 7, developers could call `drupal_add_css` and `drupal_add_js` to attach CSS and JavaScript files to the page arbitrarily. Themes defined their CSS and JavaScript files in their info file. Retrofit must [dynamically create and register an asset library from these definitions](https://github.com/mglaman/retrofit-drupal/issues/26).

Once that is resolved, I imagine there will be a handful of smaller issues before themes are "just working" when using Retrofit. I will need to address the fact there is no longer a "post-process" hook for rendered output, only "pre-process." I'll need to find a way to invoke those hooks.

However, [Alex Bronstein (effulgentsia)](https://www.drupal.org/u/effulgentsia) raised an important issue that Retrofit must address: [securely running Drupal 7 templates and themes](https://github.com/mglaman/retrofit-drupal/issues/15). Drupal 8 replaced PHPTemplate with the Twig templating system. Twig features automatic output-escaping, making it far more secure against XSS scripts. Drupal 7 would escape any variables known to have come from user-based input. Retrofit will need to provide a solution for this.

## Support Retrofit's development

Are you looking to use Retrofit? Do you believe it'd solve your organization's upgrade from Drupal 7 to Drupal 10? Consider becoming a [GitHub Sponsor](https://github.com/sponsors/mglaman)!

I am also evaluating a paid support queue, making it easier for organizations to get support when using Retrofit. This allows privately discussing system code to help build Retrofit's compatibility layers. If interested, [contact me](https://mglaman.dev/contact-matt)!

 

  ![](/themes/custom/mglaman/images/headshot.webp)Thanks for reading

I write about Drupal, PHP, and the quiet infrastructure behind large sites — caching, config, and testing. New posts land every week or two.

 [Subscribe via RSS →](/rss.xml) [About me →](/about-me) 

 



 

  [← Older

Can we use concurrency to speed up streamed BigPipe responses in Drupal?

 ](/blog/can-we-use-concurrency-speed-streamed-bigpipe-responses-drupal) [Newer →

Speed up developer onboarding with DDEV snapshots from your CI

 ](/blog/speed-developer-onboarding-ddev-snapshots-your-ci)