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

# Documentation added for supported hooks and APIs in Retrofit for Drupal



[Retrofit for Drupal](https://retrofit-drupal.com/) now has documentation to explain what Drupal 7 [hooks and APIs are supported](https://github.com/retrofit-drupal/retrofit/blob/main/docs/README.md). Retrofit for Drupal provides backward compatibility layers to run legacy Drupal 7 code in your sites using Drupal 10 and beyond. The problem, however, is anyone evaluating Retrofit for Drupal has had to take time to give it a test run and "see what happens." The documentation explains the various backward compatibility layers.

Documentation is critical for open source projects. Especially for a project that doesn't add functionality but ensures functionality for existing code continues to work. I hit some decision paralysis on how to set up documentation. The point of Retrofit for Drupal is to avoid having to configure our change code. However, the common question was, "But what hooks does it support?" Now, there is documentation within the repository to document the following:

- [Supported hooks](https://github.com/retrofit-drupal/retrofit/blob/main/docs/supported-hooks.md): documentation about each supported hook, and any caveats.
- [Supported APIs](https://github.com/retrofit-drupal/retrofit/blob/main/docs/supported-apis.md): documentation about overall APIs that are supported.
- [Supported global variables](https://github.com/retrofit-drupal/retrofit/blob/main/docs/supported-globals.md): documentation about supported global variables used in Drupal 7.

Unfortunately, this doesn't cover the fact certain functions are supported, such as all database functions or `variable_get` and `variable_set`. I'll be adding more information shortly.

It isn't a perfect solution. I need to solicit feedback on checking "Is this hook supported?" I assume it would involve some search feature, like [Drupal's API reference](https://api.drupal.org/api/drupal). The problem is that I don't want to build API documentation about Retrofit for Drupal and its internals. One idea I had was a mapping file somewhere that would allow mapping a component of Drupal 7 (functions, hooks, concepts) to its backward compatibility layer components in Drupal 7. Maybe there could be a way to use [phpDocumentor](https://docs.phpdoc.org/3.0/) or [ApiGen](https://github.com/apigen/apigen) and PHP attributes to solve this problem.

 

  ![](/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

Writing backward-compatible deprecation fixes for contributed modules will be much easier for Drupal 11

 ](/blog/writing-backward-compatible-deprecation-fixes-contributed-modules-will-be-much-easier-drupal) [Newer →

To POST, or PUT, PATCH, and DELETE? URLs are cheap, but API design matters

 ](/blog/post-or-put-patch-and-delete-urls-are-cheap-api-design-matters)