Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_vimeo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_vimeo
Commits
ff194b57
Commit
ff194b57
authored
2 years ago
by
Johannes Kreiner
Browse files
Options
Downloads
Patches
Plain Diff
[BUGFIX] Fix url parameter handover issues
parent
ea7af46a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Classes/ViewHelpers/UrlWithQueryParametersViewHelper.php
+73
-0
73 additions, 0 deletions
Classes/ViewHelpers/UrlWithQueryParametersViewHelper.php
README.md
+4
-0
4 additions, 0 deletions
README.md
Resources/Private/Templates/Vimeo/Index.html
+4
-2
4 additions, 2 deletions
Resources/Private/Templates/Vimeo/Index.html
with
81 additions
and
2 deletions
Classes/ViewHelpers/UrlWithQueryParametersViewHelper.php
0 → 100644
+
73
−
0
View file @
ff194b57
<?php
namespace
SGalinski\SgVimeo\ViewHelpers
;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the AY project. The AY project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use
TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper
;
/**
* View helper that takes a URL and adds the parameters respecting the separator
*
* Example:
* {namespace vi=SGalinski\SgVimeo\ViewHelpers}
* <vi:urlWithQueryParameters url="https://player.vimeo.com/video/123?h=xyz" parameters="?origin=https://demo.sgalinski.de" />
* Result: https://player.vimeo.com/video/123?h=xyz&origin=https://demo.sgalinski.de
*/
class
UrlWithQueryParametersViewHelper
extends
AbstractViewHelper
{
/**
* Register the ViewHelper arguments
*/
public
function
initializeArguments
():
void
{
parent
::
initializeArguments
();
$this
->
registerArgument
(
'url'
,
'string'
,
'The url to add the query parameters to'
,
TRUE
);
$this
->
registerArgument
(
'parameters'
,
'string'
,
'The query parameters to add'
,
FALSE
,
''
);
}
/**
* Returns the url with the added query parameters
*
* @return string
*/
public
function
render
():
string
{
$url
=
$this
->
arguments
[
'url'
];
$additionalUrlParameters
=
$this
->
arguments
[
'parameters'
];
if
(
$additionalUrlParameters
===
''
)
{
return
$url
;
}
$beginsWithQuestionMark
=
$additionalUrlParameters
[
0
]
===
'?'
;
$beginsWithAmpersand
=
$additionalUrlParameters
[
0
]
===
'&'
;
if
(
$beginsWithQuestionMark
||
$beginsWithAmpersand
)
{
$additionalUrlParameters
=
substr
(
$additionalUrlParameters
,
1
);
}
return
strpos
(
$url
,
'?'
)
!==
FALSE
?
$url
.
'&'
.
$additionalUrlParameters
:
$url
.
'?'
.
$additionalUrlParameters
;
}
}
This diff is collapsed.
Click to expand it.
README.md
+
4
−
0
View file @
ff194b57
...
...
@@ -72,3 +72,7 @@ If the `?disableVimeoCache=1` parameter is added to the URL, this cache will be
### .htaccess
Requires
`img-src https://i.vimeocdn.com;`
,
`script-src https://player.vimeo.com;`
and
`connect-src https://cdn.plyr.io;`
.
### Known issues
-
Additional URL parameters won't get passed to the iframe inside the lightbox, this is seemingly caused by Plyr's integration of the Vimeo API
-
Workaround: disable the lightbox for your Vimeo video
This diff is collapsed.
Click to expand it.
Resources/Private/Templates/Vimeo/Index.html
+
4
−
2
View file @
ff194b57
{namespace sg=SGalinski\ProjectTheme\ViewHelpers}
{namespace vi=SGalinski\SgVimeo\ViewHelpers}
<f:layout
name=
"Default"
/>
...
...
@@ -125,11 +126,12 @@
<f:section
name=
"vimeoItem"
>
<f:variable
name=
"urlParameters"
>
{f:if(condition: '{settings.urlParameters}', then: '{settings.urlParameters}', else: '{settings.globalUrlParameters}')}
</f:variable>
<f:variable
name=
"feedItemUrl"
>
{f:if(condition: '{feedItem.embedLink}', then: '{feedItem.embedLink}', else: '{feedItem.link}')}{urlParameters}
</f:variable>
<f:variable
name=
"feedItemUrl"
>
<vi:urlWithQueryParameters
url=
"
{f:if(condition: '{feedItem.embedLink}', then: '{feedItem.embedLink}', else: '{feedItem.link}')}
"
parameters=
"
{urlParameters}
"
/>
</f:variable>
<div
class=
"sg-video__item"
>
<a
class=
"sg-video__image-container sg-vimeo-item"
href=
"{feedItemUrl}"
target=
"_blank"
data-disable-lightbox=
"{settings.disableLightbox}"
data-disable-lightbox-mobile=
"{settings.disableLightboxMobile}"
>
data-disable-lightbox-mobile=
"{settings.disableLightboxMobile}"
data-additional-url-parameters=
"{urlParameters}"
>
<f:if
condition=
"{feedItem.thumbnail}"
>
<f:then>
<img
class=
"sg-video__image"
src=
"{feedItem.thumbnail}"
alt=
"{feedItem.name}"
loading=
"lazy"
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment