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
34ede2ab
Commit
34ede2ab
authored
3 years ago
by
Kevin von Spiczak
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] catch exception when no client id / secret is set
parent
46bc8788
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Classes/Controller/VimeoController.php
+12
-1
12 additions, 1 deletion
Classes/Controller/VimeoController.php
Resources/Private/Templates/Vimeo/Index.html
+51
-44
51 additions, 44 deletions
Resources/Private/Templates/Vimeo/Index.html
with
63 additions
and
45 deletions
Classes/Controller/VimeoController.php
+
12
−
1
View file @
34ede2ab
...
...
@@ -43,6 +43,10 @@ class VimeoController extends ActionController {
$maxResults
=
(
int
)
$this
->
settings
[
'maxResults'
];
$clientId
=
$this
->
settings
[
'clientId'
];
$clientSecret
=
$this
->
settings
[
'clientSecret'
];
if
(
trim
(
$clientId
)
===
''
||
trim
(
$clientSecret
)
===
''
)
{
$this
->
view
->
assign
(
'error'
,
'Please configure a client id and a client secret for sg_vimeo.'
);
return
;
}
$vimeoService
=
GeneralUtility
::
makeInstance
(
VimeoService
::
class
,
$clientId
,
$clientSecret
);
$response
=
$vimeoService
->
getVimeoData
(
$id
,
$maxResults
);
$response
=
$this
->
mapVimeoApiResponseWithPossibleCustomThumbnails
(
$response
);
...
...
@@ -50,10 +54,17 @@ class VimeoController extends ActionController {
return
;
}
$showApiResult
=
(
int
)
(
$this
->
settings
[
'showApiResult'
]
??
1
);
$context
=
GeneralUtility
::
getApplicationContext
();
// disable API debug output in production context
if
(
$context
->
isProduction
())
{
$showApiResult
=
0
;
}
$this
->
view
->
assignMultiple
(
[
'response'
=>
$response
,
'showApiResult'
=>
(
int
)
(
$this
->
settings
[
'
showApiResult
'
]
??
1
)
,
'showApiResult'
=>
$
showApiResult
,
'showTitle'
=>
(
int
)
(
$this
->
settings
[
'showTitle'
]
??
1
),
'showDescription'
=>
(
int
)
(
$this
->
settings
[
'showDescription'
]
??
1
),
]
...
...
This diff is collapsed.
Click to expand it.
Resources/Private/Templates/Vimeo/Index.html
+
51
−
44
View file @
34ede2ab
<f:layout
name=
"Default"
/>
<f:section
name=
"main"
>
<f:if
condition=
"{showApiResult}"
>
<f:debug>
{response}
</f:debug>
</f:if>
<f:if
condition=
"{error}"
>
<f:then>
<p>
{error}
</p>
</f:then>
<f:else>
<f:if
condition=
"{showApiResult}"
>
<f:debug>
{response}
</f:debug>
</f:if>
<ul
class=
"sg-vimeo sg-vimeo-default"
>
<f:for
each=
"{response.items}"
as=
"item"
iteration=
"feedIterator"
>
<li
class=
"sg-vimeo-item-container{f:if(condition: '{feedIterator.total} < 2', then: ' sg-vimeo-item-single')}"
>
<a
class=
"sg-vimeo-item sg-card-shadow"
href=
"{item.link}"
data-video-id=
"{item.videoId}"
target=
"_blank"
data-disable-lightbox=
"{settings.disableLightbox}"
data-disable-lightbox-mobile=
"{settings.disableLightboxMobile}"
>
<f:comment>
<!--Use the custom thumbnail (if available).
Use the last picture of the vimeo API response otherwise (the last one,
should always be the one with the highest resolution).-->
</f:comment>
<f:if
condition=
"{item.thumbnail}"
>
<f:then>
<div
class=
"sg-vimeo-image"
>
<img
src=
"{item.thumbnail}"
alt=
"{item.name}"
loading=
"lazy"
/>
</div>
</f:then>
<f:else>
<f:if
condition=
"{item.pictures.sizes}"
>
<f:for
each=
"{item.pictures.sizes}"
as=
"picture"
iteration=
"iterator"
>
<f:if
condition=
"{iterator.isLast}"
>
<div
class=
"sg-vimeo-image"
>
<img
src=
"{picture.link}"
alt=
"{item.name}"
loading=
"lazy"
/>
</div>
<ul
class=
"sg-vimeo sg-vimeo-default"
>
<f:for
each=
"{response.items}"
as=
"item"
iteration=
"feedIterator"
>
<li
class=
"sg-vimeo-item-container{f:if(condition: '{feedIterator.total} < 2', then: ' sg-vimeo-item-single')}"
>
<a
class=
"sg-vimeo-item sg-card-shadow"
href=
"{item.link}"
data-video-id=
"{item.videoId}"
target=
"_blank"
data-disable-lightbox=
"{settings.disableLightbox}"
data-disable-lightbox-mobile=
"{settings.disableLightboxMobile}"
>
<f:comment>
<!--Use the custom thumbnail (if available).
Use the last picture of the vimeo API response otherwise (the last one,
should always be the one with the highest resolution).-->
</f:comment>
<f:if
condition=
"{item.thumbnail}"
>
<f:then>
<div
class=
"sg-vimeo-image"
>
<img
src=
"{item.thumbnail}"
alt=
"{item.name}"
loading=
"lazy"
/>
</div>
</f:then>
<f:else>
<f:if
condition=
"{item.pictures.sizes}"
>
<f:for
each=
"{item.pictures.sizes}"
as=
"picture"
iteration=
"iterator"
>
<f:if
condition=
"{iterator.isLast}"
>
<div
class=
"sg-vimeo-image"
>
<img
src=
"{picture.link}"
alt=
"{item.name}"
loading=
"lazy"
/>
</div>
</f:if>
</f:for>
</f:if>
</f:for>
</f:else>
</f:if>
<f:if
condition=
"{showTitle} && {item.name}"
>
<div
class=
"sg-vimeo-title"
>
<h3
class=
"h3"
>
{item.name}
</h3>
</div>
</f:if>
</f:else>
</f:if>
<f:if
condition=
"{showTitle} && {item.name}"
>
<div
class=
"sg-vimeo-title"
>
<h3
class=
"h3"
>
{item.name}
</h3>
</div>
</f:if>
<f:if
condition=
"{showDescription} && {item.description}"
>
<div
class=
"sg-vimeo-text"
>
<f:format.crop
maxCharacters=
"200"
>
{item.description}
</f:format.crop>
</div>
</f:if>
</a>
</li>
</f:for>
</ul>
<f:if
condition=
"{showDescription} && {item.description}"
>
<div
class=
"sg-vimeo-text"
>
<f:format.crop
maxCharacters=
"200"
>
{item.description}
</f:format.crop>
</div>
</f:if>
</a>
</li>
</f:for>
</ul>
</f:else>
</f:if>
</f:section>
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