Skip to content

Commit

Permalink
[FEATURE] add an additional wrap to all placeholder content to overla…
Browse files Browse the repository at this point in the history
…y a video button to the preview image
  • Loading branch information
ghermens committed Mar 19, 2020
1 parent 16bbff2 commit cf4ed8e
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 6 deletions.
5 changes: 5 additions & 0 deletions Classes/Resource/Rendering/VimeoRenderer.php
Expand Up @@ -157,6 +157,11 @@ protected function renderPlaceholder(FileInterface $file, $width, $height, array
$placeholderContent = $title . $placeholderContent;
}

if (!empty($placeholderContentObject['allWrap'])) {
$wrapArr = explode('|', $placeholderContentObject['allWrap']);
$placeholderContent = trim($wrapArr[0] ?? '') . $placeholderContent . trim($wrapArr[1] ?? '');
}

$placeholderContent = '<div class="media2click-placeholder' . ($hasPreview ? ' media2click-haspreview':'') . '" style="' . $style . '">' . $placeholderContent . '</div>';

return $placeholderContent;
Expand Down
5 changes: 5 additions & 0 deletions Classes/Resource/Rendering/YouTubeRenderer.php
Expand Up @@ -161,6 +161,11 @@ protected function renderPlaceholder(FileInterface $file, $width, $height, array
$placeholderContent = $title . $placeholderContent;
}

if (!empty($placeholderContentObject['allWrap'])) {
$wrapArr = explode('|', $placeholderContentObject['allWrap']);
$placeholderContent = trim($wrapArr[0] ?? '') . $placeholderContent . trim($wrapArr[1] ?? '');
}

$placeholderContent = '<div class="media2click-placeholder' . ($hasPreview ? ' media2click-haspreview':'') . '" style="' . $style . '">' . $placeholderContent . '</div>';

return $placeholderContent;
Expand Down
11 changes: 7 additions & 4 deletions Configuration/TypoScript/constants.typoscript
Expand Up @@ -3,17 +3,20 @@ plugin {
#cat=content/enable/a; type=boolean; label=Enable 2-click for external media
enable = 0

#cat=content/enable/b; type=boolean; label=Show the video's title as the placeholder's title
#cat=content/enable/b; type=wrap; label=Additional warp to all placeholder content
allWrap = <div class="media2click-placeholder-inner">|</div>

#cat=content/enable/c; type=boolean; label=Show the video's title as the placeholder's title
showTitle = 1

#cat=content/enable/c; type=boolean; label=Show the video's preview image
#cat=content/enable/d; type=boolean; label=Show the video's preview image
showPreviewImage = 1

showPreviewImage {
#cat=content/enable/d; type=int+; label=Show the video's preview image
#cat=content/enable/e; type=int+; label=Show the video's preview image
maxWidth = 0

#cat=content/enable/e; type=int+; label=Show the video's preview image
#cat=content/enable/f; type=int+; label=Show the video's preview image
maxHeight = 0
}
}
Expand Down
2 changes: 2 additions & 0 deletions Configuration/TypoScript/setup.typoscript
Expand Up @@ -15,6 +15,8 @@ lib {
media {
additionalConfig {
placeholderContent {
allWrap = {$plugin.media2click.allWrap}

wrap = <span class="media2click-content">|</span>
value = Click to load external video!
lang {
Expand Down
19 changes: 19 additions & 0 deletions Documentation/Configuration/Index.rst
Expand Up @@ -33,6 +33,22 @@ enable
:aspect:`Default:`
0

.. _constants-allwrap:

allWrap
"""""""

:aspect:`Property`
allWrap

:aspect:`Data type:`
wrap

:aspect:`Description`
Additional wrap to all placeholder content

:aspect:`Default:`
<div class="media2click-placeholder-inner">|</div>

.. _constants-showtitle:

Expand Down Expand Up @@ -125,6 +141,9 @@ placeholderContent

Properties:

:ts:`.allWrap:`
This wraps the whole placeholder content.

:ts:`.value:` String
Default text

Expand Down
18 changes: 17 additions & 1 deletion Resources/Public/Css/media2click.css
Expand Up @@ -24,10 +24,26 @@
margin-bottom: .5em;
}

.media2click-placeholder-inner {
width: 100%;
height: 100%;

display: flex;
flex-direction: column;
justify-content: center;
}

.media2click-placeholder.media2click-haspreview .media2click-placeholder-inner {
background-image: url(../Images/videobutton.png);
background-size: 30% auto;
background-position: center center;
background-repeat: no-repeat;
}

.media2click-content {
display: block;
}

.media2click-wrap iframe {
display: none;
}
}
Binary file added Resources/Public/Images/videobutton.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ext_emconf.php
Expand Up @@ -22,5 +22,5 @@
],
],
'state' => 'beta',
'version' => '0.2.3',
'version' => '0.2.4',
];

0 comments on commit cf4ed8e

Please sign in to comment.