| @@ -1,69 +1,741 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace ULTP\blocks; |
| 3 | 3 | |
| 4 | -defined( 'ABSPATH' ) || exit; | |
| 4 | +defined('ABSPATH') || exit; | |
| 5 | 5 | |
| 6 | -class Heading { | |
| 6 | +class Heading{ | |
| 7 | + public function __construct() { | |
| 8 | + add_action('init', array($this, 'register')); | |
| 9 | + } | |
| 10 | + public function get_attributes($default = false){ | |
| 7 | 11 | |
| 8 | - public function __construct() { | |
| 9 | - add_action( 'init', array( $this, 'register' ) ); | |
| 10 | - } | |
| 12 | + $attributes = array( | |
| 13 | + 'blockId' => [ | |
| 14 | + 'type' => 'string', | |
| 15 | + 'default' => '', | |
| 16 | + ], | |
| 11 | 17 | |
| 12 | - public function get_attributes() { | |
| 18 | + //-------------------------- | |
| 19 | + // Heading Setting/Style | |
| 20 | + //-------------------------- | |
| 21 | + 'headingText' => [ | |
| 22 | + 'type' => 'string', | |
| 23 | + 'default' => 'This is a Heading Example', | |
| 24 | + ], | |
| 25 | + 'headingURL' => [ | |
| 26 | + 'type' => 'string', | |
| 27 | + 'default' => '', | |
| 28 | + ], | |
| 29 | + 'headingBtnText' => [ | |
| 30 | + 'type' => 'string', | |
| 31 | + 'default' => 'View More', | |
| 32 | + 'style' => [ | |
| 33 | + (object)[ | |
| 34 | + 'depends' => [ | |
| 35 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style11'], | |
| 36 | + ], | |
| 37 | + ], | |
| 38 | + ], | |
| 39 | + ], | |
| 40 | + 'headingStyle' => [ | |
| 41 | + 'type' => 'string', | |
| 42 | + 'default' => 'style9', | |
| 43 | + ], | |
| 44 | + 'headingTag' => [ | |
| 45 | + 'type' => 'string', | |
| 46 | + 'default' => 'h2', | |
| 47 | + ], | |
| 48 | + 'headingAlign' => [ | |
| 49 | + 'type' => 'string', | |
| 50 | + 'default' => 'left', | |
| 51 | + 'style' => [(object)['selector' => '{{ULTP}} .ultp-heading-inner, {{ULTP}} .ultp-sub-heading-inner{ text-align:{{headingAlign}}; }']] | |
| 52 | + ], | |
| 53 | + 'headingTypo' => [ | |
| 54 | + 'type' => 'object', | |
| 55 | + 'default' => (object)['openTypography' => 1,'size' => (object)['lg' => '20', 'unit' => 'px'], 'height' => (object)['lg' => '', 'unit' => 'px'],'decoration' => 'none', 'transform' => 'uppercase', 'family'=>'','weight'=>'700'], | |
| 56 | + 'style' => [(object)['selector' => '{{ULTP}} .ultp-heading-wrap .ultp-heading-inner']] | |
| 57 | + ], | |
| 58 | + 'headingColor' => [ | |
| 59 | + 'type' => 'string', | |
| 60 | + 'default' => '#0e1523', | |
| 61 | + 'style' => [(object)['selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { color:{{headingColor}}; }']], | |
| 62 | + ], | |
| 63 | + 'headingBorderBottomColor' => [ | |
| 64 | + 'type' => 'string', | |
| 65 | + 'default' => '#0e1523', | |
| 66 | + 'style' => [ | |
| 67 | + (object)[ | |
| 68 | + 'depends' => [ | |
| 69 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style3'], | |
| 70 | + ], | |
| 71 | + 'selector'=>'{{ULTP}} .ultp-heading-inner { border-bottom-color:{{headingBorderBottomColor}}; }' | |
| 72 | + ], | |
| 73 | + (object)[ | |
| 74 | + 'depends' => [ | |
| 75 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style4'], | |
| 76 | + ], | |
| 77 | + 'selector'=>'{{ULTP}} .ultp-heading-inner { border-color:{{headingBorderBottomColor}}; }' | |
| 78 | + ], | |
| 79 | + (object)[ | |
| 80 | + 'depends' => [ | |
| 81 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style6'], | |
| 82 | + ], | |
| 83 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span:before { background-color: {{headingBorderBottomColor}}; }' | |
| 84 | + ], | |
| 85 | + (object)[ | |
| 86 | + 'depends' => [ | |
| 87 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style7'], | |
| 88 | + ], | |
| 89 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span:before { background-color: {{headingBorderBottomColor}}; }' | |
| 90 | + ], | |
| 91 | + (object)[ | |
| 92 | + 'depends' => [ | |
| 93 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style8'], | |
| 94 | + ], | |
| 95 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:after { background-color:{{headingBorderBottomColor}}; }' | |
| 96 | + ], | |
| 97 | + (object)[ | |
| 98 | + 'depends' => [ | |
| 99 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style9'], | |
| 100 | + ], | |
| 101 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before { background-color:{{headingBorderBottomColor}}; }' | |
| 102 | + ], | |
| 103 | + (object)[ | |
| 104 | + 'depends' => [ | |
| 105 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style10'], | |
| 106 | + ], | |
| 107 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before { background-color:{{headingBorderBottomColor}}; }' | |
| 108 | + ], | |
| 109 | + (object)[ | |
| 110 | + 'depends' => [ | |
| 111 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style13'], | |
| 112 | + ], | |
| 113 | + 'selector'=>'{{ULTP}} .ultp-heading-inner { border-color:{{headingBorderBottomColor}}; }' | |
| 114 | + ], | |
| 115 | + (object)[ | |
| 116 | + 'depends' => [ | |
| 117 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style14'], | |
| 118 | + ], | |
| 119 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before { background-color:{{headingBorderBottomColor}}; }' | |
| 120 | + ], | |
| 121 | + (object)[ | |
| 122 | + 'depends' => [ | |
| 123 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style15'], | |
| 124 | + ], | |
| 125 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span:before { background-color:{{headingBorderBottomColor}}; }' | |
| 126 | + ], | |
| 127 | + (object)[ | |
| 128 | + 'depends' => [ | |
| 129 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style16'], | |
| 130 | + ], | |
| 131 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span:before { background-color:{{headingBorderBottomColor}}; }' | |
| 132 | + ], | |
| 133 | + (object)[ | |
| 134 | + 'depends' => [ | |
| 135 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style17'], | |
| 136 | + ], | |
| 137 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before { background-color:{{headingBorderBottomColor}}; }' | |
| 138 | + ], | |
| 139 | + (object)[ | |
| 140 | + 'depends' => [ | |
| 141 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style18'], | |
| 142 | + ], | |
| 143 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:after { background-color:{{headingBorderBottomColor}}; }' | |
| 144 | + ], | |
| 145 | + (object)[ | |
| 146 | + 'depends' => [ | |
| 147 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style19'], | |
| 148 | + ], | |
| 149 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before { border-color:{{headingBorderBottomColor}}; }' | |
| 150 | + ], | |
| 151 | + ], | |
| 152 | + ], | |
| 153 | + 'headingBorderBottomColor2' => [ | |
| 154 | + 'type' => 'string', | |
| 155 | + 'default' => '#e5e5e5', | |
| 156 | + 'style' => [ | |
| 157 | + (object)[ | |
| 158 | + 'depends' => [ | |
| 159 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style8'], | |
| 160 | + ], | |
| 161 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before { background-color:{{headingBorderBottomColor2}}; }' | |
| 162 | + ], | |
| 163 | + (object)[ | |
| 164 | + 'depends' => [ | |
| 165 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style10'], | |
| 166 | + ], | |
| 167 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:after { background-color:{{headingBorderBottomColor2}}; }' | |
| 168 | + ], | |
| 169 | + (object)[ | |
| 170 | + 'depends' => [ | |
| 171 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style14'], | |
| 172 | + ], | |
| 173 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:after { background-color:{{headingBorderBottomColor2}}; }' | |
| 174 | + ], | |
| 175 | + (object)[ | |
| 176 | + 'depends' => [ | |
| 177 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style19'], | |
| 178 | + ], | |
| 179 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:after { background-color:{{headingBorderBottomColor2}}; }' | |
| 180 | + ], | |
| 181 | + ], | |
| 182 | + ], | |
| 183 | + 'headingBg' => [ | |
| 184 | + 'type' => 'string', | |
| 185 | + 'default' => '#1740f5', | |
| 186 | + 'style' => [ | |
| 187 | + (object)[ | |
| 188 | + 'depends' => [ | |
| 189 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style5'], | |
| 190 | + ], | |
| 191 | + 'selector'=>'{{ULTP}} .ultp-heading-style5 .ultp-heading-inner span:before { border-color:{{headingBg}} transparent transparent; } {{ULTP}} .ultp-heading-inner span { background-color:{{headingBg}}; }' | |
| 192 | + ], | |
| 193 | + (object)[ | |
| 194 | + 'depends' => [ | |
| 195 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style2'], | |
| 196 | + ], | |
| 197 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span { background-color:{{headingBg}}; }' | |
| 198 | + ], | |
| 199 | + (object)[ | |
| 200 | + 'depends' => [ | |
| 201 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style3'], | |
| 202 | + ], | |
| 203 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span { background-color:{{headingBg}}; }' | |
| 204 | + ], | |
| 205 | + (object)[ | |
| 206 | + 'depends' => [ | |
| 207 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style12'], | |
| 208 | + ], | |
| 209 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span { background-color:{{headingBg}}; }' | |
| 210 | + ], | |
| 211 | + (object)[ | |
| 212 | + 'depends' => [ | |
| 213 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style13'], | |
| 214 | + ], | |
| 215 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span { background-color:{{headingBg}}; }' | |
| 216 | + ], | |
| 217 | + (object)[ | |
| 218 | + 'depends' => [ | |
| 219 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style18'], | |
| 220 | + ], | |
| 221 | + 'selector'=>'{{ULTP}} .ultp-heading-inner { background-color:{{headingBg}}; }' | |
| 222 | + ], | |
| 223 | + (object)[ | |
| 224 | + 'depends' => [ | |
| 225 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style20'], | |
| 226 | + ], | |
| 227 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span:before { border-color:{{headingBg}} transparent transparent; } {{ULTP}} .ultp-heading-inner { background-color:{{headingBg}}; }' | |
| 228 | + ], | |
| 229 | + ], | |
| 230 | + ], | |
| 231 | + 'headingBg2' => [ | |
| 232 | + 'type' => 'string', | |
| 233 | + 'default' => '#e5e5e5', | |
| 234 | + 'style' => [ | |
| 235 | + (object)[ | |
| 236 | + 'depends' => [ | |
| 237 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style12'], | |
| 238 | + ], | |
| 239 | + 'selector'=>'{{ULTP}} .ultp-heading-inner { background-color:{{headingBg2}}; }' | |
| 240 | + ], | |
| 241 | + ], | |
| 242 | + ], | |
| 243 | + 'headingBtnTypo' => [ | |
| 244 | + 'type' => 'object', | |
| 245 | + 'default' => (object)['openTypography' => 1,'size' => (object)['lg' => '14', 'unit' => 'px'], 'height' => (object)['lg' => '', 'unit' => 'px'],'decoration' => 'none','family'=>''], | |
| 246 | + 'style' => [ | |
| 247 | + (object)[ | |
| 248 | + 'depends' => [ | |
| 249 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style11'], | |
| 250 | + ], | |
| 251 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-btn' | |
| 252 | + ], | |
| 253 | + ], | |
| 254 | + ], | |
| 255 | + 'headingBtnColor' => [ | |
| 256 | + 'type' => 'string', | |
| 257 | + 'default' => '#1740f5', | |
| 258 | + 'style' => [ | |
| 259 | + (object)[ | |
| 260 | + 'depends' => [ | |
| 261 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style11'], | |
| 262 | + ], | |
| 263 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-btn { color:{{headingBtnColor}}; } {{ULTP}} .ultp-heading-wrap .ultp-heading-btn svg { fill:{{headingBtnColor}}; }' | |
| 264 | + ], | |
| 265 | + ], | |
| 266 | + ], | |
| 267 | + 'headingBtnHoverColor' => [ | |
| 268 | + 'type' => 'string', | |
| 269 | + 'default' => '#0a31da', | |
| 270 | + 'style' => [ | |
| 271 | + (object)[ | |
| 272 | + 'depends' => [ | |
| 273 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style11'], | |
| 274 | + ], | |
| 275 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-btn:hover { color:{{headingBtnHoverColor}}; } {{ULTP}} .ultp-heading-wrap .ultp-heading-btn:hover svg { fill:{{headingBtnHoverColor}}; }' | |
| 276 | + ], | |
| 277 | + ], | |
| 278 | + ], | |
| 279 | + | |
| 280 | + 'headingBorder' => [ | |
| 281 | + 'type' => 'string', | |
| 282 | + 'default' => '3', | |
| 283 | + 'style' => [ | |
| 284 | + (object)[ | |
| 285 | + 'depends' => [ | |
| 286 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style3'], | |
| 287 | + ], | |
| 288 | + 'selector'=>'{{ULTP}} .ultp-heading-inner { border-bottom-width:{{headingBorder}}px; }' | |
| 289 | + ], | |
| 290 | + (object)[ | |
| 291 | + 'depends' => [ | |
| 292 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style4'], | |
| 293 | + ], | |
| 294 | + 'selector'=>'{{ULTP}} .ultp-heading-inner { border-width:{{headingBorder}}px; }' | |
| 295 | + ], | |
| 296 | + (object)[ | |
| 297 | + 'depends' => [ | |
| 298 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style6'], | |
| 299 | + ], | |
| 300 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span:before { width:{{headingBorder}}px; }' | |
| 301 | + ], | |
| 302 | + (object)[ | |
| 303 | + 'depends' => [ | |
| 304 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style7'], | |
| 305 | + ], | |
| 306 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span:before { height:{{headingBorder}}px; }' | |
| 307 | + ], | |
| 308 | + (object)[ | |
| 309 | + 'depends' => [ | |
| 310 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style8'], | |
| 311 | + ], | |
| 312 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before, {{ULTP}} .ultp-heading-inner:after { height:{{headingBorder}}px; }' | |
| 313 | + ], | |
| 314 | + (object)[ | |
| 315 | + 'depends' => [ | |
| 316 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style9'], | |
| 317 | + ], | |
| 318 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before { height:{{headingBorder}}px; }' | |
| 319 | + ], | |
| 320 | + (object)[ | |
| 321 | + 'depends' => [ | |
| 322 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style10'], | |
| 323 | + ], | |
| 324 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before, {{ULTP}} .ultp-heading-inner:after { height:{{headingBorder}}px; }' | |
| 325 | + ], | |
| 326 | + (object)[ | |
| 327 | + 'depends' => [ | |
| 328 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style13'], | |
| 329 | + ], | |
| 330 | + 'selector'=>'{{ULTP}} .ultp-heading-inner { border-width:{{headingBorder}}px; }' | |
| 331 | + ], | |
| 332 | + (object)[ | |
| 333 | + 'depends' => [ | |
| 334 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style14'], | |
| 335 | + ], | |
| 336 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before, {{ULTP}} .ultp-heading-inner:after { height:{{headingBorder}}px; }' | |
| 337 | + ], | |
| 338 | + (object)[ | |
| 339 | + 'depends' => [ | |
| 340 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style15'], | |
| 341 | + ], | |
| 342 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span:before { height:{{headingBorder}}px; }' | |
| 343 | + ], | |
| 344 | + (object)[ | |
| 345 | + 'depends' => [ | |
| 346 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style16'], | |
| 347 | + ], | |
| 348 | + 'selector'=>'{{ULTP}} .ultp-heading-inner span:before { height:{{headingBorder}}px; }' | |
| 349 | + ], | |
| 350 | + (object)[ | |
| 351 | + 'depends' => [ | |
| 352 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style17'], | |
| 353 | + ], | |
| 354 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:before { height:{{headingBorder}}px; }' | |
| 355 | + ], | |
| 356 | + (object)[ | |
| 357 | + 'depends' => [ | |
| 358 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style19'], | |
| 359 | + ], | |
| 360 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:after { width:{{headingBorder}}px; }' | |
| 361 | + ], | |
| 362 | + (object)[ | |
| 363 | + 'depends' => [ | |
| 364 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style18'], | |
| 365 | + ], | |
| 366 | + 'selector'=>'{{ULTP}} .ultp-heading-inner:after { width:{{headingBorder}}px; }' | |
| 367 | + ], | |
| 368 | + ], | |
| 369 | + ], | |
| 370 | + 'headingSpacing' => [ | |
| 371 | + 'type' => 'object', | |
| 372 | + 'default' => (object)['lg'=>30, 'sm'=>10, 'unit'=>'px'], | |
| 373 | + 'style' => [(object)['selector'=>'{{ULTP}} .ultp-heading-wrap {margin-top:0; margin-bottom:{{headingSpacing}}; }']] | |
| 374 | + ], | |
| 13 | 375 | |
| 14 | - return array( | |
| 15 | - 'blockId' => '', | |
| 16 | - // Heading Setting/Style | |
| 17 | - 'headingText' => 'This is a Heading Example', | |
| 18 | - 'headingURL' => '', | |
| 19 | - 'openInTab' => false, | |
| 20 | - 'headingBtnText' => 'View More', | |
| 21 | - 'headingStyle' => 'style9', | |
| 22 | - 'headingTag' => 'h2', | |
| 23 | - 'headingAlign' => 'left', | |
| 24 | - 'subHeadingShow' => false, | |
| 25 | - 'subHeadingText' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ut sem augue. Sed at felis ut enim dignissim sodales.', | |
| 376 | + 'headingRadius' => [ | |
| 377 | + 'type' => 'object', | |
| 378 | + 'default' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']], | |
| 379 | + 'style' => [ | |
| 380 | + (object)[ | |
| 381 | + 'depends' => [ | |
| 382 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style2'], | |
| 383 | + ], | |
| 384 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { border-radius:{{headingRadius}}; }' | |
| 385 | + ], | |
| 386 | + (object)[ | |
| 387 | + 'depends' => [ | |
| 388 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style3'], | |
| 389 | + ], | |
| 390 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { border-radius:{{headingRadius}}; }' | |
| 391 | + ], | |
| 392 | + (object)[ | |
| 393 | + 'depends' => [ | |
| 394 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style4'], | |
| 395 | + ], | |
| 396 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner { border-radius:{{headingRadius}}; }' | |
| 397 | + ], | |
| 398 | + (object)[ | |
| 399 | + 'depends' => [ | |
| 400 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style5'], | |
| 401 | + ], | |
| 402 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { border-radius:{{headingRadius}}; }' | |
| 403 | + ], | |
| 404 | + (object)[ | |
| 405 | + 'depends' => [ | |
| 406 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style12'], | |
| 407 | + ], | |
| 408 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner { border-radius:{{headingRadius}}; }' | |
| 409 | + ], | |
| 410 | + (object)[ | |
| 411 | + 'depends' => [ | |
| 412 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style13'], | |
| 413 | + ], | |
| 414 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner { border-radius:{{headingRadius}}; }' | |
| 415 | + ], | |
| 416 | + (object)[ | |
| 417 | + 'depends' => [ | |
| 418 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style18'], | |
| 419 | + ], | |
| 420 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner { border-radius:{{headingRadius}}; }' | |
| 421 | + ], | |
| 422 | + (object)[ | |
| 423 | + 'depends' => [ | |
| 424 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style20'], | |
| 425 | + ], | |
| 426 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner { border-radius:{{headingRadius}}; }' | |
| 427 | + ], | |
| 428 | + ] | |
| 429 | + ], | |
| 26 | 430 | |
| 27 | - // Custom Meta Support | |
| 431 | + 'headingPadding' => [ | |
| 432 | + 'type' => 'object', | |
| 433 | + 'default' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']], | |
| 434 | + 'style' => [ | |
| 435 | + (object)[ | |
| 436 | + 'depends' => [ | |
| 437 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style2'], | |
| 438 | + ], | |
| 439 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 440 | + ], | |
| 441 | + (object)[ | |
| 442 | + 'depends' => [ | |
| 443 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style3'], | |
| 444 | + ], | |
| 445 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 446 | + ], | |
| 447 | + (object)[ | |
| 448 | + 'depends' => [ | |
| 449 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style4'], | |
| 450 | + ], | |
| 451 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 452 | + ], | |
| 453 | + (object)[ | |
| 454 | + 'depends' => [ | |
| 455 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style5'], | |
| 456 | + ], | |
| 457 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 458 | + ], | |
| 459 | + (object)[ | |
| 460 | + 'depends' => [ | |
| 461 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style6'], | |
| 462 | + ], | |
| 463 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 464 | + ], | |
| 465 | + (object)[ | |
| 466 | + 'depends' => [ | |
| 467 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style12'], | |
| 468 | + ], | |
| 469 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 470 | + ], | |
| 471 | + (object)[ | |
| 472 | + 'depends' => [ | |
| 473 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style13'], | |
| 474 | + ], | |
| 475 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 476 | + ], | |
| 477 | + (object)[ | |
| 478 | + 'depends' => [ | |
| 479 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style18'], | |
| 480 | + ], | |
| 481 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 482 | + ], | |
| 483 | + (object)[ | |
| 484 | + 'depends' => [ | |
| 485 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style19'], | |
| 486 | + ], | |
| 487 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 488 | + ], | |
| 489 | + (object)[ | |
| 490 | + 'depends' => [ | |
| 491 | + (object)['key'=>'headingStyle','condition'=>'==','value'=>'style20'], | |
| 492 | + ], | |
| 493 | + 'selector'=>'{{ULTP}} .ultp-heading-wrap .ultp-heading-inner span { padding:{{headingPadding}}; }' | |
| 494 | + ], | |
| 495 | + ] | |
| 496 | + ], | |
| 497 | + 'subHeadingShow' => [ | |
| 498 | + 'type' => 'boolean', | |
| 499 | + 'default' => false, | |
| 500 | + ], | |
| 501 | + 'subHeadingText' => [ | |
| 502 | + 'type' => 'string', | |
| 503 | + 'default' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ut sem augue. Sed at felis ut enim dignissim sodales.', | |
| 504 | + 'style' => [ | |
| 505 | + (object)[ | |
| 506 | + 'depends' => [ | |
| 507 | + (object)['key'=>'subHeadingShow','condition'=>'==','value'=>true], | |
| 508 | + ], | |
| 509 | + ], | |
| 510 | + ], | |
| 511 | + ], | |
| 512 | + 'subHeadingTypo' => [ | |
| 513 | + 'type' => 'object', | |
| 514 | + 'default' => (object)['openTypography'=>1,'size'=>(object)['lg'=>'16', 'unit'=>'px'], 'spacing'=>(object)[ 'lg'=>'0', 'unit'=>'px'], 'height'=>(object)[ 'lg'=>'27', 'unit'=>'px'],'decoration'=>'none','transform' => 'capitalize','family'=>'','weight'=>'500'], | |
| 515 | + 'style' => [ | |
| 516 | + (object)[ | |
| 517 | + 'depends' => [ | |
| 518 | + (object)['key'=>'subHeadingShow','condition'=>'==','value'=>true], | |
| 519 | + ], | |
| 520 | + 'selector'=>'{{ULTP}} .ultp-sub-heading div' | |
| 521 | + ], | |
| 522 | + ], | |
| 523 | + ], | |
| 524 | + 'subHeadingColor' => [ | |
| 525 | + 'type' => 'string', | |
| 526 | + 'default' => '#989898', | |
| 527 | + 'style' => [ | |
| 528 | + (object)[ | |
| 529 | + 'depends' => [ | |
| 530 | + (object)['key'=>'subHeadingShow','condition'=>'==','value'=>true], | |
| 531 | + ], | |
| 532 | + 'selector'=>'{{ULTP}} .ultp-sub-heading div{ color:{{subHeadingColor}}; }' | |
| 533 | + ], | |
| 534 | + ], | |
| 535 | + ], | |
| 536 | + 'subHeadingSpacing' => [ | |
| 537 | + 'type' => 'object', | |
| 538 | + 'default' => (object)['lg' =>(object)['unit' =>'px']], | |
| 539 | + 'style' => [ | |
| 540 | + (object)[ | |
| 541 | + 'depends' => [ | |
| 542 | + (object)['key'=>'subHeadingShow','condition'=>'==','value'=>true], | |
| 543 | + ], | |
| 544 | + 'selector'=>'{{ULTP}} div.ultp-sub-heading-inner{ margin:{{subHeadingSpacing}}; }' | |
| 545 | + ], | |
| 546 | + ], | |
| 547 | + ], | |
| 28 | 548 | |
| 29 | - // Wrapper Style | |
| 30 | - 'advanceId' => '', | |
| 31 | - 'advanceZindex' => '', | |
| 32 | - 'hideExtraLarge' => false, | |
| 33 | - 'hideTablet' => false, | |
| 34 | - 'hideMobile' => false, | |
| 35 | - 'advanceCss' => '', | |
| 36 | - ); | |
| 37 | - } | |
| 549 | + //-------------------------- | |
| 550 | + // Wrapper Style | |
| 551 | + //-------------------------- | |
| 552 | + 'wrapBg' => [ | |
| 553 | + 'type' => 'object', | |
| 554 | + 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#f5f5f5'], | |
| 555 | + 'style' => [ | |
| 556 | + (object)[ | |
| 557 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper' | |
| 558 | + ], | |
| 559 | + ], | |
| 560 | + ], | |
| 561 | + 'wrapBorder' => [ | |
| 562 | + 'type' => 'object', | |
| 563 | + 'default' => (object)['openBorder'=>0, 'width' =>(object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'], | |
| 564 | + 'style' => [ | |
| 565 | + (object)[ | |
| 566 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper' | |
| 567 | + ], | |
| 568 | + ], | |
| 569 | + ], | |
| 570 | + 'wrapShadow' => [ | |
| 571 | + 'type' => 'object', | |
| 572 | + 'default' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'], | |
| 573 | + 'style' => [ | |
| 574 | + (object)[ | |
| 575 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper' | |
| 576 | + ], | |
| 577 | + ], | |
| 578 | + ], | |
| 579 | + 'wrapRadius' => [ | |
| 580 | + 'type' => 'object', | |
| 581 | + 'default' => (object)['lg' =>'', 'unit' =>'px'], | |
| 582 | + 'style' => [ | |
| 583 | + (object)[ | |
| 584 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper { border-radius:{{wrapRadius}}; }' | |
| 585 | + ], | |
| 586 | + ], | |
| 587 | + ], | |
| 588 | + 'wrapHoverBackground' => [ | |
| 589 | + 'type' => 'object', | |
| 590 | + 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#1740f5'], | |
| 591 | + 'style' => [ | |
| 592 | + (object)[ | |
| 593 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover' | |
| 594 | + ], | |
| 595 | + ], | |
| 596 | + ], | |
| 597 | + 'wrapHoverBorder' => [ | |
| 598 | + 'type' => 'object', | |
| 599 | + 'default' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'], | |
| 600 | + 'style' => [ | |
| 601 | + (object)[ | |
| 602 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover' | |
| 603 | + ], | |
| 604 | + ], | |
| 605 | + ], | |
| 606 | + 'wrapHoverRadius' => [ | |
| 607 | + 'type' => 'object', | |
| 608 | + 'default' => (object)['lg' =>'', 'unit' =>'px'], | |
| 609 | + 'style' => [ | |
| 610 | + (object)[ | |
| 611 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover { border-radius:{{wrapHoverRadius}}; }' | |
| 612 | + ], | |
| 613 | + ], | |
| 614 | + ], | |
| 615 | + 'wrapHoverShadow' => [ | |
| 616 | + 'type' => 'object', | |
| 617 | + 'default' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'], | |
| 618 | + 'style' => [ | |
| 619 | + (object)[ | |
| 620 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover' | |
| 621 | + ], | |
| 622 | + ], | |
| 623 | + ], | |
| 624 | + 'wrapMargin' => [ | |
| 625 | + 'type' => 'object', | |
| 626 | + 'default' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']], | |
| 627 | + 'style' => [ | |
| 628 | + (object)[ | |
| 629 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper { margin:{{wrapMargin}}; }' | |
| 630 | + ], | |
| 631 | + ], | |
| 632 | + ], | |
| 633 | + 'wrapOuterPadding' => [ | |
| 634 | + 'type' => 'object', | |
| 635 | + 'default' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']], | |
| 636 | + 'style' => [ | |
| 637 | + (object)[ | |
| 638 | + 'selector'=>'{{ULTP}} .ultp-block-wrapper { padding:{{wrapOuterPadding}}; }' | |
| 639 | + ], | |
| 640 | + ], | |
| 641 | + ], | |
| 642 | + 'advanceId' => [ | |
| 643 | + 'type' => 'string', | |
| 644 | + 'default' => '', | |
| 645 | + ], | |
| 646 | + 'advanceZindex' => [ | |
| 647 | + 'type' => 'number', | |
| 648 | + 'default' => '', | |
| 649 | + 'style' => [ | |
| 650 | + (object)[ | |
| 651 | + 'selector' => '{{ULTP}} {z-index:{{advanceZindex}};}' | |
| 652 | + ], | |
| 653 | + ], | |
| 654 | + ], | |
| 655 | + 'hideExtraLarge' => [ | |
| 656 | + 'type' => 'boolean', | |
| 657 | + 'default' => false, | |
| 658 | + 'style' => [ | |
| 659 | + (object)[ | |
| 660 | + 'selector' => '{{ULTP}} {display:none;}' | |
| 661 | + ], | |
| 662 | + ], | |
| 663 | + ], | |
| 664 | + 'hideDesktop' => [ | |
| 665 | + 'type' => 'boolean', | |
| 666 | + 'default' => false, | |
| 667 | + 'style' => [ | |
| 668 | + (object)[ | |
| 669 | + 'selector' => '{{ULTP}} {display:none;}' | |
| 670 | + ], | |
| 671 | + ], | |
| 672 | + ], | |
| 673 | + 'hideTablet' => [ | |
| 674 | + 'type' => 'boolean', | |
| 675 | + 'default' => false, | |
| 676 | + 'style' => [ | |
| 677 | + (object)[ | |
| 678 | + 'selector' => '{{ULTP}} {display:none;}' | |
| 679 | + ], | |
| 680 | + ], | |
| 681 | + ], | |
| 682 | + 'hideMobile' => [ | |
| 683 | + 'type' => 'boolean', | |
| 684 | + 'default' => false, | |
| 685 | + 'style' => [ | |
| 686 | + (object)[ | |
| 687 | + 'selector' => '{{ULTP}} {display:none;}' | |
| 688 | + ], | |
| 689 | + ], | |
| 690 | + ], | |
| 691 | + 'advanceCss' => [ | |
| 692 | + 'type' => 'string', | |
| 693 | + 'default' => '', | |
| 694 | + 'style' => [ | |
| 695 | + (object)[ | |
| 696 | + 'selector' => '{{ULTP}} {display:none;}' | |
| 697 | + ], | |
| 698 | + ], | |
| 699 | + ], | |
| 700 | + ); | |
| 701 | + | |
| 702 | + if( $default ){ | |
| 703 | + $temp = array(); | |
| 704 | + foreach ($attributes as $key => $value) { | |
| 705 | + if( isset($value['default']) ){ | |
| 706 | + $temp[$key] = $value['default']; | |
| 707 | + } | |
| 708 | + } | |
| 709 | + return $temp; | |
| 710 | + }else{ | |
| 711 | + return $attributes; | |
| 712 | + } | |
| 713 | + } | |
| 38 | 714 | |
| 39 | - public function register() { | |
| 40 | - register_block_type( | |
| 41 | - 'ultimate-post/heading', | |
| 42 | - array( | |
| 43 | - 'editor_script' => 'ultp-blocks-editor-script', | |
| 44 | - 'editor_style' => 'ultp-blocks-editor-css', | |
| 45 | - 'render_callback' => array( $this, 'content' ), | |
| 46 | - ) | |
| 47 | - ); | |
| 48 | - } | |
| 715 | + public function register() { | |
| 716 | + register_block_type( 'ultimate-post/heading', | |
| 717 | + array( | |
| 718 | + 'attributes' => $this->get_attributes(), | |
| 719 | + 'description' => __( 'Show heading or title with ultimate controls.' ), | |
| 720 | + 'keywords' => [ __( 'heading' ), __( 'title' ), __( 'section' ) ], | |
| 721 | + 'render_callback' => array($this, 'content') | |
| 722 | + ) | |
| 723 | + ); | |
| 724 | + } | |
| 49 | 725 | |
| 50 | - public function content( $attr, $noAjax ) { | |
| 51 | - $attr = wp_parse_args( $attr, $this->get_attributes() ); | |
| 726 | + public function content($attr, $noAjax) { | |
| 52 | 727 | |
| 53 | - $wraper_before = ''; | |
| 54 | - $block_name = 'heading'; | |
| 55 | - $attr['headingShow'] = true; | |
| 56 | - $attr['className'] = isset( $attr['className'] ) && $attr['className'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['className'] ) : ''; | |
| 57 | - $attr['align'] = isset( $attr['align'] ) && $attr['align'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['align'] ) : ''; | |
| 58 | - $attr['advanceId'] = isset( $attr['advanceId'] ) ? sanitize_html_class( $attr['advanceId'] ) : ''; | |
| 59 | - $attr['blockId'] = isset( $attr['blockId'] ) ? sanitize_html_class( $attr['blockId'] ) : ''; | |
| 728 | + $wraper_before = ''; | |
| 729 | + $block_name = 'heading'; | |
| 730 | + $attr['headingShow'] = true; | |
| 60 | 731 | |
| 61 | - $wraper_before .= '<div ' . ( $attr['advanceId'] ? 'id="' . $attr['advanceId'] . '" ' : '' ) . ' class="wp-block-ultimate-post-' . $block_name . ' ultp-block-' . $attr['blockId'] . '' . ( $attr['align'] ? ' align' . $attr['align'] : '' ) . '' . ( $attr['className'] ? ' ' . $attr['className'] : '' ) . '">'; | |
| 62 | - $wraper_before .= '<div class="ultp-block-wrapper">'; | |
| 63 | - include ULTP_PATH . 'blocks/template/heading.php'; | |
| 64 | - $wraper_before .= '</div>'; | |
| 65 | - $wraper_before .= '</div>'; | |
| 732 | + $wraper_before .= '<div '.($attr['advanceId']?'id="'.$attr['advanceId'].'" ':'').' class="wp-block-ultimate-post-'.$block_name.' ultp-block-'.$attr["blockId"].''.(isset($attr["align"])? ' align' .$attr["align"]:'').''.(isset($attr["className"])?' '.$attr["className"]:'').'">'; | |
| 733 | + $wraper_before .= '<div class="ultp-block-wrapper">'; | |
| 734 | + include ULTP_PATH.'blocks/template/heading.php'; | |
| 735 | + $wraper_before .= '</div>'; | |
| 736 | + $wraper_before .= '</div>'; | |
| 66 | 737 | |
| 67 | - return $wraper_before; | |
| 68 | - } | |
| 69 | -} | |
| 738 | + return $wraper_before; | |
| 739 | + } | |
| 740 | + | |
| 741 | +} | |