- Issue created by @lostcarpark
- Assigned to markie
- 🇺🇸United States ultimike Florida, USA
I think it makes more sense to move the
invokeAll()
call to before$link = $entity->toLink($more);
. This way, if ahook_smart_trim_link_modify()
implementation modifies any of its three arguments, those changes are accounted for.So, from:
$target = $more_settings['target_blank']; $link = $entity->toLink($more); $project_link = $link->toRenderable(); $project_link['#attributes']['class'] = [$class]; // Allow other modules to modify the read more link before it's // created. $this->moduleHandler->invokeAll('smart_trim_link_modify', [ $entity, &$more, &$link, ]);
to:
$target = $more_settings['target_blank']; // Allow other modules to modify the read more link before it's // created. $this->moduleHandler->invokeAll('smart_trim_link_modify', [ $entity, &$more, &$link, ]); $link = $entity->toLink($more); $project_link = $link->toRenderable(); $project_link['#attributes']['class'] = [$class];
Assigning to @markie for his thoughts.
-mike
- Issue was unassigned.
- 🇺🇸United States ultimike Florida, USA
@lostcarpark,
What did you have in mind for a test? Setting some config the usual way, then a test-only module that implements the hook, then confirming the output of formatter include the test module's changes?
-mike
- 🇮🇪Ireland lostcarpark
I think to test you'd probably need a test module that implements the hook, and the test would install the module, trigger a trim operation, and verify that the hook has modified in the expected way.
- Status changed to Closed: duplicate
over 1 year ago 3:40pm 20 August 2023 - 🇺🇸United States ultimike Florida, USA
Duplicate of 🐛 Regression: API Hook No Longer Works Fixed .
-mike