PluginProbe
Depicter — Popup & Slider Builder / 1.9.2
Depicter — Popup & Slider Builder v1.9.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Document / Models / Options / All.php

All.php in Depicter — Popup & Slider Builder 1.9.2, at app/src/Document/Models/Options/All.php

180 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\Document\Models\Options;
3
4
5 use Averta\Core\Utility\Arr;
6
7 class All
8 {
9 /**
10 * @var string
11 */
12 public $sectionLayout;
13
14 /**
15 * @var object
16 */
17 public $sectionTransition;
18
19 /**
20 * @var \Depicter\Document\Models\Common\Size\States
21 */
22 public $wrapperSize;
23
24 /**
25 * @var int
26 */
27 public $wrapperSideSpace = 0;
28
29 /**
30 * @var General
31 */
32 public $general;
33
34 /**
35 * @var Navigation
36 */
37 public $navigation;
38
39 /**
40 * @var object|null
41 */
42 public $navigator;
43
44 /**
45 * @var Animation
46 */
47 public $slidingAnimation;
48
49 /**
50 * @var Loading|null
51 */
52 public $loading;
53
54 /**
55 * @var Advanced
56 */
57 public $advanced;
58
59 /**
60 * @var Callback[]
61 */
62 public $callbacks;
63
64 /**
65 * @var Callback[]
66 */
67 public $controls;
68
69 /**
70 * List of option styles
71 *
72 * @var array
73 */
74 protected $stylesList = [];
75
76
77 /**
78 * Get document size
79 *
80 * @param $sizeProp
81 *
82 * @param bool $includeUnit
83 *
84 * @return string
85 */
86 public function getSize( $sizeProp, $includeUnit = false ) {
87 return implode( ',', $this->wrapperSize->getResponsiveSizes( $sizeProp, $includeUnit ) );
88 }
89
90 /**
91 * Get document size
92 *
93 * @param $sizeProp
94 * @param bool $includeUnit
95 *
96 * @return array
97 */
98 public function getSizes( $sizeProp, $includeUnit = false ) {
99 return $this->wrapperSize->getResponsiveSizes( $sizeProp, $includeUnit );
100 }
101
102 /**
103 * Get document layout
104 *
105 * @return string
106 */
107 public function getLayout(){
108 return isset( $this->sectionLayout ) ? $this->sectionLayout : 'fullwidth';
109 }
110
111 public function getStyles(){
112 $this->stylesList = [];
113
114 // Collect styles for general options
115 if( $this->general ){
116 $this->general->setAllOptions( $this );
117 $this->stylesList = Arr::merge( $this->general->getStylesList(), $this->stylesList );
118 }
119
120 return $this->stylesList;
121 }
122
123 /**
124 * Get before init document styles
125 *
126 * @return array
127 */
128 public function getBeforeInitStyles(){
129 $this->general = $this->general ?? new General();
130 $this->general->setAllOptions( $this );
131
132 return $this->general->getBeforeInitStyles();
133 }
134
135 /**
136 * get styles for layers wrapper
137 *
138 * @return array
139 */
140 public function getLayersWrapperStyles(){
141 $styles = [];
142 if( ! empty( $this->wrapperSideSpace ) ){
143 $styles = [ 'default' => [ 'padding-left' => $this->wrapperSideSpace.'px', 'padding-right' => $this->wrapperSideSpace.'px' ] ];
144 }
145
146 return $styles;
147 }
148
149 /**
150 * Get general section styles
151 *
152 * @return array
153 */
154 public function getSectionGeneralStyles(){
155 $this->general = $this->general ?? new General();
156 $this->general->setAllOptions( $this );
157
158 return $this->general->getMinHeightStyles();
159 }
160
161 /**
162 * get callbacks
163 * @param string $sliderName
164 *
165 * @return string
166 */
167 public function getCallbacks( $sliderName = '' ) {
168 $script = '';
169 if ( !empty( $this->callbacks ) ) {
170 foreach ( $this->callbacks as $callback ) {
171 $callback->value = !empty( $sliderName ) ? str_replace( 'depicter.on', $sliderName . '.on', $callback->value ) : $callback->value;
172 $script .= "\n\t$callback->value";
173 }
174 $script .= "\n";
175 }
176
177 return $script;
178 }
179 }
180