- Issue created by @berdir
- 🇨🇭Switzerland berdir Switzerland
This might not be as hard as I feared, but it does depend on this central piece of magic:
$initial_preprocess_class = 'Drupal\\' . $def['provider'] . '\\Hook\\' . Container::camelize($def['provider']) . 'ThemeHooks'; $initial_preprocess_method = 'preprocess' . Container::camelize($def['theme']); if (method_exists($initial_preprocess_class, $initial_preprocess_method)) { $hooks[$def['theme']]['initial preprocess'] = $initial_preprocess_class . ':' . $initial_preprocess_method; }
I think we generally want less magic like this (service providers), but it's not enforced, just a default, and it feels in line with the kind of magic that this hook does.
There is also the bit about theme_file that plugins can in theory provide, but the new attribute classes are actually missing that and I want to deprecate the underlying 'file' key as well, so I just went ahead and added that deprecation right now. There are a bunch of them in contrib, but again, they would need to resort to a plugin definition alter hook for this in D12 with attributes anyway. And all they need to do for D12 compatibility is move the functions into their .module file (or convert to initial preprocess, but that would require 11.3 unless we backport this)