From 251756e92c9beddb2e1b51f8732efeec0a62d025 Mon Sep 17 00:00:00 2001 From: Erik Berggren <53995-erikbrgn@users.noreply.drupalcode.org> Date: Sat, 25 Nov 2023 12:13:50 +0000 Subject: [PATCH] Issue #3117973: Drupal 9 Compatibility --- composer.json | 26 +++++++++++++++++++ .../FieldFormatter/VideoJsPlayerFormatter.php | 8 +++--- .../VideoJsPlayerListFormatter.php | 6 ++--- videojs.info.yml | 3 ++- 4 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..7ae2ff5 --- /dev/null +++ b/composer.json @@ -0,0 +1,26 @@ +{ + "name": "drupal/videojs", + "type": "drupal-module", + "description": "Video.js is a HTML5-based video player with a built-in Flash fallback for older browsers.", + "keywords": [ + "Drupal" + ], + "license": "GPL-2.0-or-later", + "homepage": "https://www.drupal.org/project/videojs", + "authors": [ + { + "name": "Your name here", + "homepage": "https://www.drupal.org/u/your_name_here", + "role": "Maintainer" + }, + { + "name": "Contributors", + "homepage": "https://www.drupal.org/node/NID/committers", + "role": "Contributors" + } + ], + "support": { + "issues": "https://www.drupal.org/project/issues/videojs", + "source": "http://cgit.drupalcode.org/videojs" + } +} diff --git a/src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatter.php b/src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatter.php index 7a87067..c395555 100644 --- a/src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatter.php +++ b/src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatter.php @@ -76,7 +76,7 @@ class VideoJsPlayerFormatter extends VideoJsPlayerFormatterBase implements Conta $configuration['label'], $configuration['view_mode'], $configuration['third_party_settings'], - $container->get('current_user') + $container->get('current_user'), ); } @@ -186,12 +186,12 @@ class VideoJsPlayerFormatter extends VideoJsPlayerFormatterBase implements Conta } return $elements; } - + /** * {@inheritdoc} */ public static function isApplicable(FieldDefinitionInterface $field_definition) { - $entity_form_display = entity_get_form_display($field_definition->getTargetEntityTypeId(), $field_definition->getTargetBundle(), 'default'); + $entity_form_display = \Drupal::service('entity_display.repository')->getFormDisplay($field_definition->getTargetEntityTypeId(), $field_definition->getTargetBundle(), 'default'); $widget = $entity_form_display->getRenderer($field_definition->getName()); $widget_id = $widget->getBaseId(); if(!$field_definition->isList()){ @@ -199,4 +199,4 @@ class VideoJsPlayerFormatter extends VideoJsPlayerFormatterBase implements Conta } return FALSE; } -} \ No newline at end of file +} diff --git a/src/Plugin/Field/FieldFormatter/VideoJsPlayerListFormatter.php b/src/Plugin/Field/FieldFormatter/VideoJsPlayerListFormatter.php index fdf7245..fccfd13 100644 --- a/src/Plugin/Field/FieldFormatter/VideoJsPlayerListFormatter.php +++ b/src/Plugin/Field/FieldFormatter/VideoJsPlayerListFormatter.php @@ -61,12 +61,12 @@ class VideoJsPlayerListFormatter extends VideoJsPlayerFormatter implements Conta ); return $elements; } - + /** * {@inheritdoc} */ public static function isApplicable(FieldDefinitionInterface $field_definition) { - $entity_form_display = entity_get_form_display($field_definition->getTargetEntityTypeId(), $field_definition->getTargetBundle(), 'default'); + $entity_form_display = \Drupal::service('entity_display.repository')->getFormDisplay($field_definition->getTargetEntityTypeId(), $field_definition->getTargetBundle(), 'default'); $widget = $entity_form_display->getRenderer($field_definition->getName()); $widget_id = $widget->getBaseId(); if($field_definition->isList()){ @@ -74,4 +74,4 @@ class VideoJsPlayerListFormatter extends VideoJsPlayerFormatter implements Conta } return FALSE; } -} \ No newline at end of file +} diff --git a/videojs.info.yml b/videojs.info.yml index 2266204..08c8f0b 100644 --- a/videojs.info.yml +++ b/videojs.info.yml @@ -2,4 +2,5 @@ name: Video.js Player type: module description: Video.js is an HTML5 Video Player. package: Media -core: 8.x \ No newline at end of file +core: 8.x +core_version_requirement: ^8 || ^9 -- GitLab