... | ... |
@@ -11,12 +11,15 @@ |
11 | 11 |
if ($this->height) { |
12 | 12 |
$cssClasses[] = $this->height; |
13 | 13 |
} |
14 |
+ if ($this->valign) { |
|
15 |
+ $cssClasses[] = $this->valign; |
|
16 |
+ } |
|
14 | 17 |
if ($this->width) { |
15 | 18 |
$cssClasses[] = '-width-expand'; |
16 | 19 |
} |
17 |
- if ($this->valignCenter) { |
|
20 |
+ /*if ($this->valignCenter) { |
|
18 | 21 |
$cssClasses[] = '-valign-center'; |
19 |
- } |
|
22 |
+ }*/ |
|
20 | 23 |
if ($this->shadow) { |
21 | 24 |
$cssClasses[] = '-shadow'; |
22 | 25 |
} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,96 @@ |
1 |
+<?php |
|
2 |
+ $cssClasses = array( |
|
3 |
+ 'background-wrapper', |
|
4 |
+ 'background-wrapper_'.$this->id, |
|
5 |
+ $this->class, |
|
6 |
+ $this->backgroundVariation, |
|
7 |
+ ); |
|
8 |
+ if ($this->colorVariation) { |
|
9 |
+ $cssClasses[] = $this->colorVariation; |
|
10 |
+ } |
|
11 |
+ if ($this->height) { |
|
12 |
+ $cssClasses[] = $this->height; |
|
13 |
+ } |
|
14 |
+ if ($this->width) { |
|
15 |
+ $cssClasses[] = '-width-expand'; |
|
16 |
+ } |
|
17 |
+ if ($this->valignCenter) { |
|
18 |
+ $cssClasses[] = '-valign-center'; |
|
19 |
+ } |
|
20 |
+ if ($this->shadow) { |
|
21 |
+ $cssClasses[] = '-shadow'; |
|
22 |
+ } |
|
23 |
+ if ($this->textShadow) { |
|
24 |
+ $cssClasses[] = '-text-shadow'; |
|
25 |
+ } |
|
26 |
+ if ($this->invert) { |
|
27 |
+ $cssClasses[] = '-invert'; |
|
28 |
+ } |
|
29 |
+ if ($this->widthRestrict) { |
|
30 |
+ $cssClasses[] = '-bg-restraint'; |
|
31 |
+ } |
|
32 |
+ |
|
33 |
+ $imageFiles = array(); |
|
34 |
+ $videoFiles = array(); |
|
35 |
+ if (is_array($this->backgroundImage)) { |
|
36 |
+ foreach (\FilesModel::findMultipleByUuids($this->backgroundImage) as $file) { |
|
37 |
+ if (in_array( |
|
38 |
+ $file->extension, |
|
39 |
+ array_map('trim', explode(',', \Config::get('validImageTypes'))) |
|
40 |
+ )) { |
|
41 |
+ $imageFiles[] = $file; |
|
42 |
+ } |
|
43 |
+ else { |
|
44 |
+ $videoFiles[] = $file; |
|
45 |
+ } |
|
46 |
+ } |
|
47 |
+ } |
|
48 |
+ $backgroundStyle = ''; |
|
49 |
+ if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)) { |
|
50 |
+ $backgroundStyle .= 'background-image: url("' . $image->src . '");'; |
|
51 |
+ if ($this->height == '-bgimage') |
|
52 |
+ { |
|
53 |
+ $minHeight = round(100/$image->arrSize[0]*$image->arrSize[1]).'%'; |
|
54 |
+ } |
|
55 |
+ } |
|
56 |
+ if ((count($imageFiles) || count($videoFiles)) && $this->backgroundSize) { |
|
57 |
+ $backgroundStyle .= 'background-size: ' . $this->backgroundSize . ';'; |
|
58 |
+ } |
|
59 |
+ if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) { |
|
60 |
+ $backgroundStyle .= 'background-position: ' . $this->backgroundPosition . ';'; |
|
61 |
+ } |
|
62 |
+ if ((count($imageFiles) || count($videoFiles)) && $this->backgroundOpacity) { |
|
63 |
+ $backgroundStyle .= 'opacity:' . $this->backgroundOpacity/100 . ';'; |
|
64 |
+ } |
|
65 |
+ |
|
66 |
+ $style = ''; |
|
67 |
+ if (!count($videoFiles) && !count($imageFiles)) { |
|
68 |
+ $style .= $backgroundStyle; |
|
69 |
+ } |
|
70 |
+?> |
|
71 |
+ |
|
72 |
+<div class="<?php echo implode(' ', $cssClasses) ?>" style="<?php echo htmlspecialchars($style) ?> <?php echo $this->style ?>"<?php echo $this->cssID ?>> |
|
73 |
+ |
|
74 |
+ <?php if (count($videoFiles)): ?> |
|
75 |
+ <div class="background-wrapper-background"> |
|
76 |
+ <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 ?>> |
|
77 |
+ <?php foreach ($videoFiles as $video): ?> |
|
78 |
+ <source src="<?php echo TL_FILES_URL . $video->path ?>" type="video/<?php echo $video->extension ?>"> |
|
79 |
+ <?php endforeach ?> |
|
80 |
+ <?php if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?> |
|
81 |
+ <?php $this->insert('picture_default', $image->picture) ?> |
|
82 |
+ <?php endif ?> |
|
83 |
+ </video> |
|
84 |
+ </div> |
|
85 |
+ <?php elseif (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?> |
|
86 |
+ <div class="background-wrapper-background" style="<?php echo htmlspecialchars($backgroundStyle) ?>" data-image-url="<?php echo $image->src ?>"></div> |
|
87 |
+ <?php if ($minHeight): ?> |
|
88 |
+ <style>.background-wrapper_<?= $this->id ?> .background-wrapper-helper:before { content: ""; display: table; padding-top: <?= $minHeight ?>; float: left; }</style> |
|
89 |
+ <?php endif; ?> |
|
90 |
+ <?php endif ?> |
|
91 |
+ |
|
92 |
+ <?php if ($this->overlay): ?> |
|
93 |
+ <div class="overlay"></div> |
|
94 |
+ <?php endif; ?> |
|
95 |
+ |
|
96 |
+ <div class="background-wrapper-helper"><div class="background-wrapper-inner<?php if ($this->padding): ?> <?= $this->padding ?><?php endif; ?> block"> |