diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 1f8af04..0000000 --- a/.php_cs +++ /dev/null @@ -1,44 +0,0 @@ -exclude('Resources') - ->exclude('Fixtures') - ->in([__DIR__.'/src']) -; - -return PhpCsFixer\Config::create() - ->setRules([ - '@Symfony' => true, - '@Symfony:risky' => true, - 'psr0' => false, - 'strict_comparison' => false, - 'strict_param' => false, - 'array_syntax' => ['syntax' => 'short'], - 'heredoc_to_nowdoc' => true, - 'header_comment' => ['header' => $header], - 'ordered_imports' => true, - 'ordered_class_elements' => true, - 'php_unit_strict' => false, - 'phpdoc_order' => true, - 'no_useless_return' => true, - 'no_useless_else' => true, - 'no_unreachable_default_argument_value' => true, - 'combine_consecutive_unsets' => true, - 'general_phpdoc_annotation_remove' => [ - 'expectedException', - 'expectedExceptionMessage', - ], - 'blank_line_before_statement' => ['statements' => ['break', 'case', 'continue', 'declare', 'default', 'die', 'do', 'exit', 'for', 'foreach', 'goto', 'if', 'include', 'include_once', 'require', 'require_once', 'return', 'switch', 'throw', 'try', 'while', 'yield']] - ]) - ->setFinder($finder) - ->setRiskyAllowed(true) - ->setUsingCache(false) -; diff --git a/CHANGELOG.md b/CHANGELOG.md index b8ebb28..f2fba15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,27 @@ All notable changes to this project will be documented in this file. +## [2.0.0-DEV] - 2025-01-07 +- Changed: allow contao 5 +- Changed: migrated fullsize and privacy templates to new contao template system (NEED MANUAL ADJUSTMENT!) +- Changed: use new contao image handling +- Changed: dropped list bundle support (for the moment as not available for contao 5) +- Changed: modernized bundle structure +- Changed: dropped twig support bundle integration +- Changed: allow utils bundle v3 +- Changed: dropped support for php lower than 8.1 +- Removed: support for deprecated config key videoProvider +- Removed: support for deprecated config option names +- Removed: support for deprecated privacy mode attribute +- Removed: support for deprecated huh.video.event.alertify.onshow and huh.video.event.alertify.onfocus events +- Removed: deprecated VideoFieldContainer class + +### Upgrade steps +- If you have custom fullsize or privacy templates, move and rename them according to the new contao template system + e.g. `templates/videofullsize_default.html.twig` -> `contao/templates/[.twig-root]/huh_video/fullsize.html.twig` + `templates/videofullsize_custom.html.twig` -> `contao/templates/[.twig-root]/huh_video/fullsize/custom.html.twig` +- If you worked with preview images in your templates, adjust them as `previewImage` is now a `Figure` object + ## [1.8.0] - 2025-02-27 - Changed: refactored media query options callback listener - Fixed: exception with non public service diff --git a/UPGRADE.md b/UPGRADE.md deleted file mode 100644 index 51ac892..0000000 --- a/UPGRADE.md +++ /dev/null @@ -1,29 +0,0 @@ -# Upgrade introductions - -This document contains informations about migrating from older versions or predecessor of this bundle. - -## From 0.8.x - -Renamed configuration options to meet coding standards. - -Old | New ---- | --- -enableNewsSupport | enable_news_support -defaultEnableNoCookieVideoUrl | default_use_no_cookie_video_url -defaultEnablePrivacyNotice | default_display_privacy_notice -videoProvider | video_provider - -## From contao-youtube-bundle - -tl_page: - -Old | New ---- | --- -youtubePrivacy | enableNoCookieVideoUrl -ytShowRelated | videoShowRelated - -tl_content: - -Old | New ---- | --- -youtubeFullSize | videoFullSize \ No newline at end of file diff --git a/src/Resources/assets/img/play.svg b/assets/img/play.svg similarity index 100% rename from src/Resources/assets/img/play.svg rename to assets/img/play.svg diff --git a/src/Resources/assets/img/youtube_play.svg b/assets/img/youtube_play.svg similarity index 100% rename from src/Resources/assets/img/youtube_play.svg rename to assets/img/youtube_play.svg diff --git a/src/Resources/assets/img/youtube_play_color.svg b/assets/img/youtube_play_color.svg similarity index 100% rename from src/Resources/assets/img/youtube_play_color.svg rename to assets/img/youtube_play_color.svg diff --git a/src/Resources/assets/js/contao-video-bundle-be.js b/assets/js/contao-video-bundle-be.js similarity index 100% rename from src/Resources/assets/js/contao-video-bundle-be.js rename to assets/js/contao-video-bundle-be.js diff --git a/src/Resources/assets/js/contao-video-bundle-theme.js b/assets/js/contao-video-bundle-theme.js similarity index 100% rename from src/Resources/assets/js/contao-video-bundle-theme.js rename to assets/js/contao-video-bundle-theme.js diff --git a/src/Resources/assets/js/contao-video-bundle.js b/assets/js/contao-video-bundle.js similarity index 100% rename from src/Resources/assets/js/contao-video-bundle.js rename to assets/js/contao-video-bundle.js diff --git a/src/Resources/assets/js/video.js b/assets/js/video.js similarity index 86% rename from src/Resources/assets/js/video.js rename to assets/js/video.js index c86d14f..aa1e0b1 100644 --- a/src/Resources/assets/js/video.js +++ b/assets/js/video.js @@ -34,7 +34,6 @@ export default class Video { this.previewImageElement = this.wrapperElement.querySelector('.video-wrapper .video-thumbnail'); this.videoContainerElement = this.wrapperElement.querySelector('.video-wrapper .video-container'); - this.legacyPrivacyCheck(); this.applyPrivacySettingsToVideo(); if ('toggleVideo' in this.configuration) { @@ -71,15 +70,6 @@ export default class Video { } applyPrivacySettingsToLink() { - // legacy support - // @todo Deprecated, remove in next major version - if (!this.privacyMode) { - if ('privacy' in this.configuration) { - this.privacyMode = true; - console.warn("You're using an outdated video fullsize template. Please adjust your template according to the docs. Since version 1.2.0"); - } - } - this.wrapperElement.addEventListener('click', (event) => { event.preventDefault(); if (this.privacyMode) { @@ -103,14 +93,6 @@ export default class Video { elements: dialog.elements } })); - // @todo deprecated, remove in next major version - document.dispatchEvent(new CustomEvent('huh.video.event.alertify.onshow', { - bubbles: true, - cancelable: true, - detail: { - elements: dialog.elements - } - })); }, defaultFocusOff: true, onfocus: function() { @@ -121,14 +103,6 @@ export default class Video { elements: dialog.elements } })); - // @todo deprecated, remove in next major version - document.dispatchEvent(new CustomEvent('huh.video.event.alertify.onfocus', { - bubbles: true, - cancelable: true, - detail: { - elements: dialog.elements - } - })); } }); @@ -318,18 +292,4 @@ export default class Video { toggleVideo(1); } } - - /** - * @todo Remove in next major version - */ - legacyPrivacyCheck() { - if (!this.privacyMode && this.previewImageElement) { - if ('privacy' in this.previewImageElement.dataset) { - this.privacyMode = true; - console.warn("You're using an outdated video templates. Please adjust your template according to the docs. Since version 1.2.0"); - } - } - } - - -} \ No newline at end of file +} diff --git a/src/Resources/assets/scss/contao-video-bundle-be.scss b/assets/scss/contao-video-bundle-be.scss similarity index 100% rename from src/Resources/assets/scss/contao-video-bundle-be.scss rename to assets/scss/contao-video-bundle-be.scss diff --git a/src/Resources/assets/scss/contao-video-bundle.scss b/assets/scss/contao-video-bundle.scss similarity index 100% rename from src/Resources/assets/scss/contao-video-bundle.scss rename to assets/scss/contao-video-bundle.scss diff --git a/composer.json b/composer.json index 949226d..7ecb1a7 100644 --- a/composer.json +++ b/composer.json @@ -11,31 +11,31 @@ ], "license": "LGPL-3.0-or-later", "require": { - "php": "^7.4 || ^8.0", - "contao/core-bundle": "^4.9", - "heimrichhannot/contao-config-element-type-bundle": "^0.2", + "php": "^8.1", + "contao/core-bundle": "^5.3", "heimrichhannot/contao-encore-contracts": "^1.0", "heimrichhannot/contao-multi-column-editor-bundle": "^2.13", - "heimrichhannot/contao-twig-support-bundle": "^1.5", - "heimrichhannot/contao-utils-bundle": "^2.224", + "heimrichhannot/contao-utils-bundle": "^3.0", "symfony/deprecation-contracts": "^2.0 || ^3.0", - "symfony/http-kernel": "^4.4 || ^5.4", + "symfony/http-kernel": "^6.4 || ^7.0", "symfony/service-contracts": "^1.0 || ^2.0 || ^3.0", "symfony/translation-contracts": "^1.0 || ^2.0 || ^3.0" }, - "conflict": { - "heimrichhannot/contao-privacy-center-bundle": "<2.8" - }, "autoload": { "psr-4": { "HeimrichHannot\\VideoBundle\\": "src/" } }, "extra": { - "contao-manager-plugin": "HeimrichHannot\\VideoBundle\\ContaoManager\\Plugin", - "foxy": true + "contao-manager-plugin": "HeimrichHannot\\VideoBundle\\ContaoManager\\Plugin" }, - "suggest": { - "heimrichhannot/contao-encore-bundle": "Manage dependencies with Symfony Webpack Encore." + "require-dev": { + "contao/manager-plugin": "^2.13", + "contao/core-bundle": "^4.13", + "rector/rector": "^2.2", + "contao/contao-rector": "dev-main", + "symplify/easy-coding-standard": "^12.6", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-symfony": "^2.0" } } diff --git a/config/routing.yaml b/config/routing.yaml new file mode 100644 index 0000000..ff46719 --- /dev/null +++ b/config/routing.yaml @@ -0,0 +1,3 @@ +huh_video: + resource: "../src/Controller/" + type: annotation \ No newline at end of file diff --git a/src/Resources/config/services.yml b/config/services.yaml similarity index 61% rename from src/Resources/config/services.yml rename to config/services.yaml index 8d92ff9..7dcaa0f 100644 --- a/src/Resources/config/services.yml +++ b/config/services.yaml @@ -3,9 +3,11 @@ services: autowire: true bind: $bundleConfig: '%huh_video%' + Contao\CoreBundle\Twig\Finder\FinderFactory: '@contao.twig.finder_factory' + HeimrichHannot\VideoBundle\: - resource: '../../{Asset,Command,Controller,DataContainer,EventListener}/*' + resource: '../src/{Asset,Controller,DataContainer,EventListener}/*' autoconfigure: true HeimrichHannot\VideoBundle\Asset\FrontendAsset: @@ -20,8 +22,9 @@ services: public: true HeimrichHannot\VideoBundle\EventListener\Dca\: - resource: ../../EventListener/Dca/* + resource: ../src/EventListener/Dca/* public: true - HeimrichHannot\VideoBundle\ConfigElementType\VideoConfigElementType: - tags: ['huh.list.config_element_type', 'huh.reader.config_element_type'] \ No newline at end of file + HeimrichHannot\VideoBundle\EventListener\PrivacyCenterListener: + public: true + autoconfigure: true \ No newline at end of file diff --git a/src/Resources/contao/dca/tl_content.php b/contao/dca/tl_content.php similarity index 100% rename from src/Resources/contao/dca/tl_content.php rename to contao/dca/tl_content.php diff --git a/src/Resources/contao/dca/tl_page.php b/contao/dca/tl_page.php similarity index 72% rename from src/Resources/contao/dca/tl_page.php rename to contao/dca/tl_page.php index 9685530..83ed9ef 100644 --- a/src/Resources/contao/dca/tl_page.php +++ b/contao/dca/tl_page.php @@ -7,9 +7,6 @@ */ use Contao\CoreBundle\DataContainer\PaletteManipulator; -use Contao\DataContainer; -use Contao\System; -use HeimrichHannot\TwigSupportBundle\Filesystem\TwigTemplateLocator; $arrDca = &$GLOBALS['TL_DCA']['tl_page']; @@ -43,7 +40,10 @@ 'label' => &$GLOBALS['TL_LANG']['tl_page']['overrideNoCookieVideoUrlSettings'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50', 'submitOnChange' => true], + 'eval' => [ + 'tl_class' => 'w50', + 'submitOnChange' => true, + ], 'sql' => "char(1) NOT NULL default ''", ], 'enableNoCookieVideoUrl' => [ @@ -51,14 +51,19 @@ 'exclude' => true, 'default' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'clr'], + 'eval' => [ + 'tl_class' => 'clr', + ], 'sql' => "char(1) NOT NULL default ''", ], 'overrideEnablePrivacyNotice' => [ 'label' => &$GLOBALS['TL_LANG']['tl_page']['overrideEnablePrivacyNotice'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50', 'submitOnChange' => true], + 'eval' => [ + 'tl_class' => 'w50', + 'submitOnChange' => true, + ], 'sql' => "char(1) NOT NULL default ''", ], 'enablePrivacyNotice' => [ @@ -66,29 +71,27 @@ 'exclude' => true, 'default' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'clr'], + 'eval' => [ + 'tl_class' => 'clr', + ], 'sql' => "char(1) NOT NULL default ''", ], 'videofullsizeTemplate' => [ - 'label' => &$GLOBALS['TL_LANG']['tl_page']['videofullsizeTemplate'], 'default' => 'videofullsize_default', 'exclude' => true, 'inputType' => 'select', - 'options_callback' => function (DataContainer $dc) { - return System::getContainer()->get(TwigTemplateLocator::class)->getTemplateGroup('videofullsize_'); - }, - 'eval' => ['tl_class' => 'w50 clr'], + 'eval' => [ + 'tl_class' => 'w50 clr', + ], 'sql' => "varchar(64) NOT NULL default ''", ], 'videoprivacyTemplate' => [ - 'label' => &$GLOBALS['TL_LANG']['tl_page']['videoprivacyTemplate'], 'exclude' => true, 'inputType' => 'select', 'default' => 'videoprivacy_default.twig', - 'options_callback' => function (DataContainer $dc) { - return System::getContainer()->get(TwigTemplateLocator::class)->getTemplateGroup('videoprivacy_'); - }, - 'eval' => ['tl_class' => 'w50', 'mandatory' => true], + 'eval' => [ + 'tl_class' => 'w50', + ], 'sql' => "varchar(64) NOT NULL default ''", ], ]; diff --git a/src/Resources/contao/languages/de/default.php b/contao/languages/de/default.php similarity index 93% rename from src/Resources/contao/languages/de/default.php rename to contao/languages/de/default.php index 711f4f2..4e318da 100644 --- a/src/Resources/contao/languages/de/default.php +++ b/contao/languages/de/default.php @@ -1,6 +1,7 @@ * @license http://www.gnu.org/licences/lgpl-3.0.html LGPL */ - $lang = &$GLOBALS['TL_LANG']['tl_list_config_element']; -$lang['reference'][\HeimrichHannot\VideoBundle\ConfigElementType\VideoConfigElementType::getType()] = 'Video (Erweiterter Videoplayer)'; $lang['imageSelectorField']['videoSelector'] = 'Wählen Sie hier das Feld aus, das den boolschen Selektor für das Video enthält.'; -$lang['video_legend'] = 'Video-Einstellungen'; \ No newline at end of file +$lang['video_legend'] = 'Video-Einstellungen'; diff --git a/src/Resources/contao/languages/de/tl_news.php b/contao/languages/de/tl_news.php similarity index 75% rename from src/Resources/contao/languages/de/tl_news.php rename to contao/languages/de/tl_news.php index cbea461..50c0af2 100644 --- a/src/Resources/contao/languages/de/tl_news.php +++ b/contao/languages/de/tl_news.php @@ -1,6 +1,7 @@ * @license http://www.gnu.org/licences/lgpl-3.0.html LGPL */ -/** +/* * Fields */ $GLOBALS['TL_LANG']['tl_page']['overrideNoCookieVideoUrlSettings'][0] = '"Keine-Cookies-URL"-Einstellung überschreiben'; @@ -42,7 +42,7 @@ $GLOBALS['TL_LANG']['tl_page']['localStorageAttribute'][0] = 'LocalStorage Attribut'; $GLOBALS['TL_LANG']['tl_page']['localStorageAttribute'][1] = 'Wählen Sie hier den LocalStorage Attribut aus'; -/** +/* * Legends */ $GLOBALS['TL_LANG']['tl_page']['video_legend'] = 'Video-Einstellungen'; diff --git a/src/Resources/contao/languages/en/tl_reader_config_element.php b/contao/languages/de/tl_reader_config_element.php similarity index 54% rename from src/Resources/contao/languages/en/tl_reader_config_element.php rename to contao/languages/de/tl_reader_config_element.php index b9d61f2..7b3496c 100644 --- a/src/Resources/contao/languages/en/tl_reader_config_element.php +++ b/contao/languages/de/tl_reader_config_element.php @@ -1,14 +1,13 @@ * @license http://www.gnu.org/licences/lgpl-3.0.html LGPL */ - $lang = &$GLOBALS['TL_LANG']['tl_reader_config_element']; -$lang['reference'][\HeimrichHannot\VideoBundle\ConfigElementType\VideoConfigElementType::getType()] = 'Video (Advanced video player)'; -$lang['video_legend'] = 'Video settings'; \ No newline at end of file +$lang['video_legend'] = 'Video-Einstellungen'; diff --git a/src/Resources/contao/languages/en/default.php b/contao/languages/en/default.php similarity index 93% rename from src/Resources/contao/languages/en/default.php rename to contao/languages/en/default.php index 4b930b4..213da95 100644 --- a/src/Resources/contao/languages/en/default.php +++ b/contao/languages/en/default.php @@ -1,6 +1,7 @@ 'YouTube', 'vimeo' => 'Vimeo', 'file' => 'File', -]; \ No newline at end of file +]; diff --git a/src/Resources/contao/languages/en/tl_list_config_element.php b/contao/languages/en/tl_list_config_element.php similarity index 54% rename from src/Resources/contao/languages/en/tl_list_config_element.php rename to contao/languages/en/tl_list_config_element.php index 1e7c882..65c31c8 100644 --- a/src/Resources/contao/languages/en/tl_list_config_element.php +++ b/contao/languages/en/tl_list_config_element.php @@ -1,15 +1,13 @@ * @license http://www.gnu.org/licences/lgpl-3.0.html LGPL */ - $lang = &$GLOBALS['TL_LANG']['tl_list_config_element']; -$lang['reference'][\HeimrichHannot\VideoBundle\ConfigElementType\VideoConfigElementType::getType()] = 'Video (Advanced video player)'; - -$lang['video_legend'] = 'Video settings'; \ No newline at end of file +$lang['video_legend'] = 'Video settings'; diff --git a/src/Resources/contao/languages/en/tl_page.php b/contao/languages/en/tl_page.php similarity index 96% rename from src/Resources/contao/languages/en/tl_page.php rename to contao/languages/en/tl_page.php index cf14677..b4d3e34 100644 --- a/src/Resources/contao/languages/en/tl_page.php +++ b/contao/languages/en/tl_page.php @@ -1,15 +1,15 @@ * @license http://www.gnu.org/licences/lgpl-3.0.html LGPL */ -/** +/* * Fields */ $GLOBALS['TL_LANG']['tl_page']['overrideNoCookieVideoUrlSettings'][0] = 'Overwrite "no cookie url" setting'; @@ -30,8 +30,7 @@ $GLOBALS['TL_LANG']['tl_page']['videoprivacyTemplate'][0] = 'Privacy notice template'; $GLOBALS['TL_LANG']['tl_page']['videoprivacyTemplate'][1] = 'Choose privacy notice template.'; - -/** +/* * Legends */ -$GLOBALS['TL_LANG']['tl_page']['video_legend'] = 'Video setting'; \ No newline at end of file +$GLOBALS['TL_LANG']['tl_page']['video_legend'] = 'Video setting'; diff --git a/src/Resources/contao/languages/de/tl_reader_config_element.php b/contao/languages/en/tl_reader_config_element.php similarity index 53% rename from src/Resources/contao/languages/de/tl_reader_config_element.php rename to contao/languages/en/tl_reader_config_element.php index 7c740fe..7d2532d 100644 --- a/src/Resources/contao/languages/de/tl_reader_config_element.php +++ b/contao/languages/en/tl_reader_config_element.php @@ -1,14 +1,13 @@ * @license http://www.gnu.org/licences/lgpl-3.0.html LGPL */ - $lang = &$GLOBALS['TL_LANG']['tl_reader_config_element']; -$lang['reference'][\HeimrichHannot\VideoBundle\ConfigElementType\VideoConfigElementType::getType()] = 'Video (Erweiterter Videoplayer)'; -$lang['video_legend'] = 'Video-Einstellungen'; \ No newline at end of file +$lang['video_legend'] = 'Video settings'; diff --git a/src/Resources/contao/templates/ce_video.html5 b/contao/templates/ce_video.html5 similarity index 100% rename from src/Resources/contao/templates/ce_video.html5 rename to contao/templates/ce_video.html5 diff --git a/contao/templates/twig/.twig-root b/contao/templates/twig/.twig-root new file mode 100644 index 0000000..e69de29 diff --git a/src/Resources/views/fullsize/videofullsize_default.html.twig b/contao/templates/twig/huh_video/fullsize.html.twig similarity index 85% rename from src/Resources/views/fullsize/videofullsize_default.html.twig rename to contao/templates/twig/huh_video/fullsize.html.twig index 03cd521..91de5d5 100644 --- a/src/Resources/views/fullsize/videofullsize_default.html.twig +++ b/contao/templates/twig/huh_video/fullsize.html.twig @@ -5,4 +5,4 @@ }); }); -{{ videoLinkText|trans }} \ No newline at end of file +{{ videoLinkText|trans }} \ No newline at end of file diff --git a/src/Resources/views/fullsize/videofullsize_colorbox.html.twig b/contao/templates/twig/huh_video/fullsize/colorbox.html.twig similarity index 100% rename from src/Resources/views/fullsize/videofullsize_colorbox.html.twig rename to contao/templates/twig/huh_video/fullsize/colorbox.html.twig diff --git a/src/Resources/views/privacy/videoprivacy_default.html.twig b/contao/templates/twig/huh_video/privacy.html.twig similarity index 100% rename from src/Resources/views/privacy/videoprivacy_default.html.twig rename to contao/templates/twig/huh_video/privacy.html.twig diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..e273326 --- /dev/null +++ b/ecs.php @@ -0,0 +1,38 @@ +withPaths([ + __DIR__ . '/src', + __DIR__ . '/contao', + + ]) + + // add a single rule + ->withRules([ + NoUnusedImportsFixer::class, + BracesPositionFixer::class, + ]) + + // add sets - group of rules + ->withPreparedSets( + arrays: true, + comments: true, + docblocks: true, + spaces: true, + namespaces: true, + ) + ->withPhpCsFixerSets(symfony: true) + ->withSkip([ + NotOperatorWithSuccessorSpaceFixer::class, + MethodChainingIndentationFixer::class => [ + '*/DependencyInjection/Configuration.php', + ], + ]); \ No newline at end of file diff --git a/package.json b/package.json index 21749c5..d11ad15 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,29 @@ { - "name": "contao-video-bundle", - "version": "1.0.0", - "main": "index.js", - "repository": "git@bitbucket.org:heimrichhannot/contao-video-bundle.git", - "author": "Thomas Körner ", - "dependencies": { - "@hundh/contao-utils-bundle": "^1.6", - "alertifyjs": "^1.11" - }, - "devDependencies": { - "@symfony/webpack-encore": "^0.30", - "autoprefixer": "^9.1.5", - "node-sass": "^4.12.0", - "postcss-loader": "^3.0.0", - "sass-loader": "^8.0" - }, - "scripts": { - "build-dev": "yarn encore dev", - "build-production": "yarn encore production" - }, - "postcss": { - "plugins": { - "autoprefixer": {} - } - }, - "browserslist": [ - "last 2 versions", - "ios >= 12", - "ie >= 10" - ] + "name": "contao-video-bundle", + "version": "2.0.0", + "main": "index.js", + "repository": "https://github.com/heimrichhannot/contao-video-bundle", + "author": "Thomas Körner ", + "dependencies": { + "alertifyjs": "^1.11" + }, + "devDependencies": { + "@babel/core": "^7.28", + "@babel/preset-env": "^7.28.3", + "@symfony/webpack-encore": "^4.0", + "postcss-loader": "^8.1.0", + "sass": "^1.69.5", + "sass-loader": "^14.0", + "webpack": "^5.88.2", + "webpack-cli": "^4.9.1" + }, + "scripts": { + "build-dev": "yarn encore dev", + "build-production": "yarn encore production" + }, + "browserslist": [ + "last 2 versions", + "ios >= 12", + "ie >= 10" + ] } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..882d883 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,12 @@ +parameters: + level: 0 + paths: + - src + - contao + scanDirectories: + - ../contao-privacy-center-bundle +# universalObjectCratesClasses: +# - Contao\Model +# - Contao\Template +includes: + - vendor/phpstan/phpstan-symfony/extension.neon \ No newline at end of file diff --git a/public/assets/alertify.css b/public/assets/alertify.css new file mode 100644 index 0000000..a619a5b --- /dev/null +++ b/public/assets/alertify.css @@ -0,0 +1 @@ +.alertify .ajs-dimmer{background-color:#252525;margin:0;opacity:.5}.alertify .ajs-dimmer,.alertify .ajs-modal{bottom:0;left:0;padding:0;position:fixed;right:0;top:0;z-index:1981}.alertify .ajs-modal{overflow-y:auto}.alertify .ajs-dialog{background-color:#fff;margin:5% auto;max-width:500px;min-height:110px;outline:0;padding:24px 24px 0;position:relative}.alertify .ajs-dialog.ajs-capture:before{bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0;z-index:1}.alertify .ajs-reset{display:inline!important;height:0!important;opacity:0!important;position:absolute!important;width:0!important}.alertify .ajs-commands{margin:-14px 24px 0 0;position:absolute;right:4px;z-index:2}.alertify .ajs-commands button{background-color:transparent;background-position:50%;background-repeat:no-repeat;border:0;cursor:pointer;display:none;height:10px;margin-left:10px;padding:10px;width:10px}.alertify .ajs-commands button.ajs-close{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAh0lEQVQYlY2QsQ0EIQwEB9cBAR1CJUaI/gigDnwR6NBL/7/xWLNrZ2b8EwGotVpr7eOitWa1VjugiNB7R1UPrKrWe0dEAHBbXUqxMQbeewDmnHjvyTm7C3zDwAUd9c63YQdUVdu6EAJzzquz7HXvTiklt+H9DQFYaxFjvDqllFyMkbXWvfpXHjJrWFgdBq/hAAAAAElFTkSuQmCC)}.alertify .ajs-commands button.ajs-maximize{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAOUlEQVQYlWP8//8/AzGAhYGBgaG4uBiv6t7eXkYmooxjYGAgWiELsvHYFMCcRX2rSXcjoSBiJDbAAeD+EGu+8BZcAAAAAElFTkSuQmCC)}.alertify .ajs-header{background-color:#fff;margin:-24px -24px 0;padding:16px 24px}.alertify .ajs-body{min-height:56px}.alertify .ajs-body .ajs-content{padding:16px 24px 16px 16px}.alertify .ajs-footer{background-color:#fff;margin-left:-24px;margin-right:-24px;min-height:43px;padding:4px}.alertify .ajs-footer .ajs-buttons.ajs-primary{text-align:right}.alertify .ajs-footer .ajs-buttons.ajs-primary .ajs-button{margin:4px}.alertify .ajs-footer .ajs-buttons.ajs-auxiliary{clear:none;float:left;text-align:left}.alertify .ajs-footer .ajs-buttons.ajs-auxiliary .ajs-button{margin:4px}.alertify .ajs-footer .ajs-buttons .ajs-button{min-height:35px;min-width:88px}.alertify .ajs-handle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMS8xNEDQYmMAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAQ0lEQVQYlaXNMQoAIAxD0dT7H657l0KX3iJuUlBUNOsPPCGJm7VDp6ryeMxMuDsAQH7owW3pyn3RS26iKxERMLN3ugOaAkaL3sWVigAAAABJRU5ErkJggg==);bottom:0;cursor:se-resize;display:none;height:10px;position:absolute;right:0;-webkit-transform:scaleX(1);transform:scaleX(1);width:10px;z-index:1}.alertify.ajs-no-overflow .ajs-body .ajs-content{overflow:hidden!important}.alertify.ajs-no-padding.ajs-maximized .ajs-body .ajs-content{left:0;padding:0;right:0}.alertify.ajs-no-padding:not(.ajs-maximized) .ajs-body{margin-left:-24px;margin-right:-24px}.alertify.ajs-no-padding:not(.ajs-maximized) .ajs-body .ajs-content{padding:0}.alertify.ajs-no-padding.ajs-resizable .ajs-body .ajs-content{left:0;right:0}.alertify.ajs-closable .ajs-commands button.ajs-close,.alertify.ajs-maximizable .ajs-commands button.ajs-maximize,.alertify.ajs-maximizable .ajs-commands button.ajs-restore{display:inline-block}.alertify.ajs-maximized .ajs-dialog{height:100%!important;left:0!important;margin:0 auto!important;max-width:none!important;top:0!important;width:100%!important}.alertify.ajs-maximized.ajs-modeless .ajs-modal{margin:0!important;max-height:none!important;min-height:100%!important;position:fixed!important}.alertify.ajs-maximized .ajs-commands button.ajs-maximize{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAASklEQVQYlZWQ0QkAMQhDtXRincOZX78KVtrDCwgqJNEoIB3MPLj7lRUROlpyVXGzby6zWuY+kz6tj5sBMTMAyVV3/595RbOh3cAXsww1raeiOcoAAAAASUVORK5CYII=)}.alertify.ajs-maximized .ajs-dialog,.alertify.ajs-resizable .ajs-dialog{padding:0}.alertify.ajs-maximized .ajs-commands,.alertify.ajs-resizable .ajs-commands{margin:14px 24px 0 0}.alertify.ajs-maximized .ajs-header,.alertify.ajs-resizable .ajs-header{left:0;margin:0;padding:16px 24px;position:absolute;right:0;top:0}.alertify.ajs-maximized .ajs-body,.alertify.ajs-resizable .ajs-body{display:inline-block;min-height:224px}.alertify.ajs-maximized .ajs-body .ajs-content,.alertify.ajs-resizable .ajs-body .ajs-content{bottom:50px;left:24px;overflow:auto;position:absolute;right:24px;top:50px}.alertify.ajs-maximized .ajs-footer,.alertify.ajs-resizable .ajs-footer{bottom:0;left:0;margin:0;position:absolute;right:0}.alertify.ajs-resizable:not(.ajs-maximized) .ajs-dialog{min-width:548px}.alertify.ajs-resizable:not(.ajs-maximized) .ajs-handle{display:block}.alertify.ajs-movable:not(.ajs-maximized) .ajs-header{cursor:move}.alertify.ajs-modeless .ajs-dimmer,.alertify.ajs-modeless .ajs-reset{display:none}.alertify.ajs-modeless .ajs-modal{max-height:0;max-width:none;overflow:visible}.alertify.ajs-modeless.ajs-pinnable .ajs-commands button.ajs-pin{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAQklEQVQYlcWPMQ4AIAwCqU9u38GbcbHRWN1MvKQDhQFMEpKImGJA0gCgnYw0V0rwxseg5erT4oSkQVI5d9f+e9+xA0NbLpWfitPXAAAAAElFTkSuQmCC);display:inline-block}.alertify.ajs-modeless.ajs-unpinned .ajs-modal{position:absolute}.alertify.ajs-modeless.ajs-unpinned .ajs-commands button.ajs-pin{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAO0lEQVQYlWP8//8/AzGAiShV6AqLi4txGs+CLoBLMYbC3t5eRmyaWfBZhwwYkX2NTxPRvibKjRhW4wMAhxkYGbLu3pEAAAAASUVORK5CYII=)}.alertify.ajs-modeless:not(.ajs-unpinned) .ajs-body{max-height:500px;overflow:auto}.alertify.ajs-basic .ajs-header{opacity:0}.alertify.ajs-basic .ajs-footer{visibility:hidden}.alertify.ajs-frameless .ajs-header{left:0;margin:0;min-height:60px;opacity:0;padding:0;position:absolute;right:0;top:0;z-index:1}.alertify.ajs-frameless .ajs-footer{display:none}.alertify.ajs-frameless .ajs-body .ajs-content{bottom:0;left:0;position:absolute;right:0;top:0}.alertify.ajs-frameless:not(.ajs-resizable) .ajs-dialog{padding-top:0}.alertify.ajs-frameless:not(.ajs-resizable) .ajs-dialog .ajs-commands{margin-top:0}.ajs-no-overflow{outline:none;overflow:hidden!important}.ajs-no-overflow.ajs-fixed{bottom:0;left:0;overflow-y:scroll!important;position:fixed;right:0;top:0}.ajs-no-selection,.ajs-no-selection *{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media screen and (max-width:568px){.alertify .ajs-dialog{min-width:150px}.alertify:not(.ajs-maximized) .ajs-modal{padding:0 5%}.alertify:not(.ajs-maximized).ajs-resizable .ajs-dialog{min-width:auto}}@-moz-document url-prefix(){.alertify button:focus{outline:1px dotted #3593d2}}.alertify .ajs-dimmer,.alertify .ajs-modal{-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-transition-duration:.25s;transition-duration:.25s;-webkit-transition-property:opacity,visibility;transition-property:opacity,visibility;-webkit-transition-timing-function:linear;transition-timing-function:linear}.alertify.ajs-hidden .ajs-dimmer,.alertify.ajs-hidden .ajs-modal{opacity:0;visibility:hidden}.alertify.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-duration:.5s;animation-duration:.5s}.alertify.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-duration:.25s;animation-duration:.25s}.alertify .ajs-dialog.ajs-shake{-webkit-animation-duration:.1s;animation-duration:.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:ajs-shake;animation-name:ajs-shake}@-webkit-keyframes ajs-shake{0%,to{-webkit-transform:translateZ(0);transform:translateZ(0)}10%,30%,50%,70%,90%{-webkit-transform:translate3d(-10px,0,0);transform:translate3d(-10px,0,0)}20%,40%,60%,80%{-webkit-transform:translate3d(10px,0,0);transform:translate3d(10px,0,0)}}@keyframes ajs-shake{0%,to{-webkit-transform:translateZ(0);transform:translateZ(0)}10%,30%,50%,70%,90%{-webkit-transform:translate3d(-10px,0,0);transform:translate3d(-10px,0,0)}20%,40%,60%,80%{-webkit-transform:translate3d(10px,0,0);transform:translate3d(10px,0,0)}}.alertify.ajs-slide.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-slideIn;animation-name:ajs-slideIn;-webkit-animation-timing-function:cubic-bezier(.175,.885,.32,1.275);animation-timing-function:cubic-bezier(.175,.885,.32,1.275)}.alertify.ajs-slide.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-slideOut;animation-name:ajs-slideOut;-webkit-animation-timing-function:cubic-bezier(.6,-.28,.735,.045);animation-timing-function:cubic-bezier(.6,-.28,.735,.045)}.alertify.ajs-zoom.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-zoomIn;animation-name:ajs-zoomIn}.alertify.ajs-zoom.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-zoomOut;animation-name:ajs-zoomOut}.alertify.ajs-fade.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-fadeIn;animation-name:ajs-fadeIn}.alertify.ajs-fade.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-fadeOut;animation-name:ajs-fadeOut}.alertify.ajs-pulse.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-pulseIn;animation-name:ajs-pulseIn}.alertify.ajs-pulse.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-pulseOut;animation-name:ajs-pulseOut}.alertify.ajs-flipx.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-flipInX;animation-name:ajs-flipInX}.alertify.ajs-flipx.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-flipOutX;animation-name:ajs-flipOutX}.alertify.ajs-flipy.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-flipInY;animation-name:ajs-flipInY}.alertify.ajs-flipy.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-flipOutY;animation-name:ajs-flipOutY}@-webkit-keyframes ajs-pulseIn{0%,20%,40%,60%,80%,to{-webkit-transition-timing-function:cubic-bezier(.215,.61,.355,1);transition-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}20%{-webkit-transform:scale3d(1.1,1.1,1.1);transform:scale3d(1.1,1.1,1.1)}40%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}60%{opacity:1;-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}80%{-webkit-transform:scale3d(.97,.97,.97);transform:scale3d(.97,.97,.97)}to{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}}@keyframes ajs-pulseIn{0%,20%,40%,60%,80%,to{-webkit-transition-timing-function:cubic-bezier(.215,.61,.355,1);transition-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}20%{-webkit-transform:scale3d(1.1,1.1,1.1);transform:scale3d(1.1,1.1,1.1)}40%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}60%{opacity:1;-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}80%{-webkit-transform:scale3d(.97,.97,.97);transform:scale3d(.97,.97,.97)}to{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}}@-webkit-keyframes ajs-pulseOut{20%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}50%,55%{opacity:1;-webkit-transform:scale3d(1.1,1.1,1.1);transform:scale3d(1.1,1.1,1.1)}to{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}}@keyframes ajs-pulseOut{20%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}50%,55%{opacity:1;-webkit-transform:scale3d(1.1,1.1,1.1);transform:scale3d(1.1,1.1,1.1)}to{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}}@-webkit-keyframes ajs-zoomIn{0%{opacity:0;-webkit-transform:scale3d(.25,.25,.25);transform:scale3d(.25,.25,.25)}to{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}}@keyframes ajs-zoomIn{0%{opacity:0;-webkit-transform:scale3d(.25,.25,.25);transform:scale3d(.25,.25,.25)}to{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}}@-webkit-keyframes ajs-zoomOut{0%{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}to{opacity:0;-webkit-transform:scale3d(.25,.25,.25);transform:scale3d(.25,.25,.25)}}@keyframes ajs-zoomOut{0%{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}to{opacity:0;-webkit-transform:scale3d(.25,.25,.25);transform:scale3d(.25,.25,.25)}}@-webkit-keyframes ajs-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes ajs-fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes ajs-fadeOut{0%{opacity:1}to{opacity:0}}@keyframes ajs-fadeOut{0%{opacity:1}to{opacity:0}}@-webkit-keyframes ajs-flipInX{0%{opacity:0;-webkit-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}40%{-webkit-transform:perspective(400px) rotateX(-20deg);transform:perspective(400px) rotateX(-20deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}60%{opacity:1;-webkit-transform:perspective(400px) rotateX(10deg);transform:perspective(400px) rotateX(10deg)}80%{-webkit-transform:perspective(400px) rotateX(-5deg);transform:perspective(400px) rotateX(-5deg)}to{-webkit-transform:perspective(400px);transform:perspective(400px)}}@keyframes ajs-flipInX{0%{opacity:0;-webkit-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}40%{-webkit-transform:perspective(400px) rotateX(-20deg);transform:perspective(400px) rotateX(-20deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}60%{opacity:1;-webkit-transform:perspective(400px) rotateX(10deg);transform:perspective(400px) rotateX(10deg)}80%{-webkit-transform:perspective(400px) rotateX(-5deg);transform:perspective(400px) rotateX(-5deg)}to{-webkit-transform:perspective(400px);transform:perspective(400px)}}@-webkit-keyframes ajs-flipOutX{0%{-webkit-transform:perspective(400px);transform:perspective(400px)}30%{opacity:1;-webkit-transform:perspective(400px) rotateX(-20deg);transform:perspective(400px) rotateX(-20deg)}to{opacity:0;-webkit-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg)}}@keyframes ajs-flipOutX{0%{-webkit-transform:perspective(400px);transform:perspective(400px)}30%{opacity:1;-webkit-transform:perspective(400px) rotateX(-20deg);transform:perspective(400px) rotateX(-20deg)}to{opacity:0;-webkit-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg)}}@-webkit-keyframes ajs-flipInY{0%{opacity:0;-webkit-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}40%{-webkit-transform:perspective(400px) rotateY(-20deg);transform:perspective(400px) rotateY(-20deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}60%{opacity:1;-webkit-transform:perspective(400px) rotateY(10deg);transform:perspective(400px) rotateY(10deg)}80%{-webkit-transform:perspective(400px) rotateY(-5deg);transform:perspective(400px) rotateY(-5deg)}to{-webkit-transform:perspective(400px);transform:perspective(400px)}}@keyframes ajs-flipInY{0%{opacity:0;-webkit-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}40%{-webkit-transform:perspective(400px) rotateY(-20deg);transform:perspective(400px) rotateY(-20deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}60%{opacity:1;-webkit-transform:perspective(400px) rotateY(10deg);transform:perspective(400px) rotateY(10deg)}80%{-webkit-transform:perspective(400px) rotateY(-5deg);transform:perspective(400px) rotateY(-5deg)}to{-webkit-transform:perspective(400px);transform:perspective(400px)}}@-webkit-keyframes ajs-flipOutY{0%{-webkit-transform:perspective(400px);transform:perspective(400px)}30%{opacity:1;-webkit-transform:perspective(400px) rotateY(-15deg);transform:perspective(400px) rotateY(-15deg)}to{opacity:0;-webkit-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg)}}@keyframes ajs-flipOutY{0%{-webkit-transform:perspective(400px);transform:perspective(400px)}30%{opacity:1;-webkit-transform:perspective(400px) rotateY(-15deg);transform:perspective(400px) rotateY(-15deg)}to{opacity:0;-webkit-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg)}}@-webkit-keyframes ajs-slideIn{0%{margin-top:-100%}to{margin-top:5%}}@keyframes ajs-slideIn{0%{margin-top:-100%}to{margin-top:5%}}@-webkit-keyframes ajs-slideOut{0%{margin-top:5%}to{margin-top:-100%}}@keyframes ajs-slideOut{0%{margin-top:5%}to{margin-top:-100%}}.alertify-notifier{overflow:visible;position:fixed;width:0;z-index:1982}.alertify-notifier,.alertify-notifier .ajs-message{-webkit-transform:translateZ(0);transform:translateZ(0)}.alertify-notifier .ajs-message{margin:0;max-height:0;opacity:0;padding:0;position:relative;-webkit-transition-duration:.25s;transition-duration:.25s;-webkit-transition-timing-function:linear;transition-timing-function:linear;width:260px}.alertify-notifier .ajs-message.ajs-visible{margin-top:10px;max-height:100%;opacity:1;padding:15px;-webkit-transition-duration:.5s;transition-duration:.5s;-webkit-transition-timing-function:cubic-bezier(.175,.885,.32,1.275);transition-timing-function:cubic-bezier(.175,.885,.32,1.275)}.alertify-notifier .ajs-message.ajs-success{background:rgba(91,189,114,.95)}.alertify-notifier .ajs-message.ajs-error{background:rgba(217,92,92,.95)}.alertify-notifier .ajs-message.ajs-warning{background:hsla(54,86%,92%,.95)}.alertify-notifier .ajs-message .ajs-close{background-color:rgba(0,0,0,.5);background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAABGdBTUEAALGPC/xhBQAAAFBJREFUGBl1j0EKADEIA+ve/P9f9bh1hEihNBfjVCO1v7RKVqJK4h8gM5cAPR42AkQEpSXPwMTyoi13n5N9YqJehm3Fnr7nL1D0ZEbD5OubGyC7a9gx+9eNAAAAAElFTkSuQmCC);background-position:50%;background-repeat:no-repeat;border-top-right-radius:2px;cursor:pointer;height:16px;position:absolute;right:0;top:0;width:16px}.alertify-notifier.ajs-top{top:10px}.alertify-notifier.ajs-bottom{bottom:10px}.alertify-notifier.ajs-right{right:10px}.alertify-notifier.ajs-right .ajs-message{right:-320px}.alertify-notifier.ajs-right .ajs-message.ajs-visible{right:290px}.alertify-notifier.ajs-left{left:10px}.alertify-notifier.ajs-left .ajs-message{left:-300px}.alertify-notifier.ajs-left .ajs-message.ajs-visible{left:0}.alertify-notifier.ajs-center{left:50%}.alertify-notifier.ajs-center .ajs-message{-webkit-transform:translateX(-50%);transform:translateX(-50%)}.alertify-notifier.ajs-center .ajs-message.ajs-visible{left:50%;-webkit-transition-timing-function:cubic-bezier(.57,.43,.1,.65);transition-timing-function:cubic-bezier(.57,.43,.1,.65)}.alertify-notifier.ajs-center.ajs-top .ajs-message{top:-300px}.alertify-notifier.ajs-center.ajs-top .ajs-message.ajs-visible{top:0}.alertify-notifier.ajs-center.ajs-bottom .ajs-message{bottom:-300px}.alertify-notifier.ajs-center.ajs-bottom .ajs-message.ajs-visible{bottom:0}.ajs-no-transition.alertify .ajs-dialog,.ajs-no-transition.alertify .ajs-dimmer,.ajs-no-transition.alertify .ajs-modal,.ajs-no-transition.alertify-notifier .ajs-message{-webkit-animation:none!important;animation:none!important;-webkit-transition:none!important;transition:none!important}@media (prefers-reduced-motion:reduce){.alertify .ajs-dialog,.alertify .ajs-dimmer,.alertify .ajs-modal,.alertify-notifier .ajs-message{-webkit-animation:none!important;animation:none!important;-webkit-transition:none!important;transition:none!important}} \ No newline at end of file diff --git a/public/assets/alertify.js b/public/assets/alertify.js new file mode 100644 index 0000000..76101ac --- /dev/null +++ b/public/assets/alertify.js @@ -0,0 +1 @@ +(self.webpackChunkcontao_video_bundle=self.webpackChunkcontao_video_bundle||[]).push([[963],{53:function(e,t){var n;!function(i){"use strict";var s=":not(:disabled):not(.ajs-reset)",o=13,a=27,l=112,r=123,c=37,d=39,u=9,m={autoReset:!0,basic:!1,closable:!0,closableByDimmer:!0,invokeOnCloseOff:!1,frameless:!1,defaultFocusOff:!1,maintainFocus:!0,maximizable:!0,modal:!0,movable:!0,moveBounded:!1,overflow:!0,padding:!0,pinnable:!0,pinned:!0,preventBodyShift:!1,resizable:!0,startMaximized:!1,transition:"pulse",transitionOff:!1,tabbable:["button","[href]","input","select","textarea",'[tabindex]:not([tabindex^="-"])'+s].join(s+","),notifier:{delay:5,position:"bottom-right",closeButton:!1,classes:{base:"alertify-notifier",prefix:"ajs-",message:"ajs-message",top:"ajs-top",right:"ajs-right",bottom:"ajs-bottom",left:"ajs-left",center:"ajs-center",visible:"ajs-visible",hidden:"ajs-hidden",close:"ajs-close"}},glossary:{title:"AlertifyJS",ok:"OK",cancel:"Cancel",acccpt:"Accept",deny:"Deny",confirm:"Confirm",decline:"Decline",close:"Close",maximize:"Maximize",restore:"Restore"},theme:{input:"ajs-input",ok:"ajs-ok",cancel:"ajs-cancel"},hooks:{preinit:function(){},postinit:function(){}}},f=[];function h(e,t){e.className+=" "+t}function p(e,t){for(var n=e.className.split(" "),i=t.split(" "),s=0;s-1&&n.splice(o,1)}e.className=n.join(" ")}function v(){return"rtl"===i.getComputedStyle(document.body).direction}function b(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop}function g(){return document.documentElement&&document.documentElement.scrollLeft||document.body.scrollLeft}function y(e){for(;e.lastChild;)e.removeChild(e.lastChild)}function _(e){if(null===e)return e;var t;if(Array.isArray(e)){t=[];for(var n=0;n0){for(var n=[],i=0;i-1&&i.navigator.userAgent.indexOf("Chrome")<0,x='',H='',j='',E='',L='',A='',W='',I='',P='',S={primary:'',auxiliary:''},B='',D='',F="ajs-in",R="ajs-out",U="alertify",X="ajs-basic",Y="ajs-capture",q="ajs-closable",K="ajs-fixed",J="ajs-frameless",V="ajs-hidden",G="ajs-maximized",Q="ajs-maximizable",Z="ajs-modeless",$="ajs-movable",ee="ajs-no-selection",te="ajs-no-overflow",ne="ajs-no-padding",ie="ajs-pinnable",se="ajs-",oe="ajs-resizable",ae="ajs-shake",le="ajs-unpinned",re="ajs-no-transition";function ce(e){if(!e.__internal){var t;N.defaults.hooks.preinit(e),delete e.__init,e.__settings||(e.__settings=_(e.settings)),"function"==typeof e.setup?((t=e.setup()).options=t.options||{},t.focus=t.focus||{}):t={buttons:[],focus:{element:null,select:!1},options:{}},"object"!=typeof e.hooks&&(e.hooks={});var i=[];if(Array.isArray(t.buttons))for(var s=0;s=0?(p(document.body,te),he(!1)):e>0&&document.body.className.indexOf(te)<0&&(he(!0),h(document.body,te))}var me="",fe=0;function he(e){N.defaults.preventBodyShift&&(e&&document.documentElement.scrollHeight>document.documentElement.clientHeight?(fe=t,me=i.getComputedStyle(document.body).top,h(document.body,K),document.body.style.top=-t+"px"):e||(t=fe,document.body.style.top=me,p(document.body,K),de()))}function pe(e,t){for(var n=f.indexOf(t)+1;n200&&(ze=e.timeStamp)&&!Te){var n=e.srcElement||e.target;!0===t.get("closableByDimmer")&&n===t.elements.modal&&ge(t)}Te=!1}var je=0,Ee=!1;function Ne(e,t){if(Date.now()-je>200&&(je=Date.now()))for(var n=0;n-1?(Ne(t,function(e){return e.key===i}),!1):void 0}Ee=!1}function We(e){var t=f[f.length-1],i=e.keyCode;if(i===c||i===d){for(var s=t.__internal.buttons,o=0;ol-1&&n.indexOf(i)>-1)return e.preventDefault(),e.stopPropagation(),Ne(t,function(e){return e.key===i}),!1}function Ie(e,t){if(t)t.focus();else{var n=e.__internal.focus,i=n.element;switch(typeof n.element){case"number":e.__internal.buttons.length>n.element&&(i=!0===e.get("basic")?e.elements.reset[0]:e.__internal.buttons[n.element].element);break;case"string":i=e.elements.body.querySelector(n.element);break;case"function":i=n.element.call(e)}(!0===e.get("defaultFocusOff")||null==i&&0===e.__internal.buttons.length)&&(i=e.elements.reset[0]),i&&i.focus&&(i.focus(),n.select&&i.select&&i.select())}}function Pe(e,t){if(!t)for(var n=f.length-1;n>-1;n-=1)if(f[n].isModal()){t=f[n];break}if(t&&t.isModal()){var i,s=t.elements.reset[0],o=t.elements.reset[1],a=e.relatedTarget,l=t.elements.root.contains(a),r=e.srcElement||e.target;if(r===s&&!l||r===o&&a===s)return;r===o||r===document.body?i=s:r===s&&a===o?i=Se(t):r===s&&l&&(i=Se(t,!0)),Ie(t,i)}}function Se(e,t){var n=[].slice.call(e.elements.dialog.querySelectorAll(m.tabbable));t&&n.reverse();for(var i=0;ist?t.style.left=it+c+"px":t.offsetWidth>=ot&&(t.style.left=it-c+"px")}}(t,nt.elements.dialog,!nt.get("modal")&&!nt.get("pinned")))}function ct(){if(nt){var e=nt;nt=null,p(document.body,ee),p(e.elements.dialog,Y),Te=!0,M("onresized",e)}}function dt(e){nt=null;var t=e.elements.dialog;"none"===t.style.maxWidth&&(t.style.maxWidth=t.style.minWidth=t.style.width=t.style.height=t.style.minHeight=t.style.left="",it=Number.Nan,st=ot=at=0)}function ut(){for(var e=0;e-1},isPinned:function(){return this.elements.root.className.indexOf(le)<0},maximize:function(){return this.isMaximized()||xe(this),this},restore:function(){return this.isMaximized()&&He(this),this},pin:function(){return this.isPinned()||_e(this),this},unpin:function(){return this.isPinned()&&ke(this),this},bringToFront:function(){return pe(0,this),this},moveTo:function(e,t){if(!isNaN(e)&&!isNaN(t)){M("onmove",this);var n=this.elements.dialog,i=n,s=0,o=0;n.style.left&&(s-=parseInt(n.style.left,10)),n.style.top&&(o-=parseInt(n.style.top,10));do{s+=i.offsetLeft,o+=i.offsetTop}while(i=i.offsetParent);var a=e-s,l=t-o;v()&&(a*=-1),n.style.left=a+"px",n.style.top=l+"px",M("onmoved",this)}return this},resizeTo:function(e,t){var n=parseFloat(e),i=parseFloat(t),s=/(\d*\.\d+|\d+)%/;if(!isNaN(n)&&!isNaN(i)&&!0===this.get("resizable")){M("onresize",this),(""+e).match(s)&&(n=n/100*document.documentElement.clientWidth),(""+t).match(s)&&(i=i/100*document.documentElement.clientHeight);var o=this.elements.dialog;"none"!==o.style.maxWidth&&(o.style.minWidth=(ot=o.offsetWidth)+"px"),o.style.maxWidth="none",o.style.minHeight=this.elements.header.offsetHeight+this.elements.footer.offsetHeight+"px",o.style.width=n+"px",o.style.height=i+"px",M("onresized",this)}return this},setting:function(e,t){var n=this,i=be(this,this.__internal.options,function(e,t,i){ve(n,e,t,i)},e,t);if("get"===i.op)return i.found?i.value:void 0!==this.settings?be(this,this.settings,this.settingUpdated||function(){},e,t).value:void 0;if("set"===i.op){if(i.items.length>0)for(var s=this.settingUpdated||function(){},o=0;o0){var t=this;this.__internal.timer=setTimeout(function(){t.dismiss()},1e3*this.__internal.delay)}return this},setContent:function(e){if("string"==typeof e?(y(this.element),this.element.innerHTML=e):e instanceof i.HTMLElement&&this.element.firstChild!==e&&(y(this.element),this.element.appendChild(e)),this.__internal.closeButton){var t=document.createElement("span");h(t,n.close),t.setAttribute("data-close",!0),this.element.appendChild(t)}return this},dismissOthers:function(){return E.dismissAll(this),this}},c.__internal||(c.__internal={pushed:!1,delay:void 0,timer:void 0,clickHandler:void 0,transitionEndHandler:void 0,transitionTimeout:void 0},c.__internal.clickHandler=T(c,a),c.__internal.transitionEndHandler=T(c,l)),c;var c}return{setting:function(e,t){if(o(this),void 0===t)return this.__internal[e];switch(e){case"position":this.__internal.position=t,a(this);break;case"delay":this.__internal.delay=t}return this},set:function(e,t){return this.setting(e,t),this},get:function(e){return this.setting(e)},create:function(e,t){o(this);var i=document.createElement("div");return i.className=n.message+("string"==typeof e&&""!==e?" "+n.prefix+e:""),l(i,t)},dismissAll:function(e){for(var n=t.slice(0),i=0;i=u)&&Object.keys(o.O).every(function(n){return o.O[n](e[c])})?e.splice(c--,1):(f=!1,u0&&n[a-1][2]>u;a--)n[a]=n[a-1];n[a]=[e,t,u]},o.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},o.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},function(){var n={994:0};o.O.j=function(r){return 0===n[r]};var r=function(r,e){var t,u,i=e[0],f=e[1],c=e[2],l=0;if(i.some(function(r){return 0!==n[r]})){for(t in f)o.o(f,t)&&(o.m[t]=f[t]);if(c)var a=c(o)}for(r&&r(e);l1&&void 0!==arguments[1]?arguments[1]:"video";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,"configuration",void 0),l(this,"previewImageElement",void 0),l(this,"privacyMode",void 0),l(this,"videoContainerElement",void 0),l(this,"wrapperElement",void 0),l(this,"type",void 0),this.wrapperElement=t,this.type=n,this.configuration=this.wrapperElement.dataset,this.privacyMode="privacyMode"in this.configuration,"link"!==n?(this.previewImageElement=this.wrapperElement.querySelector(".video-wrapper .video-thumbnail"),this.videoContainerElement=this.wrapperElement.querySelector(".video-wrapper .video-container"),this.applyPrivacySettingsToVideo(),"toggleVideo"in this.configuration&&this.videoToggle()):this.applyPrivacySettingsToLink()}return t=e,n=[{key:"applyPrivacySettingsToVideo",value:function(){var t=this;if(this.privacyMode){if(this.videoContainerElement&&this.videoContainerElement.querySelector(":scope > video"))return void this.showVideo();localStorage.getItem(e.privacyKey)&&this.showVideo(),this.previewImageElement&&this.previewImageElement.addEventListener("click",function(){return t.privacyDialog(t.previewImageElement,function(){return t.showVideo()})})}else this.showVideo()}},{key:"applyPrivacySettingsToLink",value:function(){var e=this;this.wrapperElement.addEventListener("click",function(t){t.preventDefault(),e.privacyMode&&e.privacyDialog(e.wrapperElement,function(e){return window.open(e.getAttribute("href"))})})}},{key:"privacyDialog",value:function(t,n){var i=r().confirm().set({labels:this.privacyDialogLabels(),onshow:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onshow",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))},defaultFocusOff:!0,onfocus:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onfocus",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))}}),o=null;if("privacyModalContent"in this.configuration)o=this.configuration.privacyModalContent;else{if(!this.previewImageElement||!("privacyHtml"in this.previewImageElement.dataset))return;o=this.previewImageElement.dataset.privacyHtml.replace(/\\"/g,'"')}t||(t=this.previewImageElement,this.previewImageElement||(t=this.wrapperElement)),r().confirm(" ",o,function(){i.elements.content.querySelector("[name="+e.storeDecisionFieldName+"]").checked&&localStorage.setItem(e.privacyKey,!0),t.dispatchEvent(new CustomEvent("huh.video.privacy.accept",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),n(t)},function(){t.dispatchEvent(new CustomEvent("huh.video.privacy.cancel",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))})}},{key:"privacyDialogLabels",value:function(){var e={ok:"Ok",cancel:"Cancel"};return"btnLabelOk"in this.wrapperElement.dataset?e.ok=this.wrapperElement.dataset.btnLabelOk:this.previewImageElement&&"btnPrivacyOk"in this.previewImageElement.dataset&&(e.ok=this.previewImageElement.dataset.btnPrivacyOk),"btnLabelOk"in this.wrapperElement.dataset?e.cancel=this.wrapperElement.dataset.btnLabelCancel:this.previewImageElement&&"btnPrivacyCancel"in this.previewImageElement.dataset&&(e.cancel=this.previewImageElement.dataset.btnPrivacyCancel),e}},{key:"showVideo",value:function(){if("element"in this.wrapperElement.dataset){if(this.videoContainerElement)this.videoContainerElement.innerHTML="";else{this.videoContainerElement=document.createElement("div"),this.videoContainerElement.classList.add(["video-container"]);var e=this.wrapperElement.querySelector(".video-wrapper");if(!e)return!1;e.appendChild(this.videoContainerElement)}var t=JSON.parse(this.wrapperElement.dataset.element),n=document.createElement(t.type);Object.entries(t.attributes).forEach(function(e){n.setAttribute(e[0],e[1])}),this.videoContainerElement.appendChild(n)}else{if(!this.videoContainerElement)return!1;var i=this.videoContainerElement.querySelectorAll("iframe");if(i.length>0)i.forEach(function(e){e.src=e.dataset.src,document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))});else{var r=this.videoContainerElement.querySelectorAll(":scope > video");if(r.length<1)return!1;r.forEach(function(e){document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))})}}return this.videoContainerElement.classList.remove("video-hidden"),this.previewImageElement&&(this.previewImageElement.style="display:none;"),!0}},{key:"videoToggle",value:function(){var e=this,t=[!0,!0],n=this.wrapperElement.querySelectorAll(".huh_video .video-toggle-ctn button"),i=this.wrapperElement.querySelector("#videoToggleLiveRegionOutput"),r=function(r){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=t.slice(0);a[r]=!1,n.length>0&&(a.forEach(function(t,i){var r=e.wrapperElement.querySelector("#"+n[i].getAttribute("aria-controls"));if(t){n[i].classList.add("btn-video-show"),r.style.display="none";var o=r.querySelector("iframe");null!==o&&o.setAttribute("src",o.src)}else n[i].classList.remove("btn-video-show"),r.style.display="block"}),o&&(i.textContent=r?"Audiodeskription steht im folgenden Video nicht mehr zur Verfügung":"Audiodeskription steht im folgenden Video zur Verfügung"))};n.length>0&&(n.forEach(function(e,t){e.addEventListener("click",function(e){r(t,!0)})}),r(1))}}],n&&a(t.prototype,n),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i}();l(s,"privacyKey","huh_video_privacy"),l(s,"storeDecisionFieldName","video-save-privacy"),document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".huh_video").forEach(function(e){return new s(e)}),document.querySelectorAll(".huh_video.video-link").forEach(function(e){new s(e,"link")})}),document.addEventListener("afterUnlockProtectedCode",function(e){var t=document.querySelector('[data-identifier="'+e.detail.identifier+'"] .huh_video');if(null!==t&&(new s(t),e.detail.unlockByClick)){var n=t.querySelector(".video-toggle-ctn button");n?n.focus():t.querySelector('[tabindex="0"]').focus()}})}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}};return t[e].call(o.exports,o,o.exports,i),o.exports}i.m=t,e=[],i.O=function(t,n,r,o){if(!n){var a=1/0;for(u=0;u=o)&&Object.keys(i.O).every(function(e){return i.O[e](n[c])})?n.splice(c--,1):(l=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e={658:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,o,a=n[0],l=n[1],c=n[2],s=0;if(a.some(function(t){return 0!==e[t]})){for(r in l)i.o(l,r)&&(i.m[r]=l[r]);if(c)var u=c(i)}for(t&&t(n);swithPaths([ + __DIR__ . '/src', + __DIR__ . '/contao', + ]) + ->withPhpVersion(PhpVersion::PHP_84) + ->withRules([ + AddVoidReturnTypeWhereNoReturnRector::class, + ExplicitNullableParamTypeRector::class + ]) + + ->withImportNames( + importShortClasses: false, + removeUnusedImports: true + ) + ->withComposerBased( + doctrine: true, + phpunit: true, + symfony: true, + ) + ->withSets([ + LevelSetList::UP_TO_PHP_81, + ContaoLevelSetList::UP_TO_CONTAO_413, + ContaoSetList::FQCN, + ContaoSetList::ANNOTATIONS_TO_ATTRIBUTES, + ]) + ->withSkip([ + ClosureToArrowFunctionRector::class => [ + __DIR__.'/src/Generator/DcaFieldGenerator.php' + ] + ]) + ; \ No newline at end of file diff --git a/src/Asset/EncoreExtension.php b/src/Asset/EncoreExtension.php index 3e2a48d..9835fea 100644 --- a/src/Asset/EncoreExtension.php +++ b/src/Asset/EncoreExtension.php @@ -22,10 +22,10 @@ public function getBundle(): string public function getEntries(): array { return [ - EncoreEntry::create('contao-video-bundle', 'src/Resources/assets/js/contao-video-bundle.js') + EncoreEntry::create('contao-video-bundle', '/assets/js/contao-video-bundle.js') ->addJsEntryToRemoveFromGlobals('alertifyjs') ->addJsEntryToRemoveFromGlobals('contao-video-bundle'), - EncoreEntry::create('contao-video-bundle-theme', 'src/Resources/assets/js/contao-video-bundle-theme.js') + EncoreEntry::create('contao-video-bundle-theme', '/assets/js/contao-video-bundle-theme.js') ->setRequiresCss(true) ->addCssEntryToRemoveFromGlobals('alertifyjs') ->addCssEntryToRemoveFromGlobals('contao-video-bundle'), diff --git a/src/Asset/FrontendAsset.php b/src/Asset/FrontendAsset.php index 34acda4..be5d134 100644 --- a/src/Asset/FrontendAsset.php +++ b/src/Asset/FrontendAsset.php @@ -15,7 +15,7 @@ class FrontendAsset implements ServiceSubscriberInterface { use PageAssetsTrait; - public function addFrontendAsset() + public function addFrontendAsset(): void { $this->addPageEntrypoint('contao-video-bundle', [ 'TL_JAVASCRIPT' => [ diff --git a/src/Collection/VideoProviderCollection.php b/src/Collection/VideoProviderCollection.php index 8da6a79..86b8f45 100644 --- a/src/Collection/VideoProviderCollection.php +++ b/src/Collection/VideoProviderCollection.php @@ -12,29 +12,21 @@ class VideoProviderCollection { - /** - * @var array - */ - private $bundleConfig; - - /** - * VideoCollection constructor. - */ - public function __construct(array $bundleConfig) - { - $this->bundleConfig = $bundleConfig; + public function __construct( + private array $bundleConfig, + ) { } /** * Return all video provider as array. - * - * @return array */ - public function getVideoProvider() + public function getVideoProvider(): array { if (isset($this->bundleConfig['video_provider'])) { return array_keys($this->bundleConfig['video_provider']); } + + return []; } /** @@ -51,8 +43,6 @@ public function getClassByVideoProvider(string $provider): string /** * Return a video object base. - * - * @param string $selector */ public function getVideoByRawDataWithSelector(array $data, ?string $selector = 'addVideo'): ?VideoInterface { @@ -67,7 +57,7 @@ public function getVideoByRawDataWithSelector(array $data, ?string $selector = ' try { /** @var string|VideoInterface $videoClass */ $videoClass = $this->getClassByVideoProvider($data['videoProvider']); - } catch (\Exception $e) { + } catch (\Exception) { return null; } diff --git a/src/Command/YoutubeBundleMigrationCommand.php b/src/Command/YoutubeBundleMigrationCommand.php deleted file mode 100644 index 4cbc7e3..0000000 --- a/src/Command/YoutubeBundleMigrationCommand.php +++ /dev/null @@ -1,229 +0,0 @@ -connection = $connection; - $this->parameterBag = $parameterBag; - $this->framework = $framework; - - parent::__construct(); - } - - - protected function configure() - { - $this - ->setDescription(self::$defaultDescription) - ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Preview migration without changing the database.') - ; - } - - - protected function execute(InputInterface $input, OutputInterface $output) - { - $this->framework->initialize(); - - $io = new SymfonyStyle($input, $output); - - $io->title("Migrating youtube bundle to video bundle"); - - if ($input->hasOption('dry-run') && $input->getOption('dry-run')) { - $this->dryRun = true; - $io->note('Dry run enabled, no data will be changed.'); - $io->newLine(); - } - - $result = $this->connection->executeQuery('SELECT id FROM tl_content WHERE type = "youtube"'); - $contentElements = $result->fetchFirstColumn(); - $io->text("Found " . count($contentElements) . " > content elements with type youtube"); - - if (class_exists(HeimrichHannotContaoListBundle::class)) { - $result = $this->connection->executeQuery('SELECT id FROM tl_list_config_element WHERE type = "youtube"'); - $listConfigElements = $result->fetchFirstColumn(); - $io->text("Found " . count($listConfigElements) . " > list config elements with type youtube"); - } - - if (class_exists(HeimrichHannotContaoReaderBundle::class)) { - $result = $this->connection->executeQuery('SELECT id FROM tl_reader_config_element WHERE type = "youtube"'); - $readerConfigElements = $result->fetchFirstColumn(); - $io->text("Found " . count($readerConfigElements) . " > reader config elements with type youtube"); - } - - $bundleConfig = $this->parameterBag->get('huh_video'); - if (isset($bundleConfig['enable_news_support']) && true === $bundleConfig['enable_news_support']) { - $result = $this->connection->executeQuery('SELECT id FROM tl_news WHERE addYouTube = 1'); - $news = $result->fetchFirstColumn(); - $io->text("Found " . count($news) . " > news elements with addYouTube = 1"); - } - - if (!$io->confirm("Do you want to continue?")) { - return Command::SUCCESS; - } - - - if (count($contentElements) > 0) { - $io->text("Migrating content elements"); - $this->migrateContentElements($contentElements, $io); - } - - if (isset($listConfigElements)) { - $io->text("Migrating list config elements"); - $this->migrateConfigTypeElements($listConfigElements, ListConfigElementModel::class, $io); - } - - if (isset($readerConfigElements)) { - $io->text("Migrating reader config elements"); - $this->migrateConfigTypeElements($readerConfigElements, ReaderConfigElementModel::class, $io); - } - - if (isset($news)) { - $io->text("Migrating news elements"); - $this->migrateNews($news, $io); - } - - $io->success("Migration finished"); - - return Command::SUCCESS; - } - - protected function updateLinkText(string $linkText): string - { - $modelLinkMapping = [ - 'huh.youtube.modal.link.default' => 'huh_video.fields.videoLinkText.default', - 'huh.youtube.modal.link.play' => 'huh_video.fields.videoLinkText.play', - 'huh.youtube.modal.link.window' => 'huh_video.fields.videoLinkText.window', - 'huh.youtube.modal.link.article' => 'huh_video.fields.videoLinkText.article', - ]; - - if (in_array($linkText, array_keys($modelLinkMapping))) { - return $modelLinkMapping[$linkText]; - } else { - return 'huh.youtube.modal.link.default'; - } - } - - private function migrateContentElements(array $contentElements, SymfonyStyle $io): void - { - $count = 0; - - foreach ($contentElements as $contentElement) { - $contentModel = ContentModel::findByPk($contentElement); - if (!$contentModel) { - if ($io->isVerbose()) { - $io->text("Content element with id " . $contentElement . " > not found"); - } - continue; - } - - if ($contentModel->type !== 'youtube') { - if ($io->isVerbose()) { - $io->text("Content element with id " . $contentElement . " > is not of type youtube"); - } - continue; - } - - $contentModel->type = ExtendedVideoElementController::TYPE; - $contentModel->videoProvider = YouTubeVideo::getType(); - $contentModel->videoAutoplay = $contentModel->autoplay ?? ''; - $contentModel->videoShowRelated = $contentModel->ytShowRelated; - $contentModel->videoFullsize = $contentModel->youtubeFullsize; - $contentModel->videoLinkText = $this->updateLinkText($contentModel->youtubeLinkText); - - if (!$this->dryRun) { - $contentModel->save(); - } - $count++; - } - - $io->text("Migrated " . $count . " > content elements"); - } - - /** - * @param array $configTypeIds - * @param class-string $modelClass - * @param SymfonyStyle $io - * @return void - */ - private function migrateConfigTypeElements(array $configTypeIds, string $modelClass, SymfonyStyle $io): void - { - $count = 0; - - foreach ($configTypeIds as $configTypeId) { - $configElementModel = $modelClass::findByPk($configTypeId); - if (!$configElementModel) { - if ($io->isVerbose()) { - $io->text("Config element with id " . $configTypeId . " > not found in table " . $modelClass::getTable() . " >"); - } - continue; - } - - $configElementModel->type = VideoConfigElementType::getType(); - $configElementModel->imageSelectorField = $configElementModel->youtubeSelectorField; - - if (!$this->dryRun) { - $configElementModel->save(); - } - - $count++; - } - - $io->text("Migrated " . $count . " > config elements in table " . $modelClass::getTable() . " >"); - } - - private function migrateNews(array $news, SymfonyStyle $io) - { - foreach ($news as $newsId) { - $newsModel = NewsModel::findByPk($newsId); - if (!$newsModel) { - if ($io->isVerbose()) { - $io->text("News element with id " . $newsId . " > not found"); - } - continue; - } - - if ($newsModel->addYouTube) { - $newsModel->addVideo = true; - $newsModel->videoProvider = YouTubeVideo::getType(); - $newsModel->videoAutoplay = $newsModel->autoplay; - $newsModel->videoFullsize = $newsModel->youtubeFullsize; - $newsModel->videoLinkText = $this->updateLinkText($newsModel->youtubeLinkText); - - if (!$this->dryRun) { - $newsModel->save(); - } - $count++; - } - } - - $io->text("Migrated " . $count . " > news elements"); - } -} \ No newline at end of file diff --git a/src/ConfigElementType/VideoConfigElementType.php b/src/ConfigElementType/VideoConfigElementType.php deleted file mode 100644 index a215f4f..0000000 --- a/src/ConfigElementType/VideoConfigElementType.php +++ /dev/null @@ -1,57 +0,0 @@ -videoProviderCollection = $videoProviderCollection; - $this->videoGenerator = $videoGenerator; - } - - public static function getType(): string - { - return 'huh_video'; - } - - public function getPalette(string $prependPalette, string $appendPalette): string - { - return $prependPalette.'{video_legend},imageSelectorField;'.$appendPalette; - } - - public function applyConfiguration(ConfigElementData $configElementData): ConfigElementResult - { - $video = $this->videoProviderCollection->getVideoByRawDataWithSelector($configElementData->getItemData()); - - if (!$video) { - return new ConfigElementResult(ConfigElementResult::TYPE_NONE, null); - } - - return new ConfigElementResult( - ConfigElementResult::TYPE_FORMATTED_VALUE, - $this->videoGenerator->generate($video, $this) - ); - } -} diff --git a/src/ContaoManager/Plugin.php b/src/ContaoManager/Plugin.php index 12b161b..dcdf94b 100644 --- a/src/ContaoManager/Plugin.php +++ b/src/ContaoManager/Plugin.php @@ -14,8 +14,6 @@ use Contao\ManagerPlugin\Bundle\Parser\ParserInterface; use Contao\ManagerPlugin\Config\ConfigPluginInterface; use Contao\ManagerPlugin\Routing\RoutingPluginInterface; -use HeimrichHannot\EncoreBundle\HeimrichHannotContaoEncoreBundle; -use HeimrichHannot\ListBundle\HeimrichHannotContaoListBundle; use HeimrichHannot\VideoBundle\HeimrichHannotVideoBundle; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\Loader\LoaderResolverInterface; @@ -24,34 +22,22 @@ class Plugin implements BundlePluginInterface, ConfigPluginInterface, RoutingPluginInterface { - /** - * {@inheritdoc} - */ public function getBundles(ParserInterface $parser): array { return [ - BundleConfig::create(HeimrichHannotVideoBundle::class)->setLoadAfter([ - ContaoCoreBundle::class, - HeimrichHannotContaoEncoreBundle::class, - HeimrichHannotContaoListBundle::class, - ]), + BundleConfig::create(HeimrichHannotVideoBundle::class) + ->setLoadAfter([ContaoCoreBundle::class]), ]; } - /** - * {@inheritdoc} - */ public function registerContainerConfiguration(LoaderInterface $loader, array $managerConfig): void { - $loader->load('@HeimrichHannotVideoBundle/Resources/config/services.yml'); + $loader->load('@HeimrichHannotVideoBundle/config/services.yaml'); } - /** - * {@inheritdoc} - */ public function getRouteCollection(LoaderResolverInterface $resolver, KernelInterface $kernel): ?RouteCollection { - $file = '@HeimrichHannotVideoBundle/Resources/config/routing.yml'; + $file = '@HeimrichHannotVideoBundle/config/routing.yaml'; return $resolver->resolve($file)->load($file); } diff --git a/src/ContentElement/VideoElement.php b/src/ContentElement/VideoElement.php deleted file mode 100644 index adcf1f6..0000000 --- a/src/ContentElement/VideoElement.php +++ /dev/null @@ -1,82 +0,0 @@ -get(VideoProviderCollection::class)->getVideoByRawDataWithSelector($this->objModel->row(), null); - - if ($video) { - try { - $this->videoBuffer = System::getContainer()->get(VideoGenerator::class)->generate($video, $this); - } catch (LoaderError $e) { - if (System::getContainer()->get(Utils::class)->container()->isBackend()) { - $this->videoBuffer = ''.$e->getMessage().' Please verify template settings in root page.'; - } else { - throw $e; - } - } - } - - if (TL_MODE == 'BE') { - $objTemplate = new BackendTemplate('be_wildcard'); - $objTemplate->title = $this->headline; - - $objTemplate->wildcard = $this->videoBuffer; - - return $objTemplate->parse(); - } - - return parent::generate(); - } - - /** - * {@inheritdoc} - */ - protected function compile() - { - if ($this->videoBuffer) { - $this->Template->video = $this->videoBuffer; - System::getContainer()->get(FrontendAsset::class)->addFrontendAsset(); - } - } -} diff --git a/src/Controller/ContentElement/ExtendedVideoElementController.php b/src/Controller/ContentElement/ExtendedVideoElementController.php index 3338bba..4315ddc 100644 --- a/src/Controller/ContentElement/ExtendedVideoElementController.php +++ b/src/Controller/ContentElement/ExtendedVideoElementController.php @@ -5,51 +5,34 @@ use Contao\BackendTemplate; use Contao\ContentModel; use Contao\CoreBundle\Controller\ContentElement\AbstractContentElementController; -use Contao\CoreBundle\ServiceAnnotation\ContentElement; +use Contao\CoreBundle\DependencyInjection\Attribute\AsContentElement; use Contao\Template; use HeimrichHannot\UtilsBundle\Util\Utils; use HeimrichHannot\VideoBundle\Asset\FrontendAsset; use HeimrichHannot\VideoBundle\Collection\VideoProviderCollection; use HeimrichHannot\VideoBundle\Event\BeforeRenderPlayerEvent; use HeimrichHannot\VideoBundle\Generator\VideoGenerator; -use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\Translation\TranslatorInterface; -/** - * @ContentElement(ExtendedVideoElementController::TYPE, category="media", template="ce_video") - */ +#[AsContentElement(ExtendedVideoElementController::TYPE, category: 'media', template: 'ce_video')] class ExtendedVideoElementController extends AbstractContentElementController { public const TYPE = 'huh_video'; - private VideoGenerator $videoGenerator; - private Utils $utils; - private FrontendAsset $frontendAsset; - private TranslatorInterface $translator; - /** @var EventDispatcher */ - private EventDispatcherInterface $eventDispatcher; public function __construct( - VideoProviderCollection $videoProviderCollection, - VideoGenerator $videoGenerator, - Utils $utils, - FrontendAsset $frontendAsset, - TranslatorInterface $translator, - EventDispatcherInterface $eventDispatcher - ) - { - $this->videoProviderCollection = $videoProviderCollection; - $this->videoGenerator = $videoGenerator; - $this->utils = $utils; - $this->frontendAsset = $frontendAsset; - $this->translator = $translator; - $this->eventDispatcher = $eventDispatcher; + private readonly VideoProviderCollection $videoProviderCollection, + private readonly VideoGenerator $videoGenerator, + private readonly Utils $utils, + private readonly FrontendAsset $frontendAsset, + private readonly TranslatorInterface $translator, + private readonly EventDispatcherInterface $eventDispatcher, + ) { } - - protected function getResponse(Template $template, ContentModel $model, Request $request): ?Response + protected function getResponse(Template $template, ContentModel $model, Request $request): Response { $video = $this->videoProviderCollection->getVideoByRawDataWithSelector($model->row(), null); @@ -59,6 +42,7 @@ protected function getResponse(Template $template, ContentModel $model, Request $template->title = $this->translator->trans('tl_content.reference.videoProvider.' . $video::getType(), [], 'contao_tl_content'); $template->wildcard = $video->getHeadlineText(); } + return $template->getResponse(); } @@ -77,6 +61,7 @@ protected function getResponse(Template $template, ContentModel $model, Request $template->video = $videoBuffer ?? ''; $this->frontendAsset->addFrontendAsset(); + return $template->getResponse(); } -} \ No newline at end of file +} diff --git a/src/Controller/FrontendController.php b/src/Controller/FrontendController.php index f334392..f673095 100644 --- a/src/Controller/FrontendController.php +++ b/src/Controller/FrontendController.php @@ -9,7 +9,7 @@ namespace HeimrichHannot\VideoBundle\Controller; use Contao\Model; -use HeimrichHannot\UtilsBundle\Model\ModelUtil; +use HeimrichHannot\UtilsBundle\Util\Utils; use HeimrichHannot\VideoBundle\Collection\VideoProviderCollection; use HeimrichHannot\VideoBundle\Generator\VideoGenerator; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -18,46 +18,33 @@ /** * Class FrontendController. - * - * @Route("/huh_video", name="huh_video_", defaults={"_scope"="frontend", "_token_check"=false }) */ +#[Route(path: '/huh_video', name: 'huh_video_', defaults: [ + '_scope' => 'frontend', + '_token_check' => false, +])] class FrontendController extends AbstractController { - /** - * @var ModelUtil - */ - private $modelUtil; - /** - * @var VideoGenerator - */ - private $videoGenerator; - /** - * @var VideoProviderCollection - */ - private $videoProviderCollection; - - /** - * FrontendController constructor. - */ - public function __construct(ModelUtil $modelUtil, VideoGenerator $videoGenerator, VideoProviderCollection $videoProviderCollection) - { - $this->modelUtil = $modelUtil; - $this->videoGenerator = $videoGenerator; - $this->videoProviderCollection = $videoProviderCollection; + public function __construct( + private readonly VideoGenerator $videoGenerator, + private readonly VideoProviderCollection $videoProviderCollection, + private readonly Utils $utils, + ) { } /** - * @Route("/videobyentity/{entity}/{id}", name="video-by-entity", requirements={"id"="\d+"}) - * * @param string $entity Table name without tl_ prefix * @param int $id * * @return Response */ + #[Route(path: '/videobyentity/{entity}/{id}', name: 'video-by-entity', requirements: [ + 'id' => '\d+', + ])] public function showVideoByEntityAction($entity, $id) { /** @var Model|null $entity */ - $entity = $this->modelUtil->findModelInstanceByPk('tl_'.$entity, $id); + $entity = $this->utils->model()->findModelInstanceByPk('tl_' . $entity, $id); if (!$entity) { return new Response('No entity with video found', 404); @@ -66,8 +53,10 @@ public function showVideoByEntityAction($entity, $id) try { $videoClass = $this->videoProviderCollection->getClassByVideoProvider($entity->videoProvider); - return new Response($this->videoGenerator->generate(new $videoClass($entity->row()), ['ignoreFullsize' => true])); - } catch (\Exception $e) { + return new Response($this->videoGenerator->generate(new $videoClass($entity->row()), [ + 'ignoreFullsize' => true, + ])); + } catch (\Exception) { return new Response('No video found for given entity', 404); } } diff --git a/src/DataContainer/ContentContainer.php b/src/DataContainer/ContentContainer.php index 9ed07aa..6c1185f 100644 --- a/src/DataContainer/ContentContainer.php +++ b/src/DataContainer/ContentContainer.php @@ -3,16 +3,14 @@ namespace HeimrichHannot\VideoBundle\DataContainer; use Contao\ContentModel; -use Contao\CoreBundle\ServiceAnnotation\Callback; +use Contao\CoreBundle\DependencyInjection\Attribute\AsCallback; use Contao\DataContainer; use HeimrichHannot\VideoBundle\Controller\ContentElement\ExtendedVideoElementController; class ContentContainer { - /** - * @Callback(table="tl_content", target="config.onload") - */ - public function onConfigLoadCallback(DataContainer $dc = null): void + #[AsCallback(table: 'tl_content', target: 'config.onload')] + public function onConfigLoadCallback(?DataContainer $dc = null): void { if (!$dc || !$dc->id || !($element = ContentModel::findById($dc->id)) || ExtendedVideoElementController::TYPE !== $element->type) { return; @@ -20,4 +18,4 @@ public function onConfigLoadCallback(DataContainer $dc = null): void $GLOBALS['TL_DCA']['tl_content']['fields']['text']['eval']['mandatory'] = false; } -} \ No newline at end of file +} diff --git a/src/DataContainer/PageContainer.php b/src/DataContainer/PageContainer.php new file mode 100644 index 0000000..5011cec --- /dev/null +++ b/src/DataContainer/PageContainer.php @@ -0,0 +1,41 @@ +finderFactory->create(); + + $finder + ->identifier('huh_video/fullsize') + ->extension('html.twig') + ->withVariants(); + + return $finder->asTemplateOptions(); + } + + #[AsCallback(table: 'tl_page', target: 'fields.videoprivacyTemplate.options')] + public function onFieldsVideoprivacyTemplateOptionsCallback(?DataContainer $dc = null): array + { + $finder = $this->finderFactory->create(); + + $finder + ->identifier('huh_video/privacy') + ->extension('html.twig') + ->withVariants(); + + return $finder->asTemplateOptions(); + } +} diff --git a/src/DataContainer/VideoFieldContainer.php b/src/DataContainer/VideoFieldContainer.php deleted file mode 100644 index 420c2d4..0000000 --- a/src/DataContainer/VideoFieldContainer.php +++ /dev/null @@ -1,45 +0,0 @@ -getParameter('huh_video'); - $queries = []; - - if (\is_array($config['media_queries'])) { - foreach ($config['media_queries'] as $key => $query) { - if (!empty($query['name'])) { - $queries[$key] = $query['name'].' ['.$query['query'].']'; - } else { - $queries[$key] = $query['query']; - } - } - } - - return $queries; - } -} diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 82b2820..01b8071 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -13,30 +13,11 @@ class Configuration implements ConfigurationInterface { - /** - * {@inheritdoc} - */ public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('huh_video'); $rootNode = $treeBuilder->getRootNode(); - $rootNode - ->children() - ->booleanNode('enableNewsSupport')->defaultFalse()->setDeprecated('Option was renamed and will be removed in Version 1.0. Use enable_news_support instead.')->end() - ->booleanNode('defaultEnableNoCookieVideoUrl')->defaultFalse()->setDeprecated('Option was renamed and will be removed in Version 1.0. Use default_use_no_cookie_video_url instead.')->end() - ->booleanNode('defaultEnablePrivacyNotice')->defaultFalse()->setDeprecated('Option was renamed and will be removed in Version 1.0. Use default_display_privacy_notice instead.')->end() - ->arrayNode('videoProvider') - ->useAttributeAsKey('name') - ->setDeprecated('Option was renamed and will be removed in Version 1.0. Use video_provider instead.') - ->arrayPrototype() - ->children() - ->scalarNode('class')->end() - ->end() - ->end() - ->end() - ; - $rootNode ->children() ->booleanNode('enable_news_support')->defaultFalse()->info('Enable support for news entity. Needs database update after enable.')->end() diff --git a/src/DependencyInjection/HeimrichHannotVideoExtension.php b/src/DependencyInjection/HeimrichHannotVideoExtension.php index 59706ce..8142222 100644 --- a/src/DependencyInjection/HeimrichHannotVideoExtension.php +++ b/src/DependencyInjection/HeimrichHannotVideoExtension.php @@ -16,16 +16,11 @@ class HeimrichHannotVideoExtension extends Extension { - /** - * {@inheritdoc} - */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - $config = $this->deprecatedOptionsMapping($config); - if (!isset($config['video_provider']['youtube'])) { $config['video_provider']['youtube']['class'] = YouTubeVideo::class; } @@ -38,10 +33,6 @@ public function load(array $configs, ContainerBuilder $container) $config['video_provider']['file']['class'] = FileVideo::class; } - // Support deperecated option - // @todo: remove in version 1.0 - $config['videoProvider'] = $config['video_provider']; - $container->setParameter('huh_video', $config); } @@ -49,31 +40,4 @@ public function getAlias(): string { return 'huh_video'; } - - /** - * Support deprecated options. - * - * @todo Remove in version 1.0 - */ - protected function deprecatedOptionsMapping(array $config): array - { - if (true === $config['enableNewsSupport'] && true !== $config['enable_news_support']) { - $config['enable_news_support'] = true; - } - $config['enableNewsSupport'] = $config['enable_news_support']; - - if (true === $config['defaultEnableNoCookieVideoUrl'] && true !== $config['default_use_no_cookie_video_url']) { - $config['default_use_no_cookie_video_url'] = true; - } - $config['defaultEnableNoCookieVideoUrl'] = $config['default_use_no_cookie_video_url']; - - if (true === $config['defaultEnablePrivacyNotice'] && true !== $config['default_display_privacy_notice']) { - $config['default_display_privacy_notice'] = true; - } - $config['defaultEnablePrivacyNotice'] = $config['default_display_privacy_notice']; - - $config['video_provider'] = array_merge($config['videoProvider'], $config['video_provider']); - - return $config; - } } diff --git a/src/Event/AfterRenderPlayerEvent.php b/src/Event/AfterRenderPlayerEvent.php index 03031ec..ba082ec 100644 --- a/src/Event/AfterRenderPlayerEvent.php +++ b/src/Event/AfterRenderPlayerEvent.php @@ -16,39 +16,14 @@ class AfterRenderPlayerEvent extends Event { public const NAME = 'huh.video.after_render_player'; - /** - * @var string - */ - private $buffer; - /** - * @var VideoInterface - */ - private $video; - /** - * @var array - */ - private $context; - private $parent; - /** - * @var PageModel|null - */ - private $rootPage; - /** - * @var array - */ - private $options; - - /** - * AfterRenderPlayerEvent constructor. - */ - public function __construct(string $buffer, VideoInterface $video, array $context, $parent, ?PageModel $rootPage, array $options) - { - $this->buffer = $buffer; - $this->video = $video; - $this->context = $context; - $this->parent = $parent; - $this->rootPage = $rootPage; - $this->options = $options; + public function __construct( + private string $buffer, + private VideoInterface $video, + private array $context, + private $parent, + private ?PageModel $rootPage, + private array $options, + ) { } public function getBuffer(): string @@ -81,18 +56,12 @@ public function setContext(array $context): void $this->context = $context; } - /** - * @return mixed - */ public function getParent() { return $this->parent; } - /** - * @param mixed $parent - */ - public function setParent($parent): void + public function setParent(mixed $parent): void { $this->parent = $parent; } diff --git a/src/Event/BeforeRenderPlayerEvent.php b/src/Event/BeforeRenderPlayerEvent.php index f35b0ce..cc3134e 100644 --- a/src/Event/BeforeRenderPlayerEvent.php +++ b/src/Event/BeforeRenderPlayerEvent.php @@ -15,37 +15,14 @@ class BeforeRenderPlayerEvent extends Event { public const NAME = 'huh.video.before_render_player'; - /** - * @var VideoInterface - */ - private $video; - /** - * @var array - */ - private $context; - /** - * @var mixed - */ - private $parent; - /** - * @var PageModel|null - */ - private $rootPage; - /** - * @var array - */ - private $options; - /** - * BeforeRenderPlayerEvent constructor. - */ - public function __construct(VideoInterface $video, array $context, $parent, ?PageModel $rootPage, array $options) - { - $this->video = $video; - $this->context = $context; - $this->parent = $parent; - $this->rootPage = $rootPage; - $this->options = $options; + public function __construct( + private readonly VideoInterface $video, + private array $context, + private readonly mixed $parent, + private readonly ?PageModel $rootPage, + private readonly array $options, + ) { } public function getVideo(): VideoInterface @@ -63,9 +40,6 @@ public function setContext(array $context): void $this->context = $context; } - /** - * @return mixed - */ public function getParent() { return $this->parent; diff --git a/src/EventListener/Dca/ConfigElementListener.php b/src/EventListener/Dca/ConfigElementListener.php deleted file mode 100644 index 4a3e76b..0000000 --- a/src/EventListener/Dca/ConfigElementListener.php +++ /dev/null @@ -1,37 +0,0 @@ -utils = $utils; - $this->translator = $translator; - } - - public function onLoadCallback(DataContainer $dc): void - { - $element = $this->utils->model()->findModelInstanceByIdOrAlias($dc->table, $dc->id); - - if (!$element || $element->type !== VideoConfigElementType::getType()) { - return; - } - - $GLOBALS['TL_LANG'][$dc->table]['imageSelectorField'][1] = $this->translator->trans('tl_list_config_element.imageSelectorField.videoSelector', [], 'contao_tl_list_config_element'); - } -} diff --git a/src/EventListener/Dca/ModifiyVideoPaletteListener.php b/src/EventListener/Dca/ModifiyVideoPaletteListener.php index 16b4fb4..81110f9 100644 --- a/src/EventListener/Dca/ModifiyVideoPaletteListener.php +++ b/src/EventListener/Dca/ModifiyVideoPaletteListener.php @@ -10,63 +10,49 @@ use Contao\DataContainer; use Contao\Message; -use HeimrichHannot\UtilsBundle\Container\ContainerUtil; -use HeimrichHannot\UtilsBundle\Model\ModelUtil; +use HeimrichHannot\UtilsBundle\Util\Utils; use HeimrichHannot\VideoBundle\Collection\VideoProviderCollection; use HeimrichHannot\VideoBundle\Video\PreviewImageInterface; use HeimrichHannot\VideoBundle\Video\VideoInterface; +use Symfony\Component\HttpFoundation\RequestStack; class ModifiyVideoPaletteListener { - /** - * @var ContainerUtil - */ - private $containerUtil; - /** - * @var VideoProviderCollection - */ - private $videoProviderCollection; - /** - * @var ModelUtil - */ - private $modelUtil; - - /** - * ModifiyVideoPaletteListener constructor. - */ - public function __construct(ContainerUtil $containerUtil, ModelUtil $modelUtil, VideoProviderCollection $videoProviderCollection) - { - $this->containerUtil = $containerUtil; - $this->videoProviderCollection = $videoProviderCollection; - $this->modelUtil = $modelUtil; + public function __construct( + private readonly VideoProviderCollection $videoProviderCollection, + private readonly Utils $utils, + private readonly RequestStack $requestStack, + ) { } - /** - * @param DataContainer $dataContainer - */ - public function updateVideoPaletteWithLegend($dataContainer) + public function updateVideoPaletteWithLegend(?DataContainer $dc = null): void { - $this->updateVideoPalette($dataContainer); + if (!$dc?->id || !('edit' === $this->requestStack->getCurrentRequest()?->query->get('act'))) { + return; + } + + $this->updateVideoPalette($dc); } - /** - * @param DataContainer $dataContainer - */ - public function updateVideoPaletteWithoutLegend($dataContainer) + public function updateVideoPaletteWithoutLegend(?DataContainer $dc = null): void { - $this->updateVideoPalette($dataContainer, true); + if (!$dc?->id || !('edit' === $this->requestStack->getCurrentRequest()?->query->get('act'))) { + return; + } + + $this->updateVideoPalette($dc, true); } - protected function updateVideoPalette($dataContainer, bool $withoutLegend = false) + protected function updateVideoPalette($dataContainer, bool $withoutLegend = false): void { - if (!$this->containerUtil->isBackend()) { + if (!$this->utils->container()->isBackend()) { return; } - if (false === strpos($dataContainer->getPalette(), 'videoProvider')) { + if (!str_contains((string) $dataContainer->getPalette(), 'videoProvider')) { return; } - $model = $this->modelUtil->findModelInstanceByPk($dataContainer->table, $dataContainer->id); + $model = $this->utils->model()->findModelInstanceByPk($dataContainer->table, $dataContainer->id); if (!isset($model->videoProvider)) { return; @@ -83,7 +69,7 @@ protected function updateVideoPalette($dataContainer, bool $withoutLegend = fals $isSubpalette = false; - if (false !== strpos($dataContainer->getPalette(), 'addVideo')) { + if (str_contains((string) $dataContainer->getPalette(), 'addVideo')) { $isSubpalette = true; } @@ -107,7 +93,7 @@ protected function updatePalette(string $table, string $videoClass, bool $noLege $palette = $dca['subpalettes']['addVideo']; $palette = str_replace( 'videoProvider', - 'videoProvider,'.$videoProviderFields, + 'videoProvider,' . $videoProviderFields, $palette ); @@ -116,7 +102,7 @@ protected function updatePalette(string $table, string $videoClass, bool $noLege $previewPalette = ',addPreviewImage'; $palette = str_replace( $position, - $position.$previewPalette, + $position . $previewPalette, $palette ); } @@ -129,7 +115,7 @@ protected function updatePalette(string $table, string $videoClass, bool $noLege $palette = str_replace( ',videoProvider', - ',videoProvider,'.$videoProviderFields, + ',videoProvider,' . $videoProviderFields, $palette ); diff --git a/src/EventListener/Dca/OnMediaQueryOptionCallbackListener.php b/src/EventListener/Dca/OnMediaQueryOptionCallbackListener.php index 115ecee..7f6dfa4 100644 --- a/src/EventListener/Dca/OnMediaQueryOptionCallbackListener.php +++ b/src/EventListener/Dca/OnMediaQueryOptionCallbackListener.php @@ -7,13 +7,9 @@ class OnMediaQueryOptionCallbackListener { - private ParameterBagInterface $parameterBag; - public function __construct( - ParameterBagInterface $parameterBag - ) - { - $this->parameterBag = $parameterBag; + private readonly ParameterBagInterface $parameterBag, + ) { } public function onMediaQueryOptionsCallback(?DataContainer $dc): array @@ -24,7 +20,7 @@ public function onMediaQueryOptionsCallback(?DataContainer $dc): array if (\is_array($config['media_queries'])) { foreach ($config['media_queries'] as $key => $query) { if (!empty($query['name'])) { - $queries[$key] = $query['name'].' ['.$query['query'].']'; + $queries[$key] = $query['name'] . ' [' . $query['query'] . ']'; } else { $queries[$key] = $query['query']; } @@ -33,4 +29,4 @@ public function onMediaQueryOptionsCallback(?DataContainer $dc): array return $queries; } -} \ No newline at end of file +} diff --git a/src/EventListener/Dca/PageContainer.php b/src/EventListener/Dca/PageContainer.php index 24f7692..64ed705 100644 --- a/src/EventListener/Dca/PageContainer.php +++ b/src/EventListener/Dca/PageContainer.php @@ -9,27 +9,13 @@ namespace HeimrichHannot\VideoBundle\EventListener\Dca; use Contao\DataContainer; -use HeimrichHannot\UtilsBundle\Choice\ModelInstanceChoice; use HeimrichHannot\VideoBundle\Collection\VideoProviderCollection; class PageContainer { - /** - * @var VideoProviderCollection - */ - private $videoProviderCollection; - /** - * @var ModelInstanceChoice - */ - private $modelInstanceChoice; - - /** - * PageContainer constructor. - */ - public function __construct(VideoProviderCollection $videoProviderCollection, ModelInstanceChoice $modelInstanceChoice) - { - $this->videoProviderCollection = $videoProviderCollection; - $this->modelInstanceChoice = $modelInstanceChoice; + public function __construct( + private readonly VideoProviderCollection $videoProviderCollection, + ) { } /** @@ -41,16 +27,4 @@ public function onMceVideoProviderOptionsCallback($dc) { return $this->videoProviderCollection->getVideoProvider(); } - - /** - * @param DataContainer $dc - * - * @return mixed - */ - public function onMceLocalStorageAttribute($dc) - { - return $this->modelInstanceChoice->getCachedChoices([ - 'dataContainer' => 'tl_tracking_object', - ]); - } } diff --git a/src/EventListener/InitializeSystemListener.php b/src/EventListener/InitializeSystemListener.php index 591330d..02af041 100644 --- a/src/EventListener/InitializeSystemListener.php +++ b/src/EventListener/InitializeSystemListener.php @@ -8,19 +8,15 @@ namespace HeimrichHannot\VideoBundle\EventListener; -use Contao\CoreBundle\ServiceAnnotation\Hook; +use Contao\CoreBundle\DependencyInjection\Attribute\AsHook; use HeimrichHannot\UtilsBundle\Util\Utils; -/** - * @Hook("initializeSystem") - */ +#[AsHook('initializeSystem')] class InitializeSystemListener { - private Utils $utils; - - public function __construct(Utils $utils) - { - $this->utils = $utils; + public function __construct( + private readonly Utils $utils, + ) { } public function __invoke(): void diff --git a/src/EventListener/LoadDataContainerListener.php b/src/EventListener/LoadDataContainerListener.php index 448d353..1f081a5 100644 --- a/src/EventListener/LoadDataContainerListener.php +++ b/src/EventListener/LoadDataContainerListener.php @@ -9,24 +9,20 @@ namespace HeimrichHannot\VideoBundle\EventListener; use Contao\CoreBundle\DataContainer\PaletteManipulator; -use Contao\CoreBundle\ServiceAnnotation\Hook; -use HeimrichHannot\VideoBundle\EventListener\Dca\ConfigElementListener; +use Contao\CoreBundle\DependencyInjection\Attribute\AsHook; +use HeimrichHannot\MultiColumnEditorBundle\HeimrichHannotContaoMultiColumnEditorBundle; use HeimrichHannot\VideoBundle\EventListener\Dca\PageContainer; use HeimrichHannot\VideoBundle\Generator\DcaFieldGenerator; -/** - * @Hook("loadDataContainer", priority=1) - */ +#[AsHook('loadDataContainer', priority: 1)] class LoadDataContainerListener { public const PALETTE_VIDEO = 'videoProvider'; public const PALETTE_PLAYER = 'videoFullsize,videoAutoplay'; - private array $bundleConfig; - - public function __construct(array $bundleConfig) - { - $this->bundleConfig = $bundleConfig; + public function __construct( + private array $bundleConfig, + ) { } public function __invoke(string $table): void @@ -40,12 +36,6 @@ public function __invoke(string $table): void case 'tl_page': $this->preparePageTable(); - break; - - case 'tl_list_config_element': - case 'tl_reader_config_element': - $this->prepareConfigElementTable($table); - break; } } @@ -76,12 +66,6 @@ protected function prepareNewsTable() } } - protected function prepareConfigElementTable($table) - { - $dca = &$GLOBALS['TL_DCA'][$table]; - $dca['config']['onload_callback'][] = [ConfigElementListener::class, 'onLoadCallback']; - } - protected function preparePageTable() { $this->enablePrivacyCenterSupport(); @@ -93,7 +77,7 @@ protected function enablePrivacyCenterSupport() return; } - if (!class_exists('HeimrichHannot\MultiColumnEditorBundle\HeimrichHannotContaoMultiColumnEditorBundle')) { + if (!class_exists(HeimrichHannotContaoMultiColumnEditorBundle::class)) { trigger_error( 'HeimrichHannotContaoMultiColumnEditorBundle not found. Multi Column Editor bundle is needed for privacy center integration.', \E_USER_WARNING); @@ -117,7 +101,10 @@ protected function enablePrivacyCenterSupport() 'label' => &$GLOBALS['TL_LANG']['tl_page']['usePrivacyCenter'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50', 'submitOnChange' => true], + 'eval' => [ + 'tl_class' => 'w50', + 'submitOnChange' => true, + ], 'sql' => "char(1) NOT NULL default ''", ]; $dca['fields']['privacyCenterLocalStorageAttribute'] = [ @@ -133,15 +120,25 @@ protected function enablePrivacyCenterSupport() 'filter' => true, 'inputType' => 'select', 'options_callback' => [PageContainer::class, 'onMceVideoProviderOptionsCallback'], - 'eval' => ['groupStyle' => 'width: 49%', 'mandatory' => true, 'includeBlankOption' => true, 'submitOnChange' => true], + 'eval' => [ + 'groupStyle' => 'width: 49%', + 'mandatory' => true, + 'includeBlankOption' => true, + 'submitOnChange' => true, + ], ], 'localStorageAttribute' => [ 'label' => &$GLOBALS['TL_LANG']['tl_page']['localStorageAttribute'], 'exclude' => true, 'filter' => true, 'inputType' => 'select', - 'options_callback' => [PageContainer::class, 'onMceLocalStorageAttribute'], - 'eval' => ['groupStyle' => 'width: 49%', 'mandatory' => true, 'includeBlankOption' => true, 'submitOnChange' => true], + 'options_callback' => [PrivacyCenterListener::class, 'onFieldsMceLocalStorageAttribute'], + 'eval' => [ + 'groupStyle' => 'width: 49%', + 'mandatory' => true, + 'includeBlankOption' => true, + 'submitOnChange' => true, + ], ], ], ], diff --git a/src/EventListener/ParseArticlesListener.php b/src/EventListener/ParseArticlesListener.php index 61ec684..d668494 100644 --- a/src/EventListener/ParseArticlesListener.php +++ b/src/EventListener/ParseArticlesListener.php @@ -8,7 +8,7 @@ namespace HeimrichHannot\VideoBundle\EventListener; -use Contao\CoreBundle\ServiceAnnotation\Hook; +use Contao\CoreBundle\DependencyInjection\Attribute\AsHook; use Contao\FrontendTemplate; use Contao\Module; use HeimrichHannot\VideoBundle\Asset\FrontendAsset; @@ -16,22 +16,15 @@ use HeimrichHannot\VideoBundle\Generator\VideoGenerator; use HeimrichHannot\VideoBundle\Video\VideoInterface; -/** - * @Hook("parseArticles") - */ +#[AsHook('parseArticles')] class ParseArticlesListener { - private array $bundleConfig; - private VideoProviderCollection $videoProviderCollection; - private VideoGenerator $videoGenerator; - private FrontendAsset $frontendAsset; - - public function __construct(array $bundleConfig, VideoProviderCollection $videoProviderCollection, VideoGenerator $videoGenerator, FrontendAsset $frontendAsset) - { - $this->bundleConfig = $bundleConfig; - $this->videoProviderCollection = $videoProviderCollection; - $this->videoGenerator = $videoGenerator; - $this->frontendAsset = $frontendAsset; + public function __construct( + private array $bundleConfig, + private readonly VideoProviderCollection $videoProviderCollection, + private readonly VideoGenerator $videoGenerator, + private readonly FrontendAsset $frontendAsset, + ) { } public function __invoke(FrontendTemplate $template, array $newsEntry, Module $module): void diff --git a/src/EventListener/PrivacyCenterListener.php b/src/EventListener/PrivacyCenterListener.php index 9d5a3a2..35e686c 100644 --- a/src/EventListener/PrivacyCenterListener.php +++ b/src/EventListener/PrivacyCenterListener.php @@ -13,6 +13,7 @@ use HeimrichHannot\PrivacyCenterBundle\Generator\ProtectedCodeConfiguration; use HeimrichHannot\PrivacyCenterBundle\Generator\ProtectedCodeGenerator; use HeimrichHannot\PrivacyCenterBundle\Generator\SplashImage; +use HeimrichHannot\PrivacyCenterBundle\Model\TrackingObjectModel; use HeimrichHannot\UtilsBundle\Util\Utils; use HeimrichHannot\VideoBundle\Event\AfterRenderPlayerEvent; use Psr\Container\ContainerInterface; @@ -22,25 +23,21 @@ class PrivacyCenterListener implements EventSubscriberInterface, ServiceSubscriberInterface { - private TranslatorInterface $translator; - private ContainerInterface $container; - private Utils $utils; - - public function __construct(ContainerInterface $container, TranslatorInterface $translator, Utils $utils) - { - $this->translator = $translator; - $this->container = $container; - $this->utils = $utils; + public function __construct( + private readonly ContainerInterface $container, + private readonly TranslatorInterface $translator, + private readonly Utils $utils, + ) { } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ AfterRenderPlayerEvent::NAME => 'afterRenderPlayer', ]; } - public function afterRenderPlayer(AfterRenderPlayerEvent $event) + public function afterRenderPlayer(AfterRenderPlayerEvent $event): void { if (!$this->isPrivacyCenterEnabled($event->getRootPage()) || 'file' === $event->getContext()['type']) { return; @@ -71,7 +68,7 @@ public function afterRenderPlayer(AfterRenderPlayerEvent $event) } ($configuration = new ProtectedCodeConfiguration()) - ->setDescription($this->translator->trans('huh_video.video.'.$event->getVideo()::getType().'.privacy.text')) + ->setDescription($this->translator->trans('huh_video.video.' . $event->getVideo()::getType() . '.privacy.text')) ->setShowSplashImage(true) ->setShowPreview(true) ->setSplashImage($splashImage) @@ -84,18 +81,18 @@ public function afterRenderPlayer(AfterRenderPlayerEvent $event) )); } - public static function getSubscribedServices() + public static function getSubscribedServices(): array { $services = []; if (class_exists(ProtectedCodeGenerator::class)) { - $services[] = '?'.ProtectedCodeGenerator::class; + $services[] = '?' . ProtectedCodeGenerator::class; } return $services; } - protected function isPrivacyCenterEnabled(PageModel $rootPage = null) + protected function isPrivacyCenterEnabled(?PageModel $rootPage = null): bool { $isPrivacyCenterEnabled = false; @@ -106,4 +103,18 @@ protected function isPrivacyCenterEnabled(PageModel $rootPage = null) return $isPrivacyCenterEnabled; } + + public function onFieldsMceLocalStorageAttribute($dc): array + { + $attributes = TrackingObjectModel::findAll(); + $options = []; + + foreach ($attributes as $attribute) { + $options[$attribute->id] = $attribute->title . ' (ID: ' . $attribute->id . ')'; + } + + natcasesort($options); + + return $options; + } } diff --git a/src/EventListener/SqlGetDataListener.php b/src/EventListener/SqlGetDataListener.php index 6761a8b..95acc5c 100644 --- a/src/EventListener/SqlGetDataListener.php +++ b/src/EventListener/SqlGetDataListener.php @@ -8,18 +8,15 @@ namespace HeimrichHannot\VideoBundle\EventListener; -use Contao\CoreBundle\ServiceAnnotation\Hook; +use Contao\CoreBundle\DependencyInjection\Attribute\AsHook; +use HeimrichHannot\MultiColumnEditorBundle\HeimrichHannotContaoMultiColumnEditorBundle; -/** - * @Hook("sqlGetFromDca") - */ +#[AsHook('sqlGetFromDca')] class SqlGetDataListener { - private array $bundleConfig; - - public function __construct(array $bundleConfig) - { - $this->bundleConfig = $bundleConfig; + public function __construct( + private readonly array $bundleConfig, + ) { } public function __invoke($sqlDcaData) @@ -33,7 +30,7 @@ protected function enablePrivacyCenterSupport($sqlDcaData) return $sqlDcaData; } - if (!class_exists('HeimrichHannot\MultiColumnEditorBundle\HeimrichHannotContaoMultiColumnEditorBundle')) { + if (!class_exists(HeimrichHannotContaoMultiColumnEditorBundle::class)) { trigger_error( 'HeimrichHannotContaoMultiColumnEditorBundle not found. Multi Column Editor bundle is needed for privacy center integration.', \E_USER_WARNING); diff --git a/src/Generator/DcaFieldGenerator.php b/src/Generator/DcaFieldGenerator.php index e701731..0be3cad 100644 --- a/src/Generator/DcaFieldGenerator.php +++ b/src/Generator/DcaFieldGenerator.php @@ -12,20 +12,16 @@ use Contao\DataContainer; use Contao\System; use HeimrichHannot\VideoBundle\Collection\VideoProviderCollection; -use HeimrichHannot\VideoBundle\DataContainer\VideoFieldContainer; use HeimrichHannot\VideoBundle\EventListener\Dca\ModifiyVideoPaletteListener; use HeimrichHannot\VideoBundle\EventListener\Dca\OnMediaQueryOptionCallbackListener; class DcaFieldGenerator { - const PALETTE_VIDEO = 'videoProvider'; - const PALETTE_PLAYER = 'videoFullsize,videoAutoplay'; + public const PALETTE_VIDEO = 'videoProvider'; + public const PALETTE_PLAYER = 'videoFullsize,videoAutoplay'; /** * Update dca for video bundle. Returns the string containing a legend and the selector field for the video subpalette. - * - * @param string $table - * @return string */ public static function addSingleLegendPalette(string $table): string { @@ -37,7 +33,7 @@ public static function addSingleLegendPalette(string $table): string $dca['config']['onload_callback'][] = [ModifiyVideoPaletteListener::class, 'updateVideoPaletteWithoutLegend']; $palette = '{video_legend},addVideo;'; - $dca['subpalettes']['addVideo'] = static::PALETTE_VIDEO.','.static::PALETTE_PLAYER; + $dca['subpalettes']['addVideo'] = static::PALETTE_VIDEO . ',' . static::PALETTE_PLAYER; $dca['palettes']['__selector__'][] = 'addVideo'; static::addSubpalettes($dca); @@ -46,7 +42,9 @@ public static function addSingleLegendPalette(string $table): string 'label' => &$GLOBALS['TL_LANG']['tl_content']['addVideo'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['submitOnChange' => true], + 'eval' => [ + 'submitOnChange' => true, + ], 'sql' => "char(1) NOT NULL default ''", ], ]; @@ -70,8 +68,6 @@ public static function addSubpalettes(array &$dca): void /** * Return the video bundle dca fields. - * - * @return array */ public static function getVideoFields(array $dca = []): array { @@ -87,35 +83,49 @@ public static function getVideoFields(array $dca = []): array return System::getContainer()->get(VideoProviderCollection::class)->getVideoProvider(); }, 'reference' => &$GLOBALS['TL_LANG']['tl_content']['reference']['videoProvider'], - 'eval' => ['submitOnChange' => true, 'maxlength' => 64, 'tl_class' => 'w50', 'includeBlankOption' => true], + 'eval' => [ + 'submitOnChange' => true, + 'maxlength' => 64, + 'tl_class' => 'w50', + 'includeBlankOption' => true, + ], 'sql' => "varchar(64) NOT NULL default ''", ], 'addPreviewImage' => [ 'label' => &$GLOBALS['TL_LANG']['tl_content']['addPreviewImage'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['submitOnChange' => true, 'tl_class' => 'clr'], + 'eval' => [ + 'submitOnChange' => true, + 'tl_class' => 'clr', + ], 'sql' => "char(1) NOT NULL default ''", ], 'addPlayButton' => [ 'label' => &$GLOBALS['TL_LANG']['tl_content']['addPlayButton'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50'], + 'eval' => [ + 'tl_class' => 'w50', + ], 'sql' => "char(1) NOT NULL default ''", ], 'videoRemoveControls' => [ 'label' => &$GLOBALS['TL_LANG']['tl_content']['videoRemoveControls'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50'], + 'eval' => [ + 'tl_class' => 'w50', + ], 'sql' => "char(1) NOT NULL default ''", ], 'videoLoop' => [ 'label' => &$GLOBALS['TL_LANG']['tl_content']['videoLoop'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50'], + 'eval' => [ + 'tl_class' => 'w50', + ], 'sql' => "char(1) NOT NULL default ''", ], 'videoDuration' => [ @@ -125,28 +135,37 @@ public static function getVideoFields(array $dca = []): array 'sorting' => true, 'flag' => 1, 'inputType' => 'text', - 'eval' => ['maxlength' => 255, 'tl_class' => 'w50 clr'], + 'eval' => [ + 'maxlength' => 255, + 'tl_class' => 'w50 clr', + ], 'sql' => "varchar(255) NOT NULL default ''", ], 'videoShowRelated' => [ 'label' => &$GLOBALS['TL_LANG']['tl_content']['videoShowRelated'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50 clr'], + 'eval' => [ + 'tl_class' => 'w50 clr', + ], 'sql' => "char(1) NOT NULL default ''", ], 'ytModestBranding' => [ 'label' => &$GLOBALS['TL_LANG']['tl_content']['ytModestBranding'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50'], + 'eval' => [ + 'tl_class' => 'w50', + ], 'sql' => "char(1) NOT NULL default ''", ], 'ytShowInfo' => [ 'label' => &$GLOBALS['TL_LANG']['tl_content']['ytShowInfo'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50'], + 'eval' => [ + 'tl_class' => 'w50', + ], 'sql' => "char(1) NOT NULL default ''", ], 'videoLinkText' => [ @@ -157,21 +176,29 @@ public static function getVideoFields(array $dca = []): array 'options_callback' => function (DataContainer $dc) { return System::getContainer()->get('huh.utils.choice.message')->getCachedChoices('huh_video.fields.videoLinkText'); }, - 'eval' => ['maxlength' => 255, 'tl_class' => 'w50'], + 'eval' => [ + 'maxlength' => 255, + 'tl_class' => 'w50', + ], 'sql' => "varchar(255) NOT NULL default ''", ], 'videoFullsize' => [ 'label' => &$GLOBALS['TL_LANG']['tl_content']['videoFullsize'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50 clr', 'submitOnChange' => true], + 'eval' => [ + 'tl_class' => 'w50 clr', + 'submitOnChange' => true, + ], 'sql' => "char(1) NOT NULL default ''", ], 'videoAutoplay' => [ 'label' => &$GLOBALS['TL_LANG']['tl_content']['videoAutoplay'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => ['tl_class' => 'w50'], + 'eval' => [ + 'tl_class' => 'w50', + ], 'sql' => "char(1) NOT NULL default ''", ], 'videoSRC' => [ @@ -242,7 +269,7 @@ public static function getVideoFields(array $dca = []): array 'groupStyle' => 'width: 48%', ], 'options_callback' => function (DataContainer $dc) { - return System::getLanguages(true); + return System::getContainer()->get('contao.intl.locales')->getEnabledLocales(null, true); }, ], ], @@ -255,7 +282,10 @@ public static function getVideoFields(array $dca = []): array 'exclude' => true, 'search' => true, 'inputType' => 'textarea', - 'eval' => ['tl_class' => 'long clr', 'mandatory' => false], + 'eval' => [ + 'tl_class' => 'long clr', + 'mandatory' => false, + ], 'sql' => 'text NULL', ], 'transcriptedYoutube' => [ @@ -263,7 +293,10 @@ public static function getVideoFields(array $dca = []): array 'exclude' => true, 'search' => true, 'inputType' => 'text', - 'eval' => ['decodeEntities' => true, 'tl_class' => 'w50'], + 'eval' => [ + 'decodeEntities' => true, + 'tl_class' => 'w50', + ], 'save_callback' => [ ['tl_content', 'extractYouTubeId'], ], @@ -274,7 +307,10 @@ public static function getVideoFields(array $dca = []): array 'exclude' => true, 'search' => true, 'inputType' => 'text', - 'eval' => ['decodeEntities' => true, 'tl_class' => 'w50'], + 'eval' => [ + 'decodeEntities' => true, + 'tl_class' => 'w50', + ], 'save_callback' => [ ['tl_content', 'extractVimeoId'], ], diff --git a/src/Generator/VideoGenerator.php b/src/Generator/VideoGenerator.php index d5f1833..574b949 100644 --- a/src/Generator/VideoGenerator.php +++ b/src/Generator/VideoGenerator.php @@ -10,11 +10,16 @@ use Contao\BackendTemplate; use Contao\Config; +use Contao\ContentModel; +use Contao\CoreBundle\Image\Studio\Studio; +use Contao\CoreBundle\String\HtmlAttributes; use Contao\FilesModel; use Contao\Frontend; +use Contao\FrontendTemplate; use Contao\PageModel; -use HeimrichHannot\UtilsBundle\Image\ImageUtil; -use HeimrichHannot\UtilsBundle\Template\TemplateUtil; +use Contao\StringUtil; +use HeimrichHannot\UtilsBundle\Util\HtmlUtil\GenerateDataAttributesStringArrayHandling; +use HeimrichHannot\UtilsBundle\Util\HtmlUtil\GenerateDataAttributesStringOptions; use HeimrichHannot\UtilsBundle\Util\Utils; use HeimrichHannot\VideoBundle\Controller\ContentElement\ExtendedVideoElementController; use HeimrichHannot\VideoBundle\Event\AfterRenderPlayerEvent; @@ -26,47 +31,20 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Error\SyntaxError; class VideoGenerator { - /** - * @var Environment - */ - private $twig; - /** - * @var ImageUtil - */ - private $imageUtil; - /** - * @var array - */ - private $bundleConfig; - /** - * @var TranslatorInterface - */ - private $translator; - /** - * @var TemplateUtil - */ - private $templateUtil; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - private Utils $utils; - - /** - * VideoGenerator constructor. - */ - public function __construct(Environment $twig, ImageUtil $imageUtil, array $bundleConfig, TranslatorInterface $translator, TemplateUtil $templateUtil, EventDispatcherInterface $eventDispatcher, Utils $utils) - { - $this->twig = $twig; - $this->imageUtil = $imageUtil; - $this->bundleConfig = $bundleConfig; - $this->translator = $translator; - $this->templateUtil = $templateUtil; - $this->eventDispatcher = $eventDispatcher; - $this->utils = $utils; + public function __construct( + private readonly Environment $twig, + private array $bundleConfig, + private readonly TranslatorInterface $translator, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly Utils $utils, + private readonly Studio $studio, + ) { } /** @@ -74,14 +52,13 @@ public function __construct(Environment $twig, ImageUtil $imageUtil, array $bund * - ignoreFullsize: (bool) Ignore the video fullsize property * - rootPage: (PageModel) Set the root page instead of determine it. * - * @throws \Twig\Error\LoaderError - * @throws \Twig\Error\RuntimeError - * @throws \Twig\Error\SyntaxError + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ public function generate(VideoInterface $video, $parent, array $options = []): string { - if ($this->utils->container()->isBackend()) - { + if ($this->utils->container()->isBackend()) { $objTemplate = new BackendTemplate('be_wildcard'); $objTemplate->wildcard = '### ' . $GLOBALS['TL_LANG']['CTE'][ExtendedVideoElementController::TYPE][0] . ' ###'; @@ -90,11 +67,11 @@ public function generate(VideoInterface $video, $parent, array $options = []): s if (isset($options['rootPage'])) { if (!$options['rootPage'] instanceof PageModel) { - throw new \InvalidArgumentException("Option rootPage only allows \Contao\PageModel instances. Input was ".\get_class($options['rootPage'])); + throw new \InvalidArgumentException("Option rootPage only allows \Contao\PageModel instances. Input was " . $options['rootPage']::class); } if ('root' === $options['rootPage']->type) { - throw new \InvalidArgumentException("Option rootPage only allows PageModel instances of type 'root'. Type ".$options['rootPage']->type.' given.'); + throw new \InvalidArgumentException("Option rootPage only allows PageModel instances of type 'root'. Type " . $options['rootPage']->type . ' given.'); } $rootPage = $options['rootPage']; } else { @@ -105,7 +82,7 @@ public function generate(VideoInterface $video, $parent, array $options = []): s $context['uniqueId'] = uniqid(); if ($video instanceof PreviewImageInterface) { - $this->generatePreviewImage($video, $context); + $this->generatePreviewImage($video, $context, $parent); } if ($this->isNoCookiesEnabled($rootPage) && $video instanceof NoCookieUrlInterface) { @@ -118,34 +95,31 @@ public function generate(VideoInterface $video, $parent, array $options = []): s $isPrivacyNoticeEnabled = $this->isPrivacyNoticeEnabled($rootPage); - $context['dataAttributes'] = [ - 'privacyMode' => $isPrivacyNoticeEnabled, - 'showPlayButton' => $context['playButton'], - 'toggleVideo' => !empty($context['secondarySrc']), - ]; + $attrs = new HtmlAttributes(); + $attrs->set('data-privacy-mode', $isPrivacyNoticeEnabled); + $attrs->set('data-show-play-button', $context['playButton']); + $attrs->set('data-toggle-video', !empty($context['secondarySrc'])); if ($isPrivacyNoticeEnabled) { $context['privacyNotice'] = $this->generatePrivacyNote($video, $context, $rootPage); - $context['dataAttributes']['privacyModalContent'] = htmlentities($context['privacyNotice']); + $attrs->set('data-privacy-modal-content', $context['privacyNotice']); } if ($video instanceof ExternalElementInterface && empty($context['secondarySrc'])) { $context['videoAriaLabel'] = $this->translator->trans('huh_video.template.accessibility.iframeTitle'); - $context['dataAttributes']['element'] = [ + + $attrs->set('data-element', json_encode([ 'type' => $video->videoElementType(), 'attributes' => $video->videoElementAttributes($context), - ]; + ])); } + $context['dataAttributes'] = $attrs; $event = $this->eventDispatcher->dispatch( new BeforeRenderPlayerEvent($video, $context, $parent, $rootPage, $options), BeforeRenderPlayerEvent::NAME); $context = $event->getContext(); - $context['dataAttributes'] = $this->utils->html()->generateDataAttributesString( - $context['dataAttributes'], - ['array_handling' => 'encode'] - ); $videoBuffer = $this->twig->render($event->getVideo()->getTemplate(), $context); @@ -165,42 +139,44 @@ public function generate(VideoInterface $video, $parent, array $options = []): s if ((!isset($event->getOptions()['ignoreFullsize']) || true !== $event->getOptions()['ignoreFullsize']) && $event->getVideo()->isFullsize()) { $context['videoplayer'] = $videoBuffer; - $template = $this->getFullsizeTemplate($event->getRootPage()); - $videoBuffer = $this->twig->render($template, $context); + $templateName = $this->getFullsizeTemplate($event->getRootPage()); + + $template = new FrontendTemplate($templateName); + $template->setData($context); + + $videoBuffer = $template->parse(); if (Config::get('debugMode')) { - $videoBuffer = "\n\n$videoBuffer\n\n"; + $videoBuffer = "\n\n$videoBuffer\n\n"; } } return $videoBuffer; } - public function getFullsizeTemplate(PageModel $rootPage = null) + public function getFullsizeTemplate(?PageModel $rootPage = null): string { - $template = 'videofullsize_default'; + $template = 'huh_video/fullsize'; if ($rootPage && $rootPage->videofullsizeTemplate) { $template = $rootPage->videofullsizeTemplate; } - $template = $this->templateUtil->getTemplate($template); return $template; } - public function getPrivacyTemplate(PageModel $rootPage = null) + public function getPrivacyTemplate(?PageModel $rootPage = null): string { - $template = 'videoprivacy_default'; + $template = 'huh_video/privacy'; if ($rootPage && $rootPage->videoprivacyTemplate) { $template = $rootPage->videoprivacyTemplate; } - $template = $this->templateUtil->getTemplate($template); return $template; } - public function generatePreviewImage(PreviewImageInterface $video, array &$context): void + public function generatePreviewImage(PreviewImageInterface $video, array &$context, mixed $parent): void { if (!$video->hasPreviewImage()) { unset($context['previewImage']); @@ -210,7 +186,7 @@ public function generatePreviewImage(PreviewImageInterface $video, array &$conte $imageModel = FilesModel::findByUuid($video->getPreviewImage()); - //TODO: Load image from external source + // TODO: Load image from external source if (!$imageModel) { unset($context['previewImage']); @@ -218,32 +194,37 @@ public function generatePreviewImage(PreviewImageInterface $video, array &$conte return; } - $imageData = []; - $this->imageUtil->addToTemplateData( - 'singleSRC', - 'addImage', - $imageData, - [ - 'singleSRC' => $imageModel->path, - 'addImage' => true, -// 'size' => $this->getConfig()->getSize(), -// 'alt' => $this->getConfig()->getYoutube(), - ] - ); - $context['previewImage'] = $imageData; + $size = null; + if ($parent instanceof ContentModel) { + $size = StringUtil::deserialize($parent->size, true); + } + + $figureBuilder = $this->studio->createFigureBuilder(); + + $figureBuilder + ->fromFilesModel($imageModel) + ->setSize($size) + ; + + $context['previewImage'] = $figureBuilder->build(); } - protected function generatePrivacyNote(VideoInterface $video, array &$videoContext, PageModel $rootPage = null): string + protected function generatePrivacyNote(VideoInterface $video, array &$videoContext, ?PageModel $rootPage = null): string { - $context['headline'] = $this->translator->trans('huh_video.video.'.$video::getType().'.privacy.headline'); - $context['text'] = $this->translator->trans('huh_video.video.'.$video::getType().'.privacy.text'); - $context['checkbox'] = $this->translator->trans('huh_video.video.'.$video::getType().'.privacy.checkbox', ['%host%' => \Contao\Environment::get('host')]); + $context['headline'] = $this->translator->trans('huh_video.video.' . $video::getType() . '.privacy.headline'); + $context['text'] = $this->translator->trans('huh_video.video.' . $video::getType() . '.privacy.text'); + $context['checkbox'] = $this->translator->trans('huh_video.video.' . $video::getType() . '.privacy.checkbox', [ + '%host%' => \Contao\Environment::get('host'), + ]); $context['videoContext'] = $videoContext; - return $this->twig->render($this->getPrivacyTemplate($rootPage), $context); + $template = new FrontendTemplate($this->getPrivacyTemplate($rootPage)); + $template->setData($context); + + return $template->parse(); } - protected function isNoCookiesEnabled(PageModel $rootPage = null) + protected function isNoCookiesEnabled(?PageModel $rootPage = null) { $noCookiesEnabled = false; @@ -258,7 +239,7 @@ protected function isNoCookiesEnabled(PageModel $rootPage = null) return $noCookiesEnabled; } - protected function isPrivacyNoticeEnabled(PageModel $rootPage = null) + protected function isPrivacyNoticeEnabled(?PageModel $rootPage = null) { $isPrivacyNoticeEnabled = false; diff --git a/src/HeimrichHannotVideoBundle.php b/src/HeimrichHannotVideoBundle.php index 8f23101..9090718 100644 --- a/src/HeimrichHannotVideoBundle.php +++ b/src/HeimrichHannotVideoBundle.php @@ -17,4 +17,9 @@ public function getContainerExtension(): HeimrichHannotVideoExtension { return new HeimrichHannotVideoExtension(); } + + public function getPath(): string + { + return \dirname(__DIR__); + } } diff --git a/src/Resources/config/routing.yml b/src/Resources/config/routing.yml deleted file mode 100644 index 11b669a..0000000 --- a/src/Resources/config/routing.yml +++ /dev/null @@ -1,3 +0,0 @@ -huh_video: - resource: "@HeimrichHannotVideoBundle/Controller/" - type: annotation \ No newline at end of file diff --git a/src/Resources/public/assets/alertify.css b/src/Resources/public/assets/alertify.css deleted file mode 100644 index a99c5b4..0000000 --- a/src/Resources/public/assets/alertify.css +++ /dev/null @@ -1 +0,0 @@ -.alertify .ajs-dimmer{margin:0;background-color:#252525;opacity:.5}.alertify .ajs-dimmer,.alertify .ajs-modal{position:fixed;z-index:1981;top:0;right:0;bottom:0;left:0;padding:0}.alertify .ajs-modal{overflow-y:auto}.alertify .ajs-dialog{position:relative;margin:5% auto;min-height:110px;max-width:500px;padding:24px 24px 0;outline:0;background-color:#fff}.alertify .ajs-dialog.ajs-capture:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;display:block;z-index:1}.alertify .ajs-reset{position:absolute!important;display:inline!important;width:0!important;height:0!important;opacity:0!important}.alertify .ajs-commands{position:absolute;right:4px;margin:-14px 24px 0 0;z-index:2}.alertify .ajs-commands button{display:none;width:10px;height:10px;margin-left:10px;padding:10px;border:0;background-color:transparent;background-repeat:no-repeat;background-position:50%;cursor:pointer}.alertify .ajs-commands button.ajs-close{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAh0lEQVQYlY2QsQ0EIQwEB9cBAR1CJUaI/gigDnwR6NBL/7/xWLNrZ2b8EwGotVpr7eOitWa1VjugiNB7R1UPrKrWe0dEAHBbXUqxMQbeewDmnHjvyTm7C3zDwAUd9c63YQdUVdu6EAJzzquz7HXvTiklt+H9DQFYaxFjvDqllFyMkbXWvfpXHjJrWFgdBq/hAAAAAElFTkSuQmCC)}.alertify .ajs-commands button.ajs-maximize{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAOUlEQVQYlWP8//8/AzGAhYGBgaG4uBiv6t7eXkYmooxjYGAgWiELsvHYFMCcRX2rSXcjoSBiJDbAAeD+EGu+8BZcAAAAAElFTkSuQmCC)}.alertify .ajs-header{margin:-24px -24px 0;padding:16px 24px;background-color:#fff}.alertify .ajs-body{min-height:56px}.alertify .ajs-body .ajs-content{padding:16px 24px 16px 16px}.alertify .ajs-footer{padding:4px;margin-left:-24px;margin-right:-24px;min-height:43px;background-color:#fff}.alertify .ajs-footer .ajs-buttons.ajs-primary{text-align:right}.alertify .ajs-footer .ajs-buttons.ajs-primary .ajs-button{margin:4px}.alertify .ajs-footer .ajs-buttons.ajs-auxiliary{float:left;clear:none;text-align:left}.alertify .ajs-footer .ajs-buttons.ajs-auxiliary .ajs-button{margin:4px}.alertify .ajs-footer .ajs-buttons .ajs-button{min-width:88px;min-height:35px}.alertify .ajs-handle{position:absolute;display:none;width:10px;height:10px;right:0;bottom:0;z-index:1;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMS8xNEDQYmMAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAQ0lEQVQYlaXNMQoAIAxD0dT7H657l0KX3iJuUlBUNOsPPCGJm7VDp6ryeMxMuDsAQH7owW3pyn3RS26iKxERMLN3ugOaAkaL3sWVigAAAABJRU5ErkJggg==);-webkit-transform:scaleX(1);transform:scaleX(1);cursor:se-resize}.alertify.ajs-no-overflow .ajs-body .ajs-content{overflow:hidden!important}.alertify.ajs-no-padding.ajs-maximized .ajs-body .ajs-content{left:0;right:0;padding:0}.alertify.ajs-no-padding:not(.ajs-maximized) .ajs-body{margin-left:-24px;margin-right:-24px}.alertify.ajs-no-padding:not(.ajs-maximized) .ajs-body .ajs-content{padding:0}.alertify.ajs-no-padding.ajs-resizable .ajs-body .ajs-content{left:0;right:0}.alertify.ajs-closable .ajs-commands button.ajs-close,.alertify.ajs-maximizable .ajs-commands button.ajs-maximize,.alertify.ajs-maximizable .ajs-commands button.ajs-restore{display:inline-block}.alertify.ajs-maximized .ajs-dialog{width:100%!important;height:100%!important;max-width:none!important;margin:0 auto!important;top:0!important;left:0!important}.alertify.ajs-maximized.ajs-modeless .ajs-modal{position:fixed!important;min-height:100%!important;max-height:none!important;margin:0!important}.alertify.ajs-maximized .ajs-commands button.ajs-maximize{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAASklEQVQYlZWQ0QkAMQhDtXRincOZX78KVtrDCwgqJNEoIB3MPLj7lRUROlpyVXGzby6zWuY+kz6tj5sBMTMAyVV3/595RbOh3cAXsww1raeiOcoAAAAASUVORK5CYII=)}.alertify.ajs-maximized .ajs-dialog,.alertify.ajs-resizable .ajs-dialog{padding:0}.alertify.ajs-maximized .ajs-commands,.alertify.ajs-resizable .ajs-commands{margin:14px 24px 0 0}.alertify.ajs-maximized .ajs-header,.alertify.ajs-resizable .ajs-header{position:absolute;top:0;left:0;right:0;margin:0;padding:16px 24px}.alertify.ajs-maximized .ajs-body,.alertify.ajs-resizable .ajs-body{min-height:224px;display:inline-block}.alertify.ajs-maximized .ajs-body .ajs-content,.alertify.ajs-resizable .ajs-body .ajs-content{position:absolute;top:50px;right:24px;bottom:50px;left:24px;overflow:auto}.alertify.ajs-maximized .ajs-footer,.alertify.ajs-resizable .ajs-footer{position:absolute;left:0;right:0;bottom:0;margin:0}.alertify.ajs-resizable:not(.ajs-maximized) .ajs-dialog{min-width:548px}.alertify.ajs-resizable:not(.ajs-maximized) .ajs-handle{display:block}.alertify.ajs-movable:not(.ajs-maximized) .ajs-header{cursor:move}.alertify.ajs-modeless .ajs-dimmer,.alertify.ajs-modeless .ajs-reset{display:none}.alertify.ajs-modeless .ajs-modal{overflow:visible;max-width:none;max-height:0}.alertify.ajs-modeless.ajs-pinnable .ajs-commands button.ajs-pin{display:inline-block;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAQklEQVQYlcWPMQ4AIAwCqU9u38GbcbHRWN1MvKQDhQFMEpKImGJA0gCgnYw0V0rwxseg5erT4oSkQVI5d9f+e9+xA0NbLpWfitPXAAAAAElFTkSuQmCC)}.alertify.ajs-modeless.ajs-unpinned .ajs-modal{position:absolute}.alertify.ajs-modeless.ajs-unpinned .ajs-commands button.ajs-pin{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMy8xNOrZqugAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAO0lEQVQYlWP8//8/AzGAiShV6AqLi4txGs+CLoBLMYbC3t5eRmyaWfBZhwwYkX2NTxPRvibKjRhW4wMAhxkYGbLu3pEAAAAASUVORK5CYII=)}.alertify.ajs-modeless:not(.ajs-unpinned) .ajs-body{max-height:500px;overflow:auto}.alertify.ajs-basic .ajs-header{opacity:0}.alertify.ajs-basic .ajs-footer{visibility:hidden}.alertify.ajs-frameless .ajs-header{position:absolute;top:0;left:0;right:0;min-height:60px;margin:0;padding:0;opacity:0;z-index:1}.alertify.ajs-frameless .ajs-footer{display:none}.alertify.ajs-frameless .ajs-body .ajs-content{position:absolute;top:0;right:0;bottom:0;left:0}.alertify.ajs-frameless:not(.ajs-resizable) .ajs-dialog{padding-top:0}.alertify.ajs-frameless:not(.ajs-resizable) .ajs-dialog .ajs-commands{margin-top:0}.ajs-no-overflow{overflow:hidden!important;outline:none}.ajs-no-overflow.ajs-fixed{position:fixed;top:0;right:0;bottom:0;left:0;overflow-y:scroll!important}.ajs-no-selection,.ajs-no-selection *{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media screen and (max-width:568px){.alertify .ajs-dialog{min-width:150px}.alertify:not(.ajs-maximized) .ajs-modal{padding:0 5%}.alertify:not(.ajs-maximized).ajs-resizable .ajs-dialog{min-width:0;min-width:auto}}@-moz-document url-prefix(){.alertify button:focus{outline:1px dotted #3593d2}}.alertify .ajs-dimmer,.alertify .ajs-modal{-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-transition-property:opacity,visibility;transition-property:opacity,visibility;-webkit-transition-timing-function:linear;transition-timing-function:linear;-webkit-transition-duration:.25s;transition-duration:.25s}.alertify.ajs-hidden .ajs-dimmer,.alertify.ajs-hidden .ajs-modal{visibility:hidden;opacity:0}.alertify.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-duration:.5s;animation-duration:.5s}.alertify.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-duration:.25s;animation-duration:.25s}.alertify .ajs-dialog.ajs-shake{-webkit-animation-name:ajs-shake;animation-name:ajs-shake;-webkit-animation-duration:.1s;animation-duration:.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both}@-webkit-keyframes ajs-shake{0%,to{-webkit-transform:translateZ(0);transform:translateZ(0)}10%,30%,50%,70%,90%{-webkit-transform:translate3d(-10px,0,0);transform:translate3d(-10px,0,0)}20%,40%,60%,80%{-webkit-transform:translate3d(10px,0,0);transform:translate3d(10px,0,0)}}@keyframes ajs-shake{0%,to{-webkit-transform:translateZ(0);transform:translateZ(0)}10%,30%,50%,70%,90%{-webkit-transform:translate3d(-10px,0,0);transform:translate3d(-10px,0,0)}20%,40%,60%,80%{-webkit-transform:translate3d(10px,0,0);transform:translate3d(10px,0,0)}}.alertify.ajs-slide.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-slideIn;animation-name:ajs-slideIn;-webkit-animation-timing-function:cubic-bezier(.175,.885,.32,1.275);animation-timing-function:cubic-bezier(.175,.885,.32,1.275)}.alertify.ajs-slide.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-slideOut;animation-name:ajs-slideOut;-webkit-animation-timing-function:cubic-bezier(.6,-.28,.735,.045);animation-timing-function:cubic-bezier(.6,-.28,.735,.045)}.alertify.ajs-zoom.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-zoomIn;animation-name:ajs-zoomIn}.alertify.ajs-zoom.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-zoomOut;animation-name:ajs-zoomOut}.alertify.ajs-fade.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-fadeIn;animation-name:ajs-fadeIn}.alertify.ajs-fade.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-fadeOut;animation-name:ajs-fadeOut}.alertify.ajs-pulse.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-pulseIn;animation-name:ajs-pulseIn}.alertify.ajs-pulse.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-pulseOut;animation-name:ajs-pulseOut}.alertify.ajs-flipx.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-flipInX;animation-name:ajs-flipInX}.alertify.ajs-flipx.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-flipOutX;animation-name:ajs-flipOutX}.alertify.ajs-flipy.ajs-in:not(.ajs-hidden) .ajs-dialog{-webkit-animation-name:ajs-flipInY;animation-name:ajs-flipInY}.alertify.ajs-flipy.ajs-out.ajs-hidden .ajs-dialog{-webkit-animation-name:ajs-flipOutY;animation-name:ajs-flipOutY}@-webkit-keyframes ajs-pulseIn{0%,20%,40%,60%,80%,to{-webkit-transition-timing-function:cubic-bezier(.215,.61,.355,1);transition-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}20%{-webkit-transform:scale3d(1.1,1.1,1.1);transform:scale3d(1.1,1.1,1.1)}40%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}60%{opacity:1;-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}80%{-webkit-transform:scale3d(.97,.97,.97);transform:scale3d(.97,.97,.97)}to{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}}@keyframes ajs-pulseIn{0%,20%,40%,60%,80%,to{-webkit-transition-timing-function:cubic-bezier(.215,.61,.355,1);transition-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}20%{-webkit-transform:scale3d(1.1,1.1,1.1);transform:scale3d(1.1,1.1,1.1)}40%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}60%{opacity:1;-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}80%{-webkit-transform:scale3d(.97,.97,.97);transform:scale3d(.97,.97,.97)}to{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}}@-webkit-keyframes ajs-pulseOut{20%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}50%,55%{opacity:1;-webkit-transform:scale3d(1.1,1.1,1.1);transform:scale3d(1.1,1.1,1.1)}to{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}}@keyframes ajs-pulseOut{20%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}50%,55%{opacity:1;-webkit-transform:scale3d(1.1,1.1,1.1);transform:scale3d(1.1,1.1,1.1)}to{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}}@-webkit-keyframes ajs-zoomIn{0%{opacity:0;-webkit-transform:scale3d(.25,.25,.25);transform:scale3d(.25,.25,.25)}to{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}}@keyframes ajs-zoomIn{0%{opacity:0;-webkit-transform:scale3d(.25,.25,.25);transform:scale3d(.25,.25,.25)}to{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}}@-webkit-keyframes ajs-zoomOut{0%{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}to{opacity:0;-webkit-transform:scale3d(.25,.25,.25);transform:scale3d(.25,.25,.25)}}@keyframes ajs-zoomOut{0%{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}to{opacity:0;-webkit-transform:scale3d(.25,.25,.25);transform:scale3d(.25,.25,.25)}}@-webkit-keyframes ajs-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes ajs-fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes ajs-fadeOut{0%{opacity:1}to{opacity:0}}@keyframes ajs-fadeOut{0%{opacity:1}to{opacity:0}}@-webkit-keyframes ajs-flipInX{0%{-webkit-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in;opacity:0}40%{-webkit-transform:perspective(400px) rotateX(-20deg);transform:perspective(400px) rotateX(-20deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}60%{-webkit-transform:perspective(400px) rotateX(10deg);transform:perspective(400px) rotateX(10deg);opacity:1}80%{-webkit-transform:perspective(400px) rotateX(-5deg);transform:perspective(400px) rotateX(-5deg)}to{-webkit-transform:perspective(400px);transform:perspective(400px)}}@keyframes ajs-flipInX{0%{-webkit-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in;opacity:0}40%{-webkit-transform:perspective(400px) rotateX(-20deg);transform:perspective(400px) rotateX(-20deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}60%{-webkit-transform:perspective(400px) rotateX(10deg);transform:perspective(400px) rotateX(10deg);opacity:1}80%{-webkit-transform:perspective(400px) rotateX(-5deg);transform:perspective(400px) rotateX(-5deg)}to{-webkit-transform:perspective(400px);transform:perspective(400px)}}@-webkit-keyframes ajs-flipOutX{0%{-webkit-transform:perspective(400px);transform:perspective(400px)}30%{-webkit-transform:perspective(400px) rotateX(-20deg);transform:perspective(400px) rotateX(-20deg);opacity:1}to{-webkit-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);opacity:0}}@keyframes ajs-flipOutX{0%{-webkit-transform:perspective(400px);transform:perspective(400px)}30%{-webkit-transform:perspective(400px) rotateX(-20deg);transform:perspective(400px) rotateX(-20deg);opacity:1}to{-webkit-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);opacity:0}}@-webkit-keyframes ajs-flipInY{0%{-webkit-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in;opacity:0}40%{-webkit-transform:perspective(400px) rotateY(-20deg);transform:perspective(400px) rotateY(-20deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}60%{-webkit-transform:perspective(400px) rotateY(10deg);transform:perspective(400px) rotateY(10deg);opacity:1}80%{-webkit-transform:perspective(400px) rotateY(-5deg);transform:perspective(400px) rotateY(-5deg)}to{-webkit-transform:perspective(400px);transform:perspective(400px)}}@keyframes ajs-flipInY{0%{-webkit-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in;opacity:0}40%{-webkit-transform:perspective(400px) rotateY(-20deg);transform:perspective(400px) rotateY(-20deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}60%{-webkit-transform:perspective(400px) rotateY(10deg);transform:perspective(400px) rotateY(10deg);opacity:1}80%{-webkit-transform:perspective(400px) rotateY(-5deg);transform:perspective(400px) rotateY(-5deg)}to{-webkit-transform:perspective(400px);transform:perspective(400px)}}@-webkit-keyframes ajs-flipOutY{0%{-webkit-transform:perspective(400px);transform:perspective(400px)}30%{-webkit-transform:perspective(400px) rotateY(-15deg);transform:perspective(400px) rotateY(-15deg);opacity:1}to{-webkit-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);opacity:0}}@keyframes ajs-flipOutY{0%{-webkit-transform:perspective(400px);transform:perspective(400px)}30%{-webkit-transform:perspective(400px) rotateY(-15deg);transform:perspective(400px) rotateY(-15deg);opacity:1}to{-webkit-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);opacity:0}}@-webkit-keyframes ajs-slideIn{0%{margin-top:-100%}to{margin-top:5%}}@keyframes ajs-slideIn{0%{margin-top:-100%}to{margin-top:5%}}@-webkit-keyframes ajs-slideOut{0%{margin-top:5%}to{margin-top:-100%}}@keyframes ajs-slideOut{0%{margin-top:5%}to{margin-top:-100%}}.alertify-notifier{position:fixed;width:0;overflow:visible;z-index:1982}.alertify-notifier,.alertify-notifier .ajs-message{-webkit-transform:translateZ(0);transform:translateZ(0)}.alertify-notifier .ajs-message{position:relative;width:260px;max-height:0;padding:0;opacity:0;margin:0;-webkit-transition-duration:.25s;transition-duration:.25s;-webkit-transition-timing-function:linear;transition-timing-function:linear}.alertify-notifier .ajs-message.ajs-visible{-webkit-transition-duration:.5s;transition-duration:.5s;-webkit-transition-timing-function:cubic-bezier(.175,.885,.32,1.275);transition-timing-function:cubic-bezier(.175,.885,.32,1.275);opacity:1;max-height:100%;padding:15px;margin-top:10px}.alertify-notifier .ajs-message.ajs-success{background:rgba(91,189,114,.95)}.alertify-notifier .ajs-message.ajs-error{background:rgba(217,92,92,.95)}.alertify-notifier .ajs-message.ajs-warning{background:rgba(252,248,215,.95)}.alertify-notifier .ajs-message .ajs-close{position:absolute;top:0;right:0;width:16px;height:16px;cursor:pointer;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAABGdBTUEAALGPC/xhBQAAAFBJREFUGBl1j0EKADEIA+ve/P9f9bh1hEihNBfjVCO1v7RKVqJK4h8gM5cAPR42AkQEpSXPwMTyoi13n5N9YqJehm3Fnr7nL1D0ZEbD5OubGyC7a9gx+9eNAAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:50%;background-color:rgba(0,0,0,.5);border-top-right-radius:2px}.alertify-notifier.ajs-top{top:10px}.alertify-notifier.ajs-bottom{bottom:10px}.alertify-notifier.ajs-right{right:10px}.alertify-notifier.ajs-right .ajs-message{right:-320px}.alertify-notifier.ajs-right .ajs-message.ajs-visible{right:290px}.alertify-notifier.ajs-left{left:10px}.alertify-notifier.ajs-left .ajs-message{left:-300px}.alertify-notifier.ajs-left .ajs-message.ajs-visible{left:0}.alertify-notifier.ajs-center{left:50%}.alertify-notifier.ajs-center .ajs-message{-webkit-transform:translateX(-50%);transform:translateX(-50%)}.alertify-notifier.ajs-center .ajs-message.ajs-visible{left:50%;-webkit-transition-timing-function:cubic-bezier(.57,.43,.1,.65);transition-timing-function:cubic-bezier(.57,.43,.1,.65)}.alertify-notifier.ajs-center.ajs-top .ajs-message{top:-300px}.alertify-notifier.ajs-center.ajs-top .ajs-message.ajs-visible{top:0}.alertify-notifier.ajs-center.ajs-bottom .ajs-message{bottom:-300px}.alertify-notifier.ajs-center.ajs-bottom .ajs-message.ajs-visible{bottom:0}.ajs-no-transition.alertify-notifier .ajs-message,.ajs-no-transition.alertify .ajs-dialog,.ajs-no-transition.alertify .ajs-dimmer,.ajs-no-transition.alertify .ajs-modal{-webkit-transition:none!important;transition:none!important;-webkit-animation:none!important;animation:none!important}@media (prefers-reduced-motion:reduce){.alertify-notifier .ajs-message,.alertify .ajs-dialog,.alertify .ajs-dimmer,.alertify .ajs-modal{-webkit-transition:none!important;transition:none!important;-webkit-animation:none!important;animation:none!important}} \ No newline at end of file diff --git a/src/Resources/public/assets/alertify.js b/src/Resources/public/assets/alertify.js deleted file mode 100644 index 99094e0..0000000 --- a/src/Resources/public/assets/alertify.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([["alertify"],{"+Bga":function(e,t,n){},XAfc:function(e,t,n){var i;!function(n){"use strict";var s=13,o=27,a=112,l=123,r=37,c=39,d=9,u={autoReset:!0,basic:!1,closable:!0,closableByDimmer:!0,invokeOnCloseOff:!1,frameless:!1,defaultFocusOff:!1,maintainFocus:!0,maximizable:!0,modal:!0,movable:!0,moveBounded:!1,overflow:!0,padding:!0,pinnable:!0,pinned:!0,preventBodyShift:!1,resizable:!0,startMaximized:!1,transition:"pulse",transitionOff:!1,tabbable:["button","[href]","input","select","textarea",'[tabindex]:not([tabindex^="-"]):not(:disabled):not(.ajs-reset)'].join(":not(:disabled):not(.ajs-reset),"),notifier:{delay:5,position:"bottom-right",closeButton:!1,classes:{base:"alertify-notifier",prefix:"ajs-",message:"ajs-message",top:"ajs-top",right:"ajs-right",bottom:"ajs-bottom",left:"ajs-left",center:"ajs-center",visible:"ajs-visible",hidden:"ajs-hidden",close:"ajs-close"}},glossary:{title:"AlertifyJS",ok:"OK",cancel:"Cancel",acccpt:"Accept",deny:"Deny",confirm:"Confirm",decline:"Decline",close:"Close",maximize:"Maximize",restore:"Restore"},theme:{input:"ajs-input",ok:"ajs-ok",cancel:"ajs-cancel"},hooks:{preinit:function(){},postinit:function(){}}},m=[];function f(e,t){e.className+=" "+t}function h(e,t){for(var n=e.className.split(" "),i=t.split(" "),s=0;s-1&&n.splice(o,1)}e.className=n.join(" ")}function p(){return"rtl"===n.getComputedStyle(document.body).direction}function v(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop}function b(){return document.documentElement&&document.documentElement.scrollLeft||document.body.scrollLeft}function g(e){for(;e.lastChild;)e.removeChild(e.lastChild)}function y(e){if(null===e)return e;var t;if(Array.isArray(e)){t=[];for(var n=0;n0){for(var n=[],i=0;i-1&&n.navigator.userAgent.indexOf("Chrome")<0,x='',M='',j='',N='',L='',A='',W='',I='',P='',B={primary:'',auxiliary:''},S='',D='',F="ajs-in",R="ajs-out",U="alertify",X="ajs-basic",Y="ajs-capture",J="ajs-closable",q="ajs-fixed",K="ajs-frameless",V="ajs-hidden",G="ajs-maximized",Q="ajs-maximizable",Z="ajs-modeless",$="ajs-movable",ee="ajs-no-selection",te="ajs-no-overflow",ne="ajs-no-padding",ie="ajs-pinnable",se="ajs-",oe="ajs-resizable",ae="ajs-shake",le="ajs-unpinned",re="ajs-no-transition";function ce(e){if(!e.__internal){var t;E.defaults.hooks.preinit(e),delete e.__init,e.__settings||(e.__settings=y(e.settings)),"function"==typeof e.setup?((t=e.setup()).options=t.options||{},t.focus=t.focus||{}):t={buttons:[],focus:{element:null,select:!1},options:{}},"object"!=typeof e.hooks&&(e.hooks={});var n=[];if(Array.isArray(t.buttons))for(var s=0;s=0?(h(document.body,te),he(!1)):e>0&&document.body.className.indexOf(te)<0&&(he(!0),f(document.body,te))}var me="",fe=0;function he(e){E.defaults.preventBodyShift&&(e&&document.documentElement.scrollHeight>document.documentElement.clientHeight?(fe=t,me=n.getComputedStyle(document.body).top,f(document.body,q),document.body.style.top=-t+"px"):e||(t=fe,document.body.style.top=me,h(document.body,q),de()))}function pe(e,t){for(var n=m.indexOf(t)+1;n200&&(ze=e.timeStamp)&&!Te){var n=e.srcElement||e.target;!0===t.get("closableByDimmer")&&n===t.elements.modal&&ge(t)}Te=!1}var je=0,Ee=!1;function Ne(e,t){if(Date.now()-je>200&&(je=Date.now()))for(var n=0;n-1?(Ne(t,(function(e){return e.key===n})),!1):void 0}Ee=!1}function We(e){var t=m[m.length-1],n=e.keyCode;if(n===r||n===c){for(var s=t.__internal.buttons,o=0;oa-1&&i.indexOf(n)>-1)return e.preventDefault(),e.stopPropagation(),Ne(t,(function(e){return e.key===n})),!1}function Ie(e,t){if(t)t.focus();else{var n=e.__internal.focus,i=n.element;switch(typeof n.element){case"number":e.__internal.buttons.length>n.element&&(i=!0===e.get("basic")?e.elements.reset[0]:e.__internal.buttons[n.element].element);break;case"string":i=e.elements.body.querySelector(n.element);break;case"function":i=n.element.call(e)}(!0===e.get("defaultFocusOff")||null==i&&0===e.__internal.buttons.length)&&(i=e.elements.reset[0]),i&&i.focus&&(i.focus(),n.select&&i.select&&i.select())}}function Pe(e,t){if(!t)for(var n=m.length-1;n>-1;n-=1)if(m[n].isModal()){t=m[n];break}if(t&&t.isModal()){var i,s=t.elements.reset[0],o=t.elements.reset[1],a=e.relatedTarget,l=t.elements.root.contains(a),r=e.srcElement||e.target;if(r===s&&!l||r===o&&a===s)return;r===o||r===document.body?i=s:r===s&&a===o?i=Be(t):r===s&&l&&(i=Be(t,!0)),Ie(t,i)}}function Be(e,t){var n=[].slice.call(e.elements.dialog.querySelectorAll(u.tabbable));t&&n.reverse();for(var i=0;ist?t.style.left=it+c+"px":t.offsetWidth>=ot&&(t.style.left=it-c+"px")}}(t,nt.elements.dialog,!nt.get("modal")&&!nt.get("pinned")))}function ct(){if(nt){var e=nt;nt=null,h(document.body,ee),h(e.elements.dialog,Y),Te=!0,z("onresized",e)}}function dt(e){nt=null;var t=e.elements.dialog;"none"===t.style.maxWidth&&(t.style.maxWidth=t.style.minWidth=t.style.width=t.style.height=t.style.minHeight=t.style.left="",it=Number.Nan,st=ot=at=0)}function ut(){for(var e=0;e-1},isPinned:function(){return this.elements.root.className.indexOf(le)<0},maximize:function(){return this.isMaximized()||xe(this),this},restore:function(){return this.isMaximized()&&He(this),this},pin:function(){return this.isPinned()||_e(this),this},unpin:function(){return this.isPinned()&&ke(this),this},bringToFront:function(){return pe(0,this),this},moveTo:function(e,t){if(!isNaN(e)&&!isNaN(t)){z("onmove",this);var n=this.elements.dialog,i=n,s=0,o=0;n.style.left&&(s-=parseInt(n.style.left,10)),n.style.top&&(o-=parseInt(n.style.top,10));do{s+=i.offsetLeft,o+=i.offsetTop}while(i=i.offsetParent);var a=e-s,l=t-o;p()&&(a*=-1),n.style.left=a+"px",n.style.top=l+"px",z("onmoved",this)}return this},resizeTo:function(e,t){var n=parseFloat(e),i=parseFloat(t),s=/(\d*\.\d+|\d+)%/;if(!isNaN(n)&&!isNaN(i)&&!0===this.get("resizable")){z("onresize",this),(""+e).match(s)&&(n=n/100*document.documentElement.clientWidth),(""+t).match(s)&&(i=i/100*document.documentElement.clientHeight);var o=this.elements.dialog;"none"!==o.style.maxWidth&&(o.style.minWidth=(ot=o.offsetWidth)+"px"),o.style.maxWidth="none",o.style.minHeight=this.elements.header.offsetHeight+this.elements.footer.offsetHeight+"px",o.style.width=n+"px",o.style.height=i+"px",z("onresized",this)}return this},setting:function(e,t){var n=this,i=be(this,this.__internal.options,(function(e,t,i){ve(n,e,t,i)}),e,t);if("get"===i.op)return i.found?i.value:void 0!==this.settings?be(this,this.settings,this.settingUpdated||function(){},e,t).value:void 0;if("set"===i.op){if(i.items.length>0)for(var s=this.settingUpdated||function(){},o=0;o0){var t=this;this.__internal.timer=setTimeout((function(){t.dismiss()}),1e3*this.__internal.delay)}return this},setContent:function(e){if("string"==typeof e?(g(this.element),this.element.innerHTML=e):e instanceof n.HTMLElement&&this.element.firstChild!==e&&(g(this.element),this.element.appendChild(e)),this.__internal.closeButton){var t=document.createElement("span");f(t,i.close),t.setAttribute("data-close",!0),this.element.appendChild(t)}return this},dismissOthers:function(){return j.dismissAll(this),this}})}return{setting:function(e,t){if(o(this),void 0===t)return this.__internal[e];switch(e){case"position":this.__internal.position=t,l(this);break;case"delay":this.__internal.delay=t}return this},set:function(e,t){return this.setting(e,t),this},get:function(e){return this.setting(e)},create:function(e,t){o(this);var n=document.createElement("div");return n.className=i.message+("string"==typeof e&&""!==e?" "+i.prefix+e:""),r(n,t)},dismissAll:function(e){for(var n=t.slice(0),i=0;i1&&void 0!==arguments[1]?arguments[1]:"video";o(this,e),l(this,"configuration",void 0),l(this,"previewImageElement",void 0),l(this,"privacyMode",void 0),l(this,"videoContainerElement",void 0),l(this,"wrapperElement",void 0),l(this,"type",void 0),this.wrapperElement=t,this.type=n,this.configuration=this.wrapperElement.dataset,this.privacyMode="privacyMode"in this.configuration,"link"!==n?(this.previewImageElement=this.wrapperElement.querySelector(".video-wrapper .video-thumbnail"),this.videoContainerElement=this.wrapperElement.querySelector(".video-wrapper .video-container"),this.legacyPrivacyCheck(),this.applyPrivacySettingsToVideo(),"toggleVideo"in this.configuration&&this.videoToggle()):this.applyPrivacySettingsToLink()}var t,n,i;return t=e,(n=[{key:"applyPrivacySettingsToVideo",value:function(){var t=this;if(this.privacyMode){if(this.videoContainerElement&&this.videoContainerElement.querySelector(":scope > video"))return void this.showVideo();localStorage.getItem(e.privacyKey)&&this.showVideo(),this.previewImageElement&&this.previewImageElement.addEventListener("click",(function(){return t.privacyDialog(t.previewImageElement,(function(){return t.showVideo()}))}))}else this.showVideo()}},{key:"applyPrivacySettingsToLink",value:function(){var e=this;this.privacyMode||"privacy"in this.configuration&&(this.privacyMode=!0,console.warn("You're using an outdated video fullsize template. Please adjust your template according to the docs. Since version 1.2.0")),this.wrapperElement.addEventListener("click",(function(t){t.preventDefault(),e.privacyMode&&e.privacyDialog(e.wrapperElement,(function(e){return window.open(e.getAttribute("href"))}))}))}},{key:"privacyDialog",value:function(t,n){var i=r.a.confirm().set({labels:this.privacyDialogLabels(),onshow:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onshow",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),document.dispatchEvent(new CustomEvent("huh.video.event.alertify.onshow",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))},defaultFocusOff:!0,onfocus:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onfocus",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),document.dispatchEvent(new CustomEvent("huh.video.event.alertify.onfocus",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))}}),o=null;if("privacyModalContent"in this.configuration)o=this.configuration.privacyModalContent;else{if(!this.previewImageElement||!("privacyHtml"in this.previewImageElement.dataset))return;o=this.previewImageElement.dataset.privacyHtml.replace(/\\"/g,'"')}t||(t=this.previewImageElement,this.previewImageElement||(t=this.wrapperElement)),r.a.confirm(" ",o,(function(){i.elements.content.querySelector("[name="+e.storeDecisionFieldName+"]").checked&&localStorage.setItem(e.privacyKey,!0),t.dispatchEvent(new CustomEvent("huh.video.privacy.accept",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),n(t)}),(function(){t.dispatchEvent(new CustomEvent("huh.video.privacy.cancel",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))}))}},{key:"privacyDialogLabels",value:function(){var e={ok:"Ok",cancel:"Cancel"};return"btnLabelOk"in this.wrapperElement.dataset?e.ok=this.wrapperElement.dataset.btnLabelOk:this.previewImageElement&&"btnPrivacyOk"in this.previewImageElement.dataset&&(e.ok=this.previewImageElement.dataset.btnPrivacyOk),"btnLabelOk"in this.wrapperElement.dataset?e.cancel=this.wrapperElement.dataset.btnLabelCancel:this.previewImageElement&&"btnPrivacyCancel"in this.previewImageElement.dataset&&(e.cancel=this.previewImageElement.dataset.btnPrivacyCancel),e}},{key:"showVideo",value:function(){if("element"in this.wrapperElement.dataset){if(this.videoContainerElement)this.videoContainerElement.innerHTML="";else{this.videoContainerElement=document.createElement("div"),this.videoContainerElement.classList.add(["video-container"]);var e=this.wrapperElement.querySelector(".video-wrapper");if(!e)return!1;e.appendChild(this.videoContainerElement)}var t=JSON.parse(this.wrapperElement.dataset.element),n=document.createElement(t.type);Object.entries(t.attributes).forEach((function(e){n.setAttribute(e[0],e[1])})),this.videoContainerElement.appendChild(n)}else{if(!this.videoContainerElement)return!1;var i=this.videoContainerElement.querySelectorAll("iframe");if(i.length>0)i.forEach((function(e){e.src=e.dataset.src,document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))}));else{var r=this.videoContainerElement.querySelectorAll(":scope > video");if(r.length<1)return!1;r.forEach((function(e){document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))}))}}return this.videoContainerElement.classList.remove("video-hidden"),this.previewImageElement&&(this.previewImageElement.style="display:none;"),!0}},{key:"videoToggle",value:function(){var e=this,t=[!0,!0],n=this.wrapperElement.querySelectorAll(".huh_video .video-toggle-ctn button"),i=this.wrapperElement.querySelector("#videoToggleLiveRegionOutput"),r=function(r){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=t.slice(0);a[r]=!1,n.length>0&&(a.forEach((function(t,i){var r=e.wrapperElement.querySelector("#"+n[i].getAttribute("aria-controls"));if(t){n[i].classList.add("btn-video-show"),r.style.display="none";var o=r.querySelector("iframe");null!==o&&o.setAttribute("src",o.src)}else n[i].classList.remove("btn-video-show"),r.style.display="block"})),o&&(i.textContent=r?"Audiodeskription steht im folgenden Video nicht mehr zur Verfügung":"Audiodeskription steht im folgenden Video zur Verfügung"))};n.length>0&&(n.forEach((function(e,t){e.addEventListener("click",(function(e){r(t,!0)}))})),r(1))}},{key:"legacyPrivacyCheck",value:function(){!this.privacyMode&&this.previewImageElement&&"privacy"in this.previewImageElement.dataset&&(this.privacyMode=!0,console.warn("You're using an outdated video templates. Please adjust your template according to the docs. Since version 1.2.0"))}}])&&a(t.prototype,n),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();l(c,"privacyKey","huh_video_privacy"),l(c,"storeDecisionFieldName","video-save-privacy"),document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".huh_video").forEach((function(e){return new c(e)})),document.querySelectorAll(".huh_video.video-link").forEach((function(e){new c(e,"link")}))})),document.addEventListener("afterUnlockProtectedCode",(function(e){var t=document.querySelector('[data-identifier="'+e.detail.identifier+'"] .huh_video');if(null!==t&&(new c(t),e.detail.unlockByClick)){var n=t.querySelector(".video-toggle-ctn button");n?n.focus():t.querySelector('[tabindex="0"]').focus()}}))}}); \ No newline at end of file diff --git a/src/Resources/views/fullsize/videomodal_bs3.html.twig b/src/Resources/views/fullsize/videomodal_bs3.html.twig deleted file mode 100644 index f6425b5..0000000 --- a/src/Resources/views/fullsize/videomodal_bs3.html.twig +++ /dev/null @@ -1,23 +0,0 @@ - - {{ videoLinkText|trans }} - - - - - - {% block modalHeader %} - {{ headlineText }} - - × - - {% endblock %} - - - {% block modalBody %} - {{ videoplayer }} - {% endblock %} - - - - - \ No newline at end of file diff --git a/src/Video/AbstractVideo.php b/src/Video/AbstractVideo.php index c55b08d..29c4b8d 100644 --- a/src/Video/AbstractVideo.php +++ b/src/Video/AbstractVideo.php @@ -9,7 +9,6 @@ namespace HeimrichHannot\VideoBundle\Video; use Contao\StringUtil; -use ReflectionClass; abstract class AbstractVideo implements VideoInterface { @@ -38,9 +37,6 @@ abstract class AbstractVideo implements VideoInterface */ protected $addPlayButton = false; - /** - * AbstractVideo constructor. - */ public function __construct(array $data) { $this->setData($data); @@ -77,34 +73,34 @@ public function getData(): array { $result = []; - $class = new ReflectionClass(static::class); + $class = new \ReflectionClass(static::class); foreach ($class->getMethods() as $method) { - if ('get' == substr($method->name, 0, 3) && 'getData' !== $method->name) { + if (str_starts_with($method->name, 'get') && 'getData' !== $method->name) { if ($method->isStatic()) { continue; } - $propName = strtolower(substr($method->name, 3, 1)).substr($method->name, 4); + $propName = strtolower(substr($method->name, 3, 1)) . substr($method->name, 4); $result[$propName] = $method->invoke($this); } - if ('is' == substr($method->name, 0, 2)) { + if (str_starts_with($method->name, 'is')) { if ($method->isStatic()) { continue; } - $propName = strtolower(substr($method->name, 2, 1)).substr($method->name, 3); + $propName = strtolower(substr($method->name, 2, 1)) . substr($method->name, 3); $result[$propName] = $method->invoke($this); } - if ('has' == substr($method->name, 0, 3)) { + if (str_starts_with($method->name, 'has')) { if ($method->isStatic()) { continue; } - $propName = strtolower(substr($method->name, 3, 1)).substr($method->name, 4); + $propName = strtolower(substr($method->name, 3, 1)) . substr($method->name, 4); $result[$propName] = $method->invoke($this); } @@ -128,9 +124,6 @@ public function getVideoLinkText(): string return $this->videoLinkText; } - /** - * {@inheritdoc} - */ public function getHeadlineText(): string { return $this->headlineText; @@ -145,8 +138,6 @@ public function getAddPlayButton(): bool * Set object property. * * If you overwrite this method, it is recommended to just adjust needed values and call parent::setProperty() afterwards - * - * @param $value */ protected function setProperty(string $property, $value) { diff --git a/src/Video/FileVideo.php b/src/Video/FileVideo.php index e06b362..68eb36f 100644 --- a/src/Video/FileVideo.php +++ b/src/Video/FileVideo.php @@ -8,15 +8,16 @@ namespace HeimrichHannot\VideoBundle\Video; +use Contao\FilesModel; use Contao\StringUtil; use Contao\System; -use HeimrichHannot\UtilsBundle\File\FileUtil; -use HeimrichHannot\UtilsBundle\Model\ModelUtil; +use Contao\Validator; +use HeimrichHannot\UtilsBundle\Util\Utils; class FileVideo extends AbstractVideo implements PreviewImageInterface, MultipleSourceVideoInterface, SubtitleInterface { - const TYPE = 'file'; - const TEMPLATE = '@HeimrichHannotVideo/videoprovider/videoprovider_file.html.twig'; + public const TYPE = 'file'; + public const TEMPLATE = '@HeimrichHannotVideo/videoprovider/videoprovider_file.html.twig'; /** * @var bool @@ -48,49 +49,31 @@ class FileVideo extends AbstractVideo implements PreviewImageInterface, Multiple */ protected $alternativeText = ''; - /** - * {@inheritdoc} - */ public static function getType(): string { return self::TYPE; } - /** - * {@inheritdoc} - */ public static function getTemplate(): string { return self::TEMPLATE; } - /** - * {@inheritdoc} - */ public function hasPreviewImage(): bool { return $this->addPreviewImage && \is_string($this->getPreviewImage()); } - /** - * {@inheritdoc} - */ public function getPreviewImage(): ?string { return $this->posterSRC; } - /** - * {@inheritdoc} - */ public static function getPalette(): string { return 'videoSRC,videoSubtitles,videoAlternativeText'; } - /** - * {@inheritdoc} - */ public function getSrc(): string { $path = $this->prepareVideoSource()[0]['file']->path; @@ -140,11 +123,14 @@ public function getSubtitles(): array return []; } + /** @var Utils $utils */ + $utils = System::getContainer()->get(Utils::class); + foreach ($data as $element) { $subtitles[] = [ - 'src' => System::getContainer()->get(FileUtil::class)->getPathFromUuid($element['file'][0]), + 'src' => $utils->file()->getPathFromUuid($element['file'][0]), 'lang' => $element['language'], - 'label' => System::getLanguages(true)[$element['language']], + 'label' => System::getContainer()->get('contao.intl.locales')->getEnabledLocales(null, true)[$element['language']], ]; } @@ -188,8 +174,11 @@ private function prepareVideoSource(): array foreach ($data as $video) { $mediaQuery = $mediaQueryConfig[$video['mediaQuery']]['query'] ?? ''; + if (Validator::isUuid($video['file'])) { + $file = FilesModel::findByUuid($video['file']); + } $videoSrc[] = [ - 'file' => System::getContainer()->get(ModelUtil::class)->getModelInstanceIfId($video['file'], 'tl_files'), + 'file' => $file, 'mediaQuery' => $mediaQuery, ]; } diff --git a/src/Video/PreviewImageInterface.php b/src/Video/PreviewImageInterface.php index c9db09a..67ff49d 100644 --- a/src/Video/PreviewImageInterface.php +++ b/src/Video/PreviewImageInterface.php @@ -17,8 +17,6 @@ public function hasPreviewImage(): bool; /** * Return the preview image uuid. - * - * @return string */ public function getPreviewImage(): ?string; } diff --git a/src/Video/VimeoVideo.php b/src/Video/VimeoVideo.php index a6e7c48..91445d8 100644 --- a/src/Video/VimeoVideo.php +++ b/src/Video/VimeoVideo.php @@ -18,57 +18,36 @@ class VimeoVideo extends AbstractVideo implements PreviewImageInterface, NoCooki protected $posterSRC; - /** - * {@inheritdoc} - */ public static function getType(): string { return 'vimeo'; } - /** - * {@inheritdoc} - */ public static function getTemplate(): string { return '@HeimrichHannotVideo/videoprovider/videoprovider_vimeo.html.twig'; } - /** - * {@inheritdoc} - */ public static function getPalette(): string { return 'vimeo,transcriptedVimeo'; } - /** - * {@inheritdoc} - */ public function hasPreviewImage(): bool { return $this->addPreviewImage && \is_string($this->getPreviewImage()); } - /** - * {@inheritdoc} - */ public function getPreviewImage(): ?string { return $this->posterSRC; } - /** - * {@inheritdoc} - */ public function getNoCookieSrc(): string { return $this->createUrl(true); } - /** - * {@inheritdoc} - */ public function getSrc(): string { return $this->createUrl(false); @@ -85,19 +64,19 @@ protected function createUrl(bool $noCookie): string $queryParams['dnt'] = '1'; } -// $params = [ -// 'ytShowRelated' => 'rel', -// 'ytModestBranding' => 'modestbranding', -// 'ytShowInfo' => 'showinfo', -// ]; -// foreach ($params as $property => $param) { -// if ($this->{$property}) { -// $queryParams[$param] = $this->{$property}; -// } -// } -// $queryParams['rel'] = $this->videoShowRelated; -// $queryParams['modestbranding'] = $this->ytModestBranding; -// $queryParams['showinfo'] = $this->ytShowInfo; + // $params = [ + // 'ytShowRelated' => 'rel', + // 'ytModestBranding' => 'modestbranding', + // 'ytShowInfo' => 'showinfo', + // ]; + // foreach ($params as $property => $param) { + // if ($this->{$property}) { + // $queryParams[$param] = $this->{$property}; + // } + // } + // $queryParams['rel'] = $this->videoShowRelated; + // $queryParams['modestbranding'] = $this->ytModestBranding; + // $queryParams['showinfo'] = $this->ytShowInfo; if ($this->autoplay) { $queryParams['autoplay'] = '1'; diff --git a/src/Video/YouTubeVideo.php b/src/Video/YouTubeVideo.php index 85aad1c..0bee781 100644 --- a/src/Video/YouTubeVideo.php +++ b/src/Video/YouTubeVideo.php @@ -10,8 +10,8 @@ class YouTubeVideo extends AbstractVideo implements PreviewImageInterface, NoCookieUrlInterface, ExternalElementInterface { - const PRIVACY_EMBED_URL = 'https://www.youtube-nocookie.com/embed/'; - const DEFAULT_EMBED_URL = 'https://www.youtube.com/embed/'; + public const PRIVACY_EMBED_URL = 'https://www.youtube-nocookie.com/embed/'; + public const DEFAULT_EMBED_URL = 'https://www.youtube.com/embed/'; /** * The youtube video id. @@ -65,9 +65,6 @@ public static function getType(): string return 'youtube'; } - /** - * {@inheritdoc} - */ public static function getTemplate(): string { return '@HeimrichHannotVideo/videoprovider/videoprovider_youtube.html.twig'; @@ -103,41 +100,26 @@ public function getVideoDuration(): string return $this->videoDuration; } - /** - * @return string - */ public function getPreviewImage(): ?string { return $this->posterSRC; } - /** - * {@inheritdoc} - */ public function hasPreviewImage(): bool { return $this->addPreviewImage && \is_string($this->getPreviewImage()); } - /** - * {@inheritdoc} - */ public function getNoCookieSrc(): string { return $this->createUrl(true, $this->youtube); } - /** - * {@inheritdoc} - */ public function getNoCookieSecondarySrc(): string { return $this->createUrl(true, $this->transcriptedYoutube); } - /** - * {@inheritdoc} - */ public static function getPalette(): string { return 'youtube,videoDuration,transcriptedYoutube,ytHd,videoShowRelated,ytModestBranding,ytShowInfo'; @@ -188,7 +170,7 @@ protected function createUrl(bool $noCookie, string $videoId): string } if (!empty($queryParams)) { - $url .= '?'.http_build_query($queryParams); + $url .= '?' . http_build_query($queryParams); } return $url; diff --git a/src/Resources/views/videoprovider/videoprovider_default.html.twig b/templates/videoprovider/videoprovider_default.html.twig similarity index 87% rename from src/Resources/views/videoprovider/videoprovider_default.html.twig rename to templates/videoprovider/videoprovider_default.html.twig index 7cc4c3f..f3def90 100644 --- a/src/Resources/views/videoprovider/videoprovider_default.html.twig +++ b/templates/videoprovider/videoprovider_default.html.twig @@ -1,5 +1,7 @@ +{%- import "@ContaoCore/Image/Studio/_macros.html.twig" as studio -%} + - + {% block switch %} {% endblock %} @@ -7,11 +9,8 @@ {% if previewImage|default() %} - {% if previewImage.picture|default() %} - {{ include('@HeimrichHannotContaoUtils/picture.html.twig', previewImage.picture) }} - {% else %} - - {% endif %} + {{ studio.picture(previewImage) }} + {% if videoDuration|default() %} {% if videoDuration matches '/^\\d+$/' %} diff --git a/src/Resources/views/videoprovider/videoprovider_file.html.twig b/templates/videoprovider/videoprovider_file.html.twig similarity index 86% rename from src/Resources/views/videoprovider/videoprovider_file.html.twig rename to templates/videoprovider/videoprovider_file.html.twig index ba39eab..c4c6ba4 100644 --- a/src/Resources/views/videoprovider/videoprovider_file.html.twig +++ b/templates/videoprovider/videoprovider_file.html.twig @@ -13,7 +13,7 @@ {% endblock %} {% block videoplayer %} - + {% if multipleSrc|default() %} {% for video in multipleSrc %} diff --git a/src/Resources/views/videoprovider/videoprovider_vimeo.html.twig b/templates/videoprovider/videoprovider_vimeo.html.twig similarity index 100% rename from src/Resources/views/videoprovider/videoprovider_vimeo.html.twig rename to templates/videoprovider/videoprovider_vimeo.html.twig diff --git a/src/Resources/views/videoprovider/videoprovider_youtube.html.twig b/templates/videoprovider/videoprovider_youtube.html.twig similarity index 100% rename from src/Resources/views/videoprovider/videoprovider_youtube.html.twig rename to templates/videoprovider/videoprovider_youtube.html.twig diff --git a/src/Resources/views/wrapper/videowrapper_default.html.twig b/templates/wrapper/videowrapper_default.html.twig similarity index 100% rename from src/Resources/views/wrapper/videowrapper_default.html.twig rename to templates/wrapper/videowrapper_default.html.twig diff --git a/src/Resources/translations/messages.de.yml b/translations/messages.de.yml similarity index 100% rename from src/Resources/translations/messages.de.yml rename to translations/messages.de.yml diff --git a/src/Resources/translations/messages.en.yml b/translations/messages.en.yml similarity index 100% rename from src/Resources/translations/messages.en.yml rename to translations/messages.en.yml diff --git a/src/Resources/translations/messages.pl.yml b/translations/messages.pl.yml similarity index 100% rename from src/Resources/translations/messages.pl.yml rename to translations/messages.pl.yml diff --git a/webpack.config.js b/webpack.config.js index f46afd3..2764001 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,10 +1,10 @@ var Encore = require('@symfony/webpack-encore'); Encore -.setOutputPath('src/Resources/public/assets/') -.addEntry('contao-video-bundle', './src/Resources/assets/js/contao-video-bundle.js') -.addEntry('contao-video-bundle-be', './src/Resources/assets/js/contao-video-bundle-be.js') -.addEntry('contao-video-bundle-theme', './src/Resources/assets/js/contao-video-bundle-theme.js') +.setOutputPath('public/assets/') +.addEntry('contao-video-bundle', './assets/js/contao-video-bundle.js') +.addEntry('contao-video-bundle-be', './assets/js/contao-video-bundle-be.js') +.addEntry('contao-video-bundle-theme', './assets/js/contao-video-bundle-theme.js') .setPublicPath('/bundles/heimrichhannotvideo/assets') .setManifestKeyPrefix('bundles/heimrichhannotvideo/assets') .disableSingleRuntimeChunk() @@ -15,15 +15,6 @@ Encore return `${moduleFileName}`; }; }) -.addExternals({ - '@hundh/contao-utils-bundle': 'utilsBundle' -}) -.configureBabel(null, -{ - includeNodeModules: [ - '@hundh/contao-utils-bundle', - ] -}) .enableSassLoader() .enablePostCssLoader() .enableSourceMaps(!Encore.isProduction())