mglaman / composer-drupal-lenient

Allows installing Drupal extensions even if not compatible with installed drupal/core package
112 stars 6 forks source link

Add service provider, try to influence Drupal runtime parsing of core_version_requirement #14

Open mglaman opened 1 year ago

weitzman commented 1 year ago

Folks who need this might want to try https://www.drupal.org/project/backward_compatibility

mglaman commented 10 months ago

Huh, so this is the magic.

/**
 * Implements hook_system_info_alter().
 */
function backward_compatibility_system_info_alter(&$info, Extension $file, $type) {
  $info['core_incompatible'] = FALSE;
}

Ah but it's invoked within the ExtensionList which is impossible to decorate. https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Core/Extension/ExtensionList.php#L322

And it's a bit risky (maybe) to decorate the module handler and manually inject our own hook.

alexpott commented 3 months ago

Another way would be to do a drush :) And add system_system_info_alter() in a file and include that file via composer. It does something similar with a log hook I think.

alexpott commented 3 months ago

FWIW this is something that hopefully hooks as PHP Attributes will allow us to solve nicely.