Add registry_autoload as an alternative to xautoload

Created on 4 March 2019, about 6 years ago
Updated 21 March 2025, 19 days ago

Problem/Motivation

Fragments uses PSR4-based class loading to find some of its classes. This avoids having to add all class files added to the module in the .info file for Drupal 7's own autoloading mechanism to be able to find the classes. Xautoload and registry_autoload are both modules that allow Drupal 8-like autoloading based on the class namespace. Fragments currently requires xautoload for this purpose, but if I understand correctly xautoload is the more heavy and complex solution. It would be nice if Fragments were more solution-agnostic and allow either autoloading module.

Proposed resolution

Remove xautoload as a requirement in the info file and replace it with a hook_requirements implementation that checks whether either xautoload or registry_autoload is present. This may introduce some risk, as it does not prevent someone from disabling the autoload module, which might leave the system in a problematic state (AFAIK, hook_requirements can not prevent a module from being disabled).

Remaining tasks

* Determine if this really is a path to pursue (for the stated reason above), or maybe it is better to replace xautoload with registry_autoload. Both will happily function in parallel.

User interface changes

None, except for maybe some output for the hook_requirements implementation.

API changes

None.

Data model changes

None.

Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇳🇱Netherlands eelkeblok Netherlands 🇳🇱

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024