Browse: Home / Classes /

Autoloaded_Sub_Plugin

Autoloaded_Sub_Plugin

A bundled add-on whose own classes have to be loadable without a composer.json entry.


Description #

The namespace is registered when the Plugin Absorber announces that it is about to require the bundled file, so the mapping exists only for a copy that is actually loading. A composer.json entry cannot be conditional, and would leave the namespace pointing at code the Absorber declined to load — so an active standalone copy of the add-on could be served the bundled classes instead of its own. This is also how the other bundled modules work: Course Grid registers its own autoloader from its main file, and Licensing ships a module-local Composer classmap.

Autoloader appends itself to the SPL chain while Composer prepends, so a standalone copy’s own Composer loader always answers ahead of this one. The wrong copy cannot be resolved rather than being resolved and undone.


Source #

File: src/Core/Libraries/Plugin_Absorber/Autoloaded_Sub_Plugin.php


Changelog #

Changelog
Version Description
5.2.0 Introduced.


Methods #

  • boot — Registers the add-on, and arranges for its namespace to be mapped if the Absorber loads the bundled copy.
  • get_module_name — The add-on's name as the constant and the filter spell it.
  • get_psr4_prefixes — PSR-4 prefixes the bundled copy ships, keyed by prefix with the absolute directory as the value.
  • get_slug — Slug the Plugin Absorber knows the bundled add-on by.
  • hook_autoloading — Listens for the Absorber announcing that the bundled file is about to be required.
  • register — Registers the bundled add-on with the Plugin Absorber.
  • register_autoloading — Registers this add-on's prefixes on this plugin's autoloader.
  • should_load — Whether the bundled add-on should be loaded at all.