- Issue created by @nicxvan
- ๐บ๐ธUnited States nicxvan
nicxvan โ changed the visibility of the branch 3484217-hookorder-classandmethod-should to hidden.
- ๐ฎ๐ณIndia nikhil_110
All the test cases passed and it is working fine. But I have a suggestion for changing the code. We can pass "$class::$method" to class_and_method in changePriority function itself instead of changing it in different places in the code, so that it is not necessary to change it in multiple functions.
protected static function changePriority(ContainerBuilder $container, string $hook, string $class, string $method, bool $should_be_larger, ?array $others = NULL): void { $class_and_method = "$class::$method"; ... }
- ๐บ๐ธUnited States smustgrave
@nicxvan for BC will need some form of deprecation if someone doesn't include the 2nd param.
- ๐บ๐ธUnited States nicxvan
@nikhil_110 we could do that, but changePriority is protected so it really doesn't matter.
@smustgrave If we get this in now, this doesn't need BC it's not released yet.
Added a comment about how the parsing of the pairs might need to handle the case where there is a mismatch between number of classes/methods.
Also, has it been considered that instead of changing the string argument
$class_and_method
into two string arguments$class
and$method
, that$class_and_method
changed to be an array? And then `$others` should be an array of arrays. With each array being validated as having two items.So it'd look like this:
$method = 'formFilterFormatFormAlter'; HookOrder::after($container, 'form_filter_format_form_alter', [Ckeditor5Hooks::class, $method], [EditorHooks::class, $method], [MediaHooks::class, $method]);
IMO, it makes it a little nicer DX to be able to keep track of the pairs.
- ๐บ๐ธUnited States nicxvan
Thanks for your review, I think that makes sense, I won't be able to update that today though.
- ๐บ๐ธUnited States nicxvan
Postponed on https://www.drupal.org/project/drupal/issues/3484754 ๐ Ordering of alter "extra hooks" is a gigantic mess Active