Skip to content
Snippets Groups Projects
Commit 533dee83 authored by Marc van Gend's avatar Marc van Gend Committed by Jack Over
Browse files

Issue #3137602 by marcvangend, sharma.amitt16, Sutharsan, scuba_fly,...

Issue #3137602 by marcvangend, sharma.amitt16, Sutharsan, scuba_fly, workplaysleep, vebrovski, Kristen Pol: Drupal 9 compatibility description
parent eb614fe6
No related branches found
No related tags found
No related merge requests found
name: Social media share
type: module
description: Share current page to social media
core_version_requirement: ^9
core_version_requirement: ^8.8 || ^9
package: Others
configure: social_media.admin_form
dependencies:
......
......@@ -2,12 +2,29 @@
namespace Drupal\social_media\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Drupal 9 is shipped with Symfony 4, which places the Event class in a
* different namespace than Symfony 3 did. In order to support Drupal 8 to
* Drupal 9 upgrades, we must find whichever class is available and extend it.
*/
if (class_exists('\Symfony\Contracts\EventDispatcher\Event')) {
class EventProxy extends \Symfony\Contracts\EventDispatcher\Event {
// Using the Symfony 4 class.
}
}
elseif (class_exists('\Symfony\Component\EventDispatcher\Event')) {
class EventProxy extends \Symfony\Component\EventDispatcher\Event {
// Using the Symfony 3 class.
}
}
else {
throw new \Exception('Error resolving Event class.');
}
/**
* Class SocialMediaEvent.
*/
class SocialMediaEvent extends Event {
class SocialMediaEvent extends EventProxy {
/**
* TODO describe element.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment