PluginProbe
Depicter — Popup & Slider Builder / 1.2.0
Depicter — Popup & Slider Builder v1.2.0
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.2.0, at app/src/Document/Models/Options/All.php

163 lines 2.7 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 return $this->general->getBeforeInitStyles();
132
133 }
134
135 public function getLayersWrapperStyles(){
136 $styles = [];
137 if( ! empty( $this->wrapperSideSpace ) ){
138 $styles = [ 'default' => [ 'padding-left' => $this->wrapperSideSpace.'px', 'padding-right' => $this->wrapperSideSpace.'px' ] ];
139 }
140
141 return $styles;
142 }
143
144 /**
145 * get callbacks
146 * @param string $sliderName
147 *
148 * @return string
149 */
150 public function getCallbacks( $sliderName = '' ) {
151 $script = '';
152 if ( !empty( $this->callbacks ) ) {
153 foreach ( $this->callbacks as $callback ) {
154 $callback->value = !empty( $sliderName ) ? str_replace( 'depicter.on', $sliderName . '.on', $callback->value ) : $callback->value;
155 $script .= "\n\t$callback->value";
156 }
157 $script .= "\n";
158 }
159
160 return $script;
161 }
162 }
163