diff --git a/ableplayer.install b/ableplayer.install index 9c7b93b31d63c27c911c44683e31b6e18604916e..a234cd78ba4ba63383cb56dbceac6560db07cdcc 100644 --- a/ableplayer.install +++ b/ableplayer.install @@ -2,16 +2,12 @@ /** * @file + * Install file for Able Player. */ use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldConfig; -/** - * @file - * Install file for Able Player. - */ - /** * Implements hook_install(). */ @@ -98,13 +94,19 @@ function ableplayer_install() { $video_entity_view_display = $factory->getEditable('core.entity_view_display.media.video.default'); $video_entity_view_display->set('content.field_media_video_file.type', 'ableplayer_video'); - $video_entity_view_display->set('content.field_media_video_file.settings', ['controls' => FALSE, 'autoplay' => FALSE, 'loop' => FALSE, 'multiple_file_display_type' => 'tags']); + $video_entity_view_display->set('content.field_media_video_file.settings', [ + 'controls' => FALSE, + 'autoplay' => FALSE, + 'loop' => FALSE, + 'multiple_file_display_type' => 'tags', + ]); $video_entity_view_display->save(); } /** - * Adds support for swappable audio description videos if hosted on YouTube or - * Vimeo. + * Adds support for swappable audio description. + * + * If videos are hosted on YouTube or Vimeo. */ function ableplayer_update_9001() { $remote_video_fields = _ableplayer_remote_video_fields(); diff --git a/src/Plugin/Field/FieldFormatter/AbleplayerAudioFormatter.php b/src/Plugin/Field/FieldFormatter/AbleplayerAudioFormatter.php index 18abc09ec5992b92828b6458d6d2a8a576815943..087ef545f7791c51d97a2039d89d47e133c85aca 100644 --- a/src/Plugin/Field/FieldFormatter/AbleplayerAudioFormatter.php +++ b/src/Plugin/Field/FieldFormatter/AbleplayerAudioFormatter.php @@ -11,15 +11,15 @@ use Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase; * Plugin implementation of the 'ableplayer_audio' formatter. */ #[FieldFormatter( - id: 'ableplayer_audio', - label: new TranslatableMarkup('Ableplayer Audio'), - description: new TranslatableMarkup('Display the file using Ableplayer.'), - field_types: [ - 'file', - ] + id: 'ableplayer_audio', + label: new TranslatableMarkup('Ableplayer Audio'), + description: new TranslatableMarkup('Display the file using Ableplayer.'), + field_types: [ + 'file', + ] )] /** - * + * Setup audio media type display settings and configure Ableplayer. */ class AbleplayerAudioFormatter extends FileMediaFormatterBase { @@ -50,7 +50,11 @@ class AbleplayerAudioFormatter extends FileMediaFormatterBase { if ($parent->hasField('field_ableplayer_media_caption')) { foreach ($elements as &$element) { - $element['#caption'] = $parent->field_ableplayer_media_caption->view(['type' => 'entity_reference_entity_view', 'settings' => ['view_mode' => 'able_player_caption_view_mode']]); + $element['#caption'] = $parent->field_ableplayer_media_caption->view( + [ + 'type' => 'entity_reference_entity_view', + 'settings' => ['view_mode' => 'able_player_caption_view_mode'], + ]); } } diff --git a/src/Plugin/Field/FieldFormatter/AbleplayerCaptionFormatter.php b/src/Plugin/Field/FieldFormatter/AbleplayerCaptionFormatter.php index 799e0db130cb96d2193964b72f091be31094a07a..ba73c83c168a41d3fe4606f4746cd9d10c1c5a4d 100644 --- a/src/Plugin/Field/FieldFormatter/AbleplayerCaptionFormatter.php +++ b/src/Plugin/Field/FieldFormatter/AbleplayerCaptionFormatter.php @@ -14,15 +14,15 @@ use Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase; * Plugin implementation of the 'ableplayer_caption' formatter. */ #[FieldFormatter( - id: 'ableplayer_caption', - label: new TranslatableMarkup('Ableplayer Media Caption'), - description: new TranslatableMarkup('Display media caption'), - field_types: [ - 'file', - ] + id: 'ableplayer_caption', + label: new TranslatableMarkup('Ableplayer Media Caption'), + description: new TranslatableMarkup('Display media caption'), + field_types: [ + 'file', + ] )] /** - * + * Retrieve file needed to display captions and configure display settings. */ class AbleplayerCaptionFormatter extends FileMediaFormatterBase { diff --git a/src/Plugin/Field/FieldFormatter/AbleplayerChapterFormatter.php b/src/Plugin/Field/FieldFormatter/AbleplayerChapterFormatter.php index 54395549f8e43cc0698a4809f7de87e14065d8b3..6371b371472df495823050428489830440f3b2cb 100644 --- a/src/Plugin/Field/FieldFormatter/AbleplayerChapterFormatter.php +++ b/src/Plugin/Field/FieldFormatter/AbleplayerChapterFormatter.php @@ -12,15 +12,15 @@ use Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase; * Plugin implementation of the 'ableplayer_video' formatter. */ #[FieldFormatter( - id: 'ableplayer_chapter', - label: new TranslatableMarkup('Ableplayer Chapter'), - description: new TranslatableMarkup('Display media chapter'), - field_types: [ - 'file', - ] + id: 'ableplayer_chapter', + label: new TranslatableMarkup('Ableplayer Chapter'), + description: new TranslatableMarkup('Display media chapter'), + field_types: [ + 'file', + ] )] /** - * + * Functions to retrieve file needed to display chapter information. */ class AbleplayerChapterFormatter extends FileFormatterBase { diff --git a/src/Plugin/Field/FieldFormatter/AbleplayerPosterImageFormatter.php b/src/Plugin/Field/FieldFormatter/AbleplayerPosterImageFormatter.php index 05dcb632a2ec61934afea708b5a8fd05177d80d7..fe3c384f3c5ef06ccb835f6f1ec7b423352010b7 100644 --- a/src/Plugin/Field/FieldFormatter/AbleplayerPosterImageFormatter.php +++ b/src/Plugin/Field/FieldFormatter/AbleplayerPosterImageFormatter.php @@ -12,15 +12,15 @@ use Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase; * Plugin implementation of the 'ableplayer_video' formatter. */ #[FieldFormatter( - id: 'ableplayer_poster_image', - label: new TranslatableMarkup('Ableplayer Poster Image'), - description: new TranslatableMarkup('Display Poster Image prior to video loading'), - field_types: [ - 'file', - ] + id: 'ableplayer_poster_image', + label: new TranslatableMarkup('Ableplayer Poster Image'), + description: new TranslatableMarkup('Display Poster Image prior to video loading'), + field_types: [ + 'file', + ] )] /** - * + * Two functions to return the poster image for media. */ class AbleplayerPosterImageFormatter extends FileFormatterBase { @@ -44,7 +44,6 @@ class AbleplayerPosterImageFormatter extends FileFormatterBase { '#file' => $file, ]; } - return $elements; } diff --git a/src/Plugin/Field/FieldFormatter/AbleplayerRemoteVideoFormatter.php b/src/Plugin/Field/FieldFormatter/AbleplayerRemoteVideoFormatter.php index 556c600891a0aeca381e414e39e00cbfbb2c3bc9..35b83c240a950097a225a4686d09b50d58d58e7e 100644 --- a/src/Plugin/Field/FieldFormatter/AbleplayerRemoteVideoFormatter.php +++ b/src/Plugin/Field/FieldFormatter/AbleplayerRemoteVideoFormatter.php @@ -16,17 +16,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * Plugin implementation of the 'ableplayer_remote_video' formatter. */ #[FieldFormatter( - id: 'ableplayer_remote_video', - label: new TranslatableMarkup('Ableplayer Remote Video'), - description: new TranslatableMarkup('Display the remote file using Ableplayer.'), - field_types: [ - 'link', - 'string', - 'string_long', - ] + id: 'ableplayer_remote_video', + label: new TranslatableMarkup('Ableplayer Remote Video'), + description: new TranslatableMarkup('Display the remote file using Ableplayer.'), + field_types: [ + 'link', + 'string', + 'string_long', + ] )] /** - * + * Allows Ableplayer to be a media format for video files from oEmbed. */ class AbleplayerRemoteVideoFormatter extends FormatterBase { @@ -156,13 +156,11 @@ class AbleplayerRemoteVideoFormatter extends FormatterBase { } /** - * + * Retrieve the ID of the remote video based on provider. */ private function getVideoId($provider, $url) { - /** - * Set $id to be an empty string to prevent an unset variable warning if an - * audio description URL is not also supplied. - */ + // Set $id to be an empty string to prevent an unset variable warning if an + // audio description URL is not also supplied. $id = ''; if (is_null($url)) { return $id; @@ -175,11 +173,8 @@ class AbleplayerRemoteVideoFormatter extends FormatterBase { $parts = UrlHelper::parse($url); $id = $parts['query']['v']; } - /** - * Currently YouTube returns a 404 for this pattern so this code is - * never called. - */ - + // Currently YouTube returns a 404 for this pattern so this code is + // never called. $scheme = 'https://*.youtube.com/v/*'; $regexp = str_replace(['.', '*'], ['\.', '.*'], $scheme); if (preg_match("|^$regexp$|", $url)) { @@ -199,10 +194,8 @@ class AbleplayerRemoteVideoFormatter extends FormatterBase { if ($provider->getName() === 'Vimeo') { - /** - * The /channels and /ondemand do not return playable video for - * Ableplayer. - */ + // The /channels and /ondemand do not return playable video for + // Ableplayer. $schemes = [ "https://vimeo.com/*", "https://vimeo.com/album/*/video/*", @@ -216,11 +209,9 @@ class AbleplayerRemoteVideoFormatter extends FormatterBase { if (preg_match("|^$regexp$|", $url)) { $parts = parse_url($url, PHP_URL_PATH); $path = explode('/', $parts); - /** - * If the Vimeo URL has more than two parts, Able Player wants the - * full URL, not just the ID. We check the length of the URL path - * and if it has more than two parts, assemble the Vimeo URL. - */ + // If the Vimeo URL has more than two parts, Able Player wants the + // full URL, not just the ID. We check the length of the URL path + // and if it has more than two parts, assemble the Vimeo URL. if (count($path) > 2) { $url_part_one = array_pop($path); $url_part_two = array_pop($path); diff --git a/src/Plugin/Field/FieldFormatter/AbleplayerSignLanguageFormatter.php b/src/Plugin/Field/FieldFormatter/AbleplayerSignLanguageFormatter.php index b8b7aacc83820e4cfd202499a9f81f61d36f4444..625d92d32d628f7589ef9140e2e314b170010cb2 100644 --- a/src/Plugin/Field/FieldFormatter/AbleplayerSignLanguageFormatter.php +++ b/src/Plugin/Field/FieldFormatter/AbleplayerSignLanguageFormatter.php @@ -12,15 +12,15 @@ use Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase; * Plugin implementation of the 'ableplayer_video' formatter. */ #[FieldFormatter( - id: 'ableplayer_sign_language', - label: new TranslatableMarkup('Ableplayer Sign Language'), - description: new TranslatableMarkup('Display media sign language video'), - field_types: [ - 'file', - ] + id: 'ableplayer_sign_language', + label: new TranslatableMarkup('Ableplayer Sign Language'), + description: new TranslatableMarkup('Display media sign language video'), + field_types: [ + 'file', + ] )] /** - * + * Functions to retrieve file needed to display sign language video. */ class AbleplayerSignLanguageFormatter extends FileFormatterBase { diff --git a/src/Plugin/Field/FieldFormatter/AbleplayerVideoFormatter.php b/src/Plugin/Field/FieldFormatter/AbleplayerVideoFormatter.php index 4985710122ecc9135745fd1a09e527d9634e3001..2ede741899c2bef693292eec5255d0b65002b09a 100644 --- a/src/Plugin/Field/FieldFormatter/AbleplayerVideoFormatter.php +++ b/src/Plugin/Field/FieldFormatter/AbleplayerVideoFormatter.php @@ -12,15 +12,15 @@ use Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase; * Plugin implementation of the 'ableplayer_video' formatter. */ #[FieldFormatter( - id: 'ableplayer_video', - label: new TranslatableMarkup('Ableplayer Video'), - description: new TranslatableMarkup('Display the file using Ableplayer.'), - field_types: [ - 'file', - ] + id: 'ableplayer_video', + label: new TranslatableMarkup('Ableplayer Video'), + description: new TranslatableMarkup('Display the file using Ableplayer.'), + field_types: [ + 'file', + ] )] /** - * + * Configures the output needed for the Ableplayer HTML container. */ class AbleplayerVideoFormatter extends FileMediaFormatterBase { @@ -51,8 +51,13 @@ class AbleplayerVideoFormatter extends FileMediaFormatterBase { if ($parent->hasField('field_ableplayer_media_caption')) { foreach ($elements as &$element) { - $element['#caption'] = $parent->field_ableplayer_media_caption->view(['type' => 'entity_reference_entity_view', 'settings' => ['view_mode' => 'able_player_caption_view_mode']]); - // $element['#caption'] = $parent->field_ableplayer_media_caption->view(['type' => 'entity_reference_label']); + $element['#caption'] = $parent->field_ableplayer_media_caption->view( + [ + 'type' => 'entity_reference_entity_view', + 'settings' => ['view_mode' => 'able_player_caption_view_mode'], + ]); + // $element['#caption'] = $parent->field_ableplayer_media_caption->view( + // ['type' => 'entity_reference_label']); } } diff --git a/tests/src/Functional/AblePlayerCoreTest.php b/tests/src/Functional/AblePlayerCoreTest.php index c5f5ccc03e9b16f9a55de8840e2cd961ce63c3bb..6851b98afcbd17c63dc90437b88bb0c69d90d6b2 100644 --- a/tests/src/Functional/AblePlayerCoreTest.php +++ b/tests/src/Functional/AblePlayerCoreTest.php @@ -67,7 +67,12 @@ class AblePlayerCoreTest extends BrowserTestBase { $type = 'module'; $theme = 'ableplayer'; $path = \Drupal::service('extension.path.resolver')->getPath('module', 'ableplayer'); - $themes = \Drupal::moduleHandler()->invoke('ableplayer', 'theme', [$existing, $type, $theme, $path]); + $themes = \Drupal::moduleHandler()->invoke('ableplayer', 'theme', [ + $existing, + $type, + $theme, + $path, + ]); $keys = [ 'ableplayer_video', 'media__able_player_caption_view_mode', diff --git a/tests/src/Functional/AblePlayerInstallTest.php b/tests/src/Functional/AblePlayerInstallTest.php index 6cf9ff4866cfef0086e6028253273ee28aa464b9..0f4145a512dc7ca5d6ac0f70ff4ba20dbbea7d47 100644 --- a/tests/src/Functional/AblePlayerInstallTest.php +++ b/tests/src/Functional/AblePlayerInstallTest.php @@ -15,7 +15,7 @@ use Drupal\Tests\media\Traits\MediaTypeCreationTrait; * * @group ableplayer */ -class AblePlayerCoreTest extends BrowserTestBase { +class AblePlayerInstallTest extends BrowserTestBase { use MediaTypeCreationTrait { createMediaType as drupalCreateMediaType; } @@ -76,7 +76,7 @@ class AblePlayerCoreTest extends BrowserTestBase { } /** - * + * Reload services. */ protected function reloadServices() { $this->rebuildContainer(); diff --git a/tests/src/Functional/AblePlayerOutputTestInprogress.php b/tests/src/Functional/AblePlayerOutputTestInprogress.php index 3ce1c111646ee8d78b33db0fe4e0e79a27cd563a..081f1f079c36965c703d9ad66e1e9a02af74bcb0 100644 --- a/tests/src/Functional/AblePlayerOutputTestInprogress.php +++ b/tests/src/Functional/AblePlayerOutputTestInprogress.php @@ -10,12 +10,13 @@ use Drupal\Tests\BrowserTestBase; */ /** - * Test case for Able Player formatter output. Verify that the HTML output of - * the Able Player is correct with given settings. + * Test case for Able Player formatter output. + * + * Verify the HTML output of Able Player is correct with given settings. * * @group ableplayer */ -class AblePlayerOutputTest extends BrowserTestBase { +class AblePlayerOutputTestInprogress extends BrowserTestBase { /** * {@inheritdoc} diff --git a/tests/src/Functional/AblePlayerValidationTest.php b/tests/src/Functional/AblePlayerValidationTest.php index dfb48321e25207aa83fcb2760520c6551c67f09d..d865970295f8830a051ec1f688f8986782894612 100644 --- a/tests/src/Functional/AblePlayerValidationTest.php +++ b/tests/src/Functional/AblePlayerValidationTest.php @@ -8,8 +8,9 @@ namespace Drupal\Tests\ableplayer\Functional; */ /** - * Test case for Able Player settings validation. Ensure that the settings - * validation functions operate correctly. + * Test case for Able Player settings validation. + * + * Ensure that the settings validation functions operate correctly. * * @group ableplayer */ diff --git a/tests/src/Kernel/AblePlayerFieldTest.php b/tests/src/Kernel/AblePlayerFieldTest.php index 283d87e24a818feac3d66f1f9a377da2acee2cc5..53057a055f6bbdee916df466a64c636b5673095c 100644 --- a/tests/src/Kernel/AblePlayerFieldTest.php +++ b/tests/src/Kernel/AblePlayerFieldTest.php @@ -5,10 +5,13 @@ namespace Drupal\Tests\ableplayer\Kernel; use Drupal\Tests\field\Kernel\FieldKernelTestBase; /** - * + * Tests the Able Player field install and content. */ class AblePlayerFieldTest extends FieldKernelTestBase { + /** + * {@inheritdoc} + */ protected static $modules = [ 'field', 'path', @@ -18,7 +21,7 @@ class AblePlayerFieldTest extends FieldKernelTestBase { ]; /** - * + * {@inheritdoc} */ protected function setUp(): void { parent::setUp(); @@ -39,7 +42,7 @@ class AblePlayerFieldTest extends FieldKernelTestBase { } /** - * + * Test field creation. */ public function testFieldCreation() { \Drupal::service('module_installer')->install(['ableplayer']); diff --git a/tests/src/Kernel/Installer/InstallKernelTest.php b/tests/src/Kernel/Installer/InstallKernelTest.php index 13396dc8d87eb973ee8c79c1b5b8c0544041091c..f1689c533d3c8550aec46ae6fe7bcf10eeeaabc9 100644 --- a/tests/src/Kernel/Installer/InstallKernelTest.php +++ b/tests/src/Kernel/Installer/InstallKernelTest.php @@ -9,7 +9,7 @@ use Drupal\KernelTests\KernelTestBase; * * @group Module */ -class InstalllKernelTest extends KernelTestBase { +class InstallKernelTest extends KernelTestBase { /** * Modules to enable. diff --git a/translations/ca.js b/translations/ca.js index da93be41ceee34eef96d6742440fd203f118f0e6..3d6b01e3d168797563bf754f12b134aeb8cbf6a6 100644 --- a/translations/ca.js +++ b/translations/ca.js @@ -352,4 +352,4 @@ "enableKeyboardShortcuts": "Enable keyboard shortcuts" -} \ No newline at end of file +} diff --git a/translations/cs.js b/translations/cs.js index 4f60d0bf14913a8e4a50eb2651362cc75ea8c26f..1f4caf5d533abe293cbee4dd1b244c2590945f81 100644 --- a/translations/cs.js +++ b/translations/cs.js @@ -352,4 +352,4 @@ "enableKeyboardShortcuts": "Povolit klávesové zkratky" -} \ No newline at end of file +} diff --git a/translations/fr.js b/translations/fr.js index d5d2c1042fa2fd8d4e35afaead469ce00f56cd6f..c367c70e304185abadf1e82611fc941fc17ada1a 100644 --- a/translations/fr.js +++ b/translations/fr.js @@ -352,4 +352,4 @@ "enableKeyboardShortcuts": "Permettre les raccourcis clavier" -} \ No newline at end of file +} diff --git a/translations/he.js b/translations/he.js index f73c8865d748296914e064e68b77f7fbc4edce15..0100ee5a83300e41422ff5bd3900d30295472b7d 100644 --- a/translations/he.js +++ b/translations/he.js @@ -352,4 +352,4 @@ "enableKeyboardShortcuts": "Enable keyboard shortcuts" -} \ No newline at end of file +} diff --git a/translations/it.js b/translations/it.js index 663f6a5e7658629a3c5fc0f66eb4b73a32e18f50..5ebf4f41832d1e3f2cdbd6052a7e5702ec68fe7c 100644 --- a/translations/it.js +++ b/translations/it.js @@ -350,4 +350,4 @@ "enableKeyboardShortcuts": "Enable keyboard shortcuts" -} \ No newline at end of file +} diff --git a/translations/ja.js b/translations/ja.js index ab56b9d5cedfb09fb2d488de91fb5e4376085312..a460f1bc7f87068fe8b553553a44c341a1efa9a6 100644 --- a/translations/ja.js +++ b/translations/ja.js @@ -353,4 +353,4 @@ "enableKeyboardShortcuts": "ã‚ーボード・ショートカットを有効ã«ã™ã‚‹" -} \ No newline at end of file +} diff --git a/translations/nl.js b/translations/nl.js index bd2c755f37725476fa9a54c5323309db3c368c45..3ab85cfa819e26a2f6833550e5c514166c0baaf1 100644 --- a/translations/nl.js +++ b/translations/nl.js @@ -352,4 +352,4 @@ "enableKeyboardShortcuts": "Enable keyboard shortcuts" -} \ No newline at end of file +} diff --git a/translations/tr.js b/translations/tr.js index 2cc563659ff216eec596420a5ff0091ebccf3987..0e9c83362fdef4a5c0c06b223baef987c7031859 100644 --- a/translations/tr.js +++ b/translations/tr.js @@ -352,4 +352,4 @@ "enableKeyboardShortcuts": "Enable keyboard shortcuts" -} \ No newline at end of file +}