Browse code

Progress

Benjamin Roth authored on21/02/2023 19:42:19
Showing1 changed files
... ...
@@ -24,15 +24,20 @@ if ($this->height) {
24 24
 $imageFiles = array();
25 25
 $videoFiles = array();
26 26
 if (is_array($this->backgroundImage)) {
27
-  foreach (\FilesModel::findMultipleByUuids($this->backgroundImage) as $file) {
28
-    if (in_array(
29
-      $file->extension,
30
-      array_map('trim', explode(',', \Config::get('validImageTypes')))
31
-    )) {
32
-      $imageFiles[] = $file;
33
-    }
34
-    else {
35
-      $videoFiles[] = $file;
27
+  if (($files = \FilesModel::findMultipleByUuids($this->backgroundImage)) !== null)
28
+  {
29
+    foreach ($files as $file)
30
+    {
31
+      if (in_array(
32
+        $file->extension,
33
+        array_map('trim', explode(',', \Config::get('validImageTypes')))
34
+      ))
35
+      {
36
+        $imageFiles[] = $file;
37
+      } else
38
+      {
39
+        $videoFiles[] = $file;
40
+      }
36 41
     }
37 42
   }
38 43
 }
... ...
@@ -66,7 +71,10 @@ if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) {
66 71
     </div>
67 72
   </div>
68 73
 <?php elseif (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?>
69
-  <div class="hero-background<?= $this->playerAspect ? ' ratio-'.str_replace(':','',$this->playerAspect) : '' ?>" style="<?php echo htmlspecialchars($backgroundStyle) ?>" data-image-url="<?php echo $image->src ?>"></div>
74
+  <?php /*<div class="hero-background<?= $this->playerAspect ? ' ratio-'.str_replace(':','',$this->playerAspect) : '' ?>" style="<?php echo htmlspecialchars($backgroundStyle) ?>" data-image-url="<?php echo $image->src ?>"></div>*/ ?>
75
+  <figure class="hero-background<?= $this->playerAspect ? ' ratio-'.str_replace(':','',$this->playerAspect) : '' ?>">
76
+    <?php $this->insert('picture_default', $image->picture) ?>
77
+  </figure>
70 78
 <?php endif ?>
71 79
 
72 80
 <div class="content-wrapper hero-content">
... ...
@@ -90,5 +98,8 @@ if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) {
90 98
 <?php /* if ($minHeight): ?>
91 99
   <style>.hero-wrapper_<?= $this->id ?>:before { content: ""; display: table; padding-top: <?= $minHeight ?>; float: left; }</style>
92 100
 <?php endif; */ ?>
101
+  <?php if ($this->height == '-bgimage' && !$this->playerAspect && isset($minHeight)): ?>
102
+    <style>.hero-wrapper_<?= $this->id ?>:before { content: ""; display: block; padding-top: <?= $minHeight ?>; width: 100%; }</style>
103
+  <?php endif; ?>
93 104
 </div>
94 105
 <?php $this->endblock(); ?>
Browse code

Remote Progress

Benjamin Roth authored on15/12/2022 14:35:11
Showing1 changed files
... ...
@@ -41,10 +41,6 @@ if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $
41 41
   $minHeight = round(100/$image->arrSize[0]*$image->arrSize[1]).'%';
42 42
   $backgroundStyle .= 'background-image: url("' . $image->src . '");';
43 43
 }
44
-if (count($videoFiles))
45
-{
46
-  $objPage->cssClass = trim($objPage->cssClass . ' -hide-logo');
47
-}
48 44
 if ((count($imageFiles) || count($videoFiles)) && $this->backgroundSize) {
49 45
   $backgroundStyle .= 'background-size: ' . $this->backgroundSize . ';';
50 46
 }
Browse code

Progress live

Benjamin Roth authored on14/12/2022 13:32:50
Showing1 changed files
... ...
@@ -80,6 +80,11 @@ if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) {
80 80
   </div>
81 81
   <?php endif; ?>
82 82
 </div>
83
+    <?php if ($this->useHtml && $this->html): ?>
84
+    <div class="content-wrapper hero-html">
85
+        <?= $this->html ?>
86
+    </div>
87
+    <?php endif; ?>
83 88
 
84 89
 <?php if ($this->showArrow): ?>
85 90
   <svg class="arrow" xmlns='http://www.w3.org/2000/svg' width='100%' height='100%' viewBox='0 0 100 5' preserveAspectRatio='viewPort' ><polygon points="0,0 0,5 50,5 100,5 100,0 50,5" /></svg>
Browse code

Progress

Benjamin Roth authored on14/12/2022 00:09:31
Showing1 changed files
... ...
@@ -70,7 +70,7 @@ if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) {
70 70
     </div>
71 71
   </div>
72 72
 <?php elseif (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?>
73
-  <div class="hero-background" style="<?php echo htmlspecialchars($backgroundStyle) ?>" data-image-url="<?php echo $image->src ?>"></div>
73
+  <div class="hero-background<?= $this->playerAspect ? ' ratio-'.str_replace(':','',$this->playerAspect) : '' ?>" style="<?php echo htmlspecialchars($backgroundStyle) ?>" data-image-url="<?php echo $image->src ?>"></div>
74 74
 <?php endif ?>
75 75
 
76 76
 <div class="content-wrapper hero-content">
Browse code

Progress

Benjamin Roth authored on15/11/2022 16:38:13
Showing1 changed files
... ...
@@ -86,8 +86,8 @@ if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) {
86 86
 <?php endif; ?>
87 87
 
88 88
 
89
-<?php if ($minHeight): ?>
89
+<?php /* if ($minHeight): ?>
90 90
   <style>.hero-wrapper_<?= $this->id ?>:before { content: ""; display: table; padding-top: <?= $minHeight ?>; float: left; }</style>
91
-<?php endif; ?>
91
+<?php endif; */ ?>
92 92
 </div>
93 93
 <?php $this->endblock(); ?>
Browse code

Progress

Benjamin Roth authored on07/11/2022 18:15:35
Showing1 changed files
... ...
@@ -74,10 +74,10 @@ if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) {
74 74
 <?php endif ?>
75 75
 
76 76
 <div class="content-wrapper hero-content">
77
-  <?php if ($this->text['value']): ?>
78
-  <<?= $this->text['unit'] ?> class="hero-text">
79
-    <?= $this->text['value'] ?>
80
-  </<?= $this->text['unit'] ?>>
77
+  <?php if ($this->text): ?>
78
+  <div class="hero-text">
79
+    <?= $this->text ?>
80
+  </div>
81 81
   <?php endif; ?>
82 82
 </div>
83 83
 
Browse code

Initial commit

Benjamin Roth authored on07/11/2022 09:19:06
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,93 @@
1
+<?php
2
+global $objPage;
3
+$cssClasses = array(
4
+  'hero-wrapper',
5
+  'hero-wrapper_'.$this->id,
6
+  $this->class,
7
+);
8
+if ($this->colorVariation) {
9
+  $cssClasses[] = $this->colorVariation;
10
+}
11
+if ($this->textPosition) {
12
+  $cssClasses[] = $this->textPosition;
13
+}
14
+if ($this->showArrow) {
15
+  $cssClasses[] = '-arrow';
16
+}
17
+if ($this->arrowAlternate) {
18
+  $cssClasses[] = '-arrow-alternate';
19
+}
20
+if ($this->height) {
21
+    $cssClasses[] = $this->height;
22
+}
23
+
24
+$imageFiles = array();
25
+$videoFiles = array();
26
+if (is_array($this->backgroundImage)) {
27
+  foreach (\FilesModel::findMultipleByUuids($this->backgroundImage) as $file) {
28
+    if (in_array(
29
+      $file->extension,
30
+      array_map('trim', explode(',', \Config::get('validImageTypes')))
31
+    )) {
32
+      $imageFiles[] = $file;
33
+    }
34
+    else {
35
+      $videoFiles[] = $file;
36
+    }
37
+  }
38
+}
39
+$backgroundStyle = '';
40
+if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)) {
41
+  $minHeight = round(100/$image->arrSize[0]*$image->arrSize[1]).'%';
42
+  $backgroundStyle .= 'background-image: url("' . $image->src . '");';
43
+}
44
+if (count($videoFiles))
45
+{
46
+  $objPage->cssClass = trim($objPage->cssClass . ' -hide-logo');
47
+}
48
+if ((count($imageFiles) || count($videoFiles)) && $this->backgroundSize) {
49
+  $backgroundStyle .= 'background-size: ' . $this->backgroundSize . ';';
50
+}
51
+if ((count($imageFiles) || count($videoFiles)) && $this->backgroundPosition) {
52
+  $backgroundStyle .= 'background-position: ' . $this->backgroundPosition . ';';
53
+}
54
+
55
+?>
56
+
57
+<?php $this->block('content'); ?>
58
+<div class="<?php echo implode(' ', $cssClasses) ?>"<?php echo $this->cssID ?>>
59
+<?php if (count($videoFiles)): ?>
60
+  <div class="hero-background video_container">
61
+    <div class="responsive<?= $this->playerAspect ? ' ratio-'.str_replace(':','',$this->playerAspect) : '' ?>">
62
+    <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 ?>>
63
+      <?php foreach ($videoFiles as $video): ?>
64
+        <source src="<?php echo TL_FILES_URL . $video->path ?>" type="video/<?php echo $video->extension ?>">
65
+      <?php endforeach ?>
66
+      <?php if (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?>
67
+        <?php $this->insert('picture_default', $image->picture) ?>
68
+      <?php endif ?>
69
+    </video>
70
+    </div>
71
+  </div>
72
+<?php elseif (count($imageFiles) && $image = $this->getImageObject($imageFiles[0]->uuid, $this->backgroundImageSize)): ?>
73
+  <div class="hero-background" style="<?php echo htmlspecialchars($backgroundStyle) ?>" data-image-url="<?php echo $image->src ?>"></div>
74
+<?php endif ?>
75
+
76
+<div class="content-wrapper hero-content">
77
+  <?php if ($this->text['value']): ?>
78
+  <<?= $this->text['unit'] ?> class="hero-text">
79
+    <?= $this->text['value'] ?>
80
+  </<?= $this->text['unit'] ?>>
81
+  <?php endif; ?>
82
+</div>
83
+
84
+<?php if ($this->showArrow): ?>
85
+  <svg class="arrow" xmlns='http://www.w3.org/2000/svg' width='100%' height='100%' viewBox='0 0 100 5' preserveAspectRatio='viewPort' ><polygon points="0,0 0,5 50,5 100,5 100,0 50,5" /></svg>
86
+<?php endif; ?>
87
+
88
+
89
+<?php if ($minHeight): ?>
90
+  <style>.hero-wrapper_<?= $this->id ?>:before { content: ""; display: table; padding-top: <?= $minHeight ?>; float: left; }</style>
91
+<?php endif; ?>
92
+</div>
93
+<?php $this->endblock(); ?>