1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,86 @@ |
1 |
+<?php |
|
2 |
+$cssClasses = array( |
|
3 |
+ 'hero-wrapper', |
|
4 |
+ 'hero-wrapper_'.$this->id, |
|
5 |
+ $this->class, |
|
6 |
+); |
|
7 |
+if ($this->colorVariation) { |
|
8 |
+ $cssClasses[] = $this->colorVariation; |
|
9 |
+} |
|
10 |
+if ($this->textPosition) { |
|
11 |
+ $cssClasses[] = $this->textPosition; |
|
12 |
+} |
|
13 |
+ |
|
14 |
+$imageFiles = array(); |
|
15 |
+$videoFiles = array(); |
|
16 |
+if (is_array($this->backgroundImage)) { |
|
17 |
+ if (($files = \FilesModel::findMultipleByUuids($this->backgroundImage)) !== null) |
|
18 |
+ { |
|
19 |
+ foreach ($files as $file) |
|
20 |
+ { |
|
21 |
+ if (in_array( |
|
22 |
+ $file->extension, |
|
23 |
+ array_map('trim', explode(',', \Config::get('validImageTypes'))) |
|
24 |
+ )) |
|
25 |
+ { |
|
26 |
+ $imageFiles[] = $file; |
|
27 |
+ } else |
|
28 |
+ { |
|
29 |
+ $videoFiles[] = $file; |
|
30 |
+ } |
|
31 |
+ } |
|
32 |
+ } |
|
33 |
+} |
|
34 |
+$backgroundStyle = ''; |
|
35 |
+if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)) { |
|
36 |
+ $minHeight = round(100/$image->arrSize[0]*$image->arrSize[1]).'%'; |
|
37 |
+ $backgroundStyle .= 'background-image: url("' . $image->src . '");'; |
|
38 |
+} |
|
39 |
+if ((count($imageFiles) || count($videoFiles)) && $this->backgroundSize) { |
|
40 |
+ $backgroundStyle .= 'background-size: ' . $this->backgroundSize . ';'; |
|
41 |
+} |
|
42 |
+if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) { |
|
43 |
+ $backgroundStyle .= 'background-position: ' . $this->backgroundPosition . ';'; |
|
44 |
+} |
|
45 |
+ |
|
46 |
+?> |
|
47 |
+ |
|
48 |
+<?php $this->block('content'); ?> |
|
49 |
+<div class="<?php echo implode(' ', $cssClasses) ?>"<?php echo $this->cssID ?>> |
|
50 |
+<?php if (count($videoFiles)): ?> |
|
51 |
+ <div class="hero-background video_container"> |
|
52 |
+ <div class="responsive<?= $this->playerAspect ? ' ratio-'.str_replace(':','',$this->playerAspect) : '' ?>"> |
|
53 |
+ <video class="no-mejs" autoplay muted loop playsinline<?php if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?> poster="<?php echo $image->src ?>"<?php endif ?>> |
|
54 |
+ <?php foreach ($videoFiles as $video): ?> |
|
55 |
+ <source src="<?php echo TL_FILES_URL . $video->path ?>" type="video/<?php echo $video->extension ?>"> |
|
56 |
+ <?php endforeach ?> |
|
57 |
+ <?php if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?> |
|
58 |
+ <?php $this->insert('picture_default', $image->picture) ?> |
|
59 |
+ <?php endif ?> |
|
60 |
+ </video> |
|
61 |
+ </div> |
|
62 |
+ </div> |
|
63 |
+<?php elseif (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?> |
|
64 |
+ <?php /* <div class="hero-background" style="<?php echo htmlspecialchars($backgroundStyle) ?>" data-image-url="<?php echo $image->src ?>"></div> */ ?> |
|
65 |
+ <figure class="hero-background"> |
|
66 |
+ <?php $this->insert('picture_default', $image->picture) ?> |
|
67 |
+ </figure> |
|
68 |
+<?php endif ?> |
|
69 |
+ |
|
70 |
+<div class="hero-content"> |
|
71 |
+ <?php /* <div class="content-wrapper"> */ ?> |
|
72 |
+ <?php if ($this->text): ?> |
|
73 |
+ <div class="hero-text"> |
|
74 |
+ <div class="hero-text-inside"> |
|
75 |
+ <?= $this->text ?> |
|
76 |
+ </div> |
|
77 |
+ </div> |
|
78 |
+ <?php endif; ?> |
|
79 |
+ <?php /* </div> */ ?> |
|
80 |
+</div> |
|
81 |
+ |
|
82 |
+<?php if ($minHeight): ?> |
|
83 |
+ <style>.hero-wrapper_<?= $this->id ?>:before { content: ""; display: block; padding-top: <?= $minHeight ?>; width: 100%; }</style> |
|
84 |
+<?php endif; ?> |
|
85 |
+</div> |
|
86 |
+<?php $this->endblock(); ?> |