Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drupal 10 compatibility changes #10

Closed
wants to merge 1 commit into from

Conversation

rbran100
Copy link

@rbran100 rbran100 commented Dec 7, 2023

Updates to make purl-d8 compatible with drupal 10.

@scottatdrake
Copy link

I ran into fatal errors when upgrading to Drupal 10. Here are the changes I made to resolve them but there may be more.

 diff -ruN web/modules/contrib/purl ~/purl-copy/purl/purl

diff --color -ruN web/modules/contrib/purl/src/Event/PurlNodeContextRoutes.php /Users/scottphillips/purl-copy/purl/purl/src/Event/PurlNodeContextRoutes.php
--- web/modules/contrib/purl/src/Event/PurlNodeContextRoutes.php	2024-04-01 10:17:51
+++ /Users/scottphillips/purl-copy/purl/purl/src/Event/PurlNodeContextRoutes.php	2024-04-01 10:12:21
@@ -88,7 +88,7 @@
             $redirect_response->getCacheableMetadata()->setCacheMaxAge(0);
             $modifiers = $event->getRequest()->attributes->get('purl.matched_modifiers', []);
             $new_event = new ExitedContextEvent($event->getRequest(), $redirect_response, $this->routeMatch, $modifiers);
-            $dispatcher_interface->dispatch(PurlEvents::EXITED_CONTEXT, $new_event);
+            $dispatcher_interface->dispatch($new_event, PurlEvents::EXITED_CONTEXT);
             $event->setResponse($new_event->getResponse());
             return;
           }
diff --color -ruN web/modules/contrib/purl/src/Event/RequestSubscriber.php /Users/scottphillips/purl-copy/purl/purl/src/Event/RequestSubscriber.php
--- web/modules/contrib/purl/src/Event/RequestSubscriber.php	2024-04-01 10:17:51
+++ /Users/scottphillips/purl-copy/purl/purl/src/Event/RequestSubscriber.php	2024-04-01 10:12:21
@@ -123,7 +123,7 @@
         $match['modifier'],
         $match['value']
       );
-      $dispatcher->dispatch(PurlEvents::MODIFIER_MATCHED, $modifier_event);
+      $dispatcher->dispatch($modifier_event, PurlEvents::MODIFIER_MATCHED);
       $this->matchedModifiers->add($modifier_event);
       $request->attributes->set('purl.matched_modifiers', $matches);

diff --color -ruN web/modules/contrib/purl/src/Routing/UrlGenerator.php /Users/scottphillips/purl-copy/purl/purl/src/Routing/UrlGenerator.php
--- web/modules/contrib/purl/src/Routing/UrlGenerator.php	2024-04-01 10:17:51
+++ /Users/scottphillips/purl-copy/purl/purl/src/Routing/UrlGenerator.php	2024-04-01 10:12:21
@@ -97,7 +97,7 @@
    *
    * @return RequestContext The context
    */
-  public function getContext()
+  public function getContext(): RequestContext
   {
     return $this->urlGenerator->getContext();
   }
@@ -108,7 +108,8 @@
    * @param bool|string $referenceType
    * @return string
    */
-  public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
+
+   public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH): string
   {
     return $this->urlGenerator->generate($name, $parameters, $referenceType);
   }

Copy link
Author

@rbran100 rbran100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes have been working well for us @freelock

@rbran100
Copy link
Author

Closed in favor of #11

@rbran100 rbran100 closed this Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants