- 🇮🇳India prempatel2447 Varanasi
Hi Everyone,
We will include all the changes in new release with Drupal 10 compatibility.
- First commit to issue fork.
- 🇨🇭Switzerland pvbergen
pvbergen → changed the visibility of the branch 3201520-integration-with-commerce to hidden.
- Merge request !15Add commerce_checkout.form route to exceptions for redirect → (Open) created by pvbergen
- 🇨🇭Switzerland pvbergen
The changes haven't made it into 2.x or 3.x yet. Updated the issue and MR for 3.0.x.
- Status changed to Needs work
11 months ago 6:27pm 29 January 2024 - 🇧🇬Bulgaria pfrenssen Sofia
Instead of adding more routes to the list, it would be a better idea to dispatch an event that can prevent the redirection. That would fix the problem for all possible use cases.
- Merge request !16Dispatch an event allowing modules to alter the URL and prevent redirection. → (Open) created by pfrenssen
- 🇧🇬Bulgaria pfrenssen Sofia
I added a new MR that dispatches an event allowing any module to prevent redirection, or alter the redirection URL.
To prevent redirection on the Commerce checkout form, a subscriber can be implemented that checks the route:
<?php declare(strict_types=1); namespace Drupal\ekw_test\EventSubscriber; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\redirect_after_login\Event\RedirectAfterLoginEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Subscribes to the RedirectAfterLoginEvent. */ class MySubscriber implements EventSubscriberInterface { /** * Constructs a MySubscriber object. * * @param \Drupal\Core\Routing\RouteMatchInterface $routeMatch * The current route match. */ public function __construct( protected RouteMatchInterface $routeMatch, ) {} /** * Prevent redirect after login in the Commerce checkout. */ public function onRedirectAfterLogin(RedirectAfterLoginEvent $event) { $current_route = $this->routeMatch->getRouteName(); if ($current_route === 'commerce_checkout.form') { $event->setRedirectAllowed(FALSE); } } /** * {@inheritdoc} */ public static function getSubscribedEvents() { return [RedirectAfterLoginEvent::class => 'onRedirectAfterLogin']; } }
- 🇨🇦Canada phjou Vancouver 🇨🇦 🇪🇺
Works perfectly @pfrenssen thanks!
I had to use this on the "auto_login_url.login" route otherwise it was breaking the auto login url module.
- Status changed to RTBC
9 months ago 10:47pm 2 April 2024