1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,70 @@ |
1 |
+<?php |
|
2 |
+$cssClasses = array( |
|
3 |
+ 'photo-text-wrapper', |
|
4 |
+ 'photo-text-wrapper_'.$this->id, |
|
5 |
+ $this->class, |
|
6 |
+); |
|
7 |
+if ($this->textPosition) { |
|
8 |
+ $cssClasses[] = $this->textPosition; |
|
9 |
+} |
|
10 |
+if ($this->valign) { |
|
11 |
+ $cssClasses[] = $this->valign; |
|
12 |
+} |
|
13 |
+if ($this->valignCenter) { |
|
14 |
+ $cssClasses[] = '-valign-center'; |
|
15 |
+} |
|
16 |
+$imageFiles = array(); |
|
17 |
+$videoFiles = array(); |
|
18 |
+if (is_array($this->backgroundImage)) { |
|
19 |
+ foreach (\FilesModel::findMultipleByUuids($this->backgroundImage) as $file) { |
|
20 |
+ if (in_array( |
|
21 |
+ $file->extension, |
|
22 |
+ array_map('trim', explode(',', \Config::get('validImageTypes'))) |
|
23 |
+ )) { |
|
24 |
+ $imageFiles[] = $file; |
|
25 |
+ } |
|
26 |
+ else { |
|
27 |
+ $videoFiles[] = $file; |
|
28 |
+ } |
|
29 |
+ } |
|
30 |
+} |
|
31 |
+$imgColStyle = ''; |
|
32 |
+if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)) { |
|
33 |
+ $imgColStyle .= 'background-image: url("' . $image->src . '");'; |
|
34 |
+} |
|
35 |
+if ((count($imageFiles) || count($videoFiles)) && $this->backgroundSize) { |
|
36 |
+ $imgColStyle .= 'background-size: ' . $this->backgroundSize . ';'; |
|
37 |
+} |
|
38 |
+if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) { |
|
39 |
+ $imgColStyle .= 'background-position: ' . $this->backgroundPosition . ';'; |
|
40 |
+} |
|
41 |
+ |
|
42 |
+$style = ''; |
|
43 |
+if (!count($videoFiles) && !count($imageFiles)) { |
|
44 |
+ $style .= $imgColStyle; |
|
45 |
+} |
|
46 |
+ |
|
47 |
+?> |
|
48 |
+ |
|
49 |
+<?php $this->block('content'); ?> |
|
50 |
+<div class="<?php echo implode(' ', $cssClasses) ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>> |
|
51 |
+ |
|
52 |
+ <div class="photo-wall"> |
|
53 |
+ <?php if (count($videoFiles)): ?> |
|
54 |
+ <div class="photo-wall-content"> |
|
55 |
+ <video class="no-mejs" autoplay loop <?php if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?> poster="<?php echo $image->src ?>"<?php endif ?>> |
|
56 |
+ <?php foreach ($videoFiles as $video): ?> |
|
57 |
+ <source src="<?php echo TL_FILES_URL . $video->path ?>" type="video/<?php echo $video->extension ?>"> |
|
58 |
+ <?php endforeach ?> |
|
59 |
+ <?php if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?> |
|
60 |
+ <?php $this->insert('picture_default', $image->picture) ?> |
|
61 |
+ <?php endif ?> |
|
62 |
+ </video> |
|
63 |
+ </div> |
|
64 |
+ <?php elseif (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?> |
|
65 |
+ <div class="photo-wall-content" style="<?php echo htmlspecialchars($imgColStyle) ?>" data-image-url="<?php echo $image->src ?>"></div> |
|
66 |
+ <?php endif ?> |
|
67 |
+ </div> |
|
68 |
+ |
|
69 |
+ <div class="text-wall"><div class="text-wall-content<?php if ($this->padding): ?> <?= $this->padding ?><?php endif; ?>"> |
|
70 |
+<?php $this->endblock(); ?> |