- Issue created by @jurgenhaas
- @jurgenhaas opened merge request.
- Status changed to Needs review
over 1 year ago 12:33pm 18 July 2023 - Status changed to Needs work
over 1 year ago 11:18am 19 July 2023 - 🇳🇴Norway eiriksm Norway
Great addition, makes sense!
Could we maybe get the module handler injected here? And if we could get it into an api.php file that would be great. Would of course be extra nice with a test, but not a requirement :)
- 🇩🇪Germany jurgenhaas Gottmadingen
Thanks @eiriksm for your feedback. I'm late with my response since I've been at DevDays in Vienna last week.
Could we maybe get the module handler injected here?
Absolutely, I've just proposed a quick solution initially to see if you would be willing to go for the general idea. Will of course clean up the code with DI and maybe more.
And if we could get it into an api.php file that would be great.
Yes, if we stick with an alter hook, then I would be adding this. However, the future proof approach would be to dispatch an event instead. What would be your preference?
Would of course be extra nice with a test, but not a requirement :)
Sure, will see what I can do.
- Assigned to jurgenhaas
- 🇩🇪Germany jurgenhaas Gottmadingen
@eiriksm any feedback on whether we should implement an event rather than an alter hook?
- 🇩🇪Germany jurgenhaas Gottmadingen
@eiriksm any feedback on whether we should implement an event rather than an alter hook?
- 🇳🇴Norway eiriksm Norway
Ah yeah.
I don't have any strong preferences, so do whatever suits your project requirements best?
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 11:13am 2 August 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
This is now implemented with an event because that's the future when hooks will be gone eventually ;-)
Making use of this could be done with an event subscriber like e.g. this:
namespace Drupal\example\EventSubscriber; use Drupal\linkchecker\Event\BuildHeader; use Drupal\linkchecker\Event\LinkcheckerEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Example event subscriber. */ class SomeSubscriber implements EventSubscriberInterface { /** * Linkchecker build header event handler. * * @param \Drupal\linkchecker\Event\BuildHeader $event * BuildHeader event. */ public function onBuildLinkcheckerHeader(BuildHeader $event): void { $headers = &$event->getHeaders(); $headers['X-SOMETHING'] = 'Test value'; } /** * {@inheritdoc} */ public static function getSubscribedEvents(): array { return [ LinkcheckerEvents::BUILD_HEADER => ['onBuildLinkcheckerHeader'], ]; } }
- last update
over 1 year ago 86 pass - 🇳🇴Norway eiriksm Norway
Sorry about the random commit to the MR, had to trigger the tests some way 🤓
- Status changed to Needs work
over 1 year ago 5:57pm 26 August 2023 - 🇳🇴Norway eiriksm Norway
2 comments:
- could you fix up the coding standards in the added code?
- just a personal preference, but would feel nicer if we used a setter on the event, and then retrieve the headers from the event after we dispatch it?Otherwise this is great stuff and looks great 👍
- last update
over 1 year ago 86 pass - Status changed to Needs review
over 1 year ago 4:10pm 28 August 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
Have addressed your comments in #12. THe last remaining code style issue is unrelated to this MR.
- last update
over 1 year ago 86 pass - Status changed to Fixed
over 1 year ago 4:29pm 28 August 2023 -
eiriksm →
committed d31dfe1e on 2.0.x authored by
jurgenhaas →
Issue #3375253 by jurgenhaas, eiriksm: Allow altering of the request...
-
eiriksm →
committed d31dfe1e on 2.0.x authored by
jurgenhaas →
Automatically closed - issue fixed for 2 weeks with no activity.