| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly. |
| 4 |
defined( 'ABSPATH' ) || exit; |
| 5 |
|
| 6 |
if ( ! class_exists( 'Qi_Blocks_Search_Block' ) ) { |
| 7 |
class Qi_Blocks_Search_Block extends Qi_Blocks_Blocks { |
| 8 |
private static $instance; |
| 9 |
|
| 10 |
public function __construct() { |
| 11 |
// Set block data |
| 12 |
$this->set_block_name( 'search' ); |
| 13 |
$this->set_block_title( esc_html__( 'Search', 'qi-blocks' ) ); |
| 14 |
$this->set_block_subcategory( esc_html__( 'Content', 'qi-blocks' ) ); |
| 15 |
$this->set_block_demo_url( 'https://qodeinteractive.com/qi-blocks-for-gutenberg/search/#search' ); |
| 16 |
$this->set_block_documentation( 'https://qodeinteractive.com/qi-blocks-for-gutenberg/documentation/#search' ); |
| 17 |
|
| 18 |
$block_options = array( |
| 19 |
'render_callback' => array( $this, 'dynamic_render_callback' ), |
| 20 |
'attributes' => array_merge( |
| 21 |
array( |
| 22 |
'uniqueClass' => array( |
| 23 |
'type' => 'string', |
| 24 |
'default' => '', |
| 25 |
), |
| 26 |
'blockContainerIds' => array( |
| 27 |
'type' => 'string', |
| 28 |
'default' => '', |
| 29 |
), |
| 30 |
'blockContainerData' => array( |
| 31 |
'type' => 'string', |
| 32 |
'default' => '', |
| 33 |
), |
| 34 |
'blockContainerClasses' => array( |
| 35 |
'type' => 'string', |
| 36 |
'default' => '', |
| 37 |
), |
| 38 |
), |
| 39 |
qi_blocks_get_block_container_attributes(), |
| 40 |
array( |
| 41 |
'layout' => array( |
| 42 |
'type' => 'string', |
| 43 |
'default' => 'button-inline', |
| 44 |
), |
| 45 |
'showWidgetTitle' => array( |
| 46 |
'type' => 'boolean', |
| 47 |
'default' => false, |
| 48 |
), |
| 49 |
'widgetTitle' => array( |
| 50 |
'type' => 'string', |
| 51 |
'default' => '', |
| 52 |
), |
| 53 |
'widgetTitleTag' => array( |
| 54 |
'type' => 'string', |
| 55 |
'default' => 'h5', |
| 56 |
), |
| 57 |
'inputPlaceholder' => array( |
| 58 |
'type' => 'string', |
| 59 |
'default' => '', |
| 60 |
), |
| 61 |
'buttonType' => array( |
| 62 |
'type' => 'string', |
| 63 |
'default' => 'text', |
| 64 |
), |
| 65 |
'buttonText' => array( |
| 66 |
'type' => 'string', |
| 67 |
'default' => esc_html__( 'Search', 'qi-blocks' ), |
| 68 |
), |
| 69 |
'buttonIcon' => array( |
| 70 |
'type' => 'object', |
| 71 |
'default' => array( |
| 72 |
'html' => qi_blocks_get_svg_icon( 'search' ), |
| 73 |
), |
| 74 |
), |
| 75 |
'spaceBetweenInputAndButton' => array( |
| 76 |
'type' => 'number', |
| 77 |
'default' => '', |
| 78 |
), |
| 79 |
'spaceBetweenInputAndButtonUnit' => array( |
| 80 |
'type' => 'string', |
| 81 |
'default' => 'px', |
| 82 |
), |
| 83 |
'spaceBetweenInputAndButtonDecimal' => array( |
| 84 |
'type' => 'number', |
| 85 |
'default' => '', |
| 86 |
), |
| 87 |
'spaceBetweenInputAndButtonTablet' => array( |
| 88 |
'type' => 'number', |
| 89 |
'default' => '', |
| 90 |
), |
| 91 |
'spaceBetweenInputAndButtonMobile' => array( |
| 92 |
'type' => 'number', |
| 93 |
'default' => '', |
| 94 |
), |
| 95 |
'spaceBetweenInputAndButtonUnitTablet' => array( |
| 96 |
'type' => 'string', |
| 97 |
'default' => 'px', |
| 98 |
), |
| 99 |
'spaceBetweenInputAndButtonUnitMobile' => array( |
| 100 |
'type' => 'string', |
| 101 |
'default' => 'px', |
| 102 |
), |
| 103 |
'spaceBetweenInputAndButtonDecimalTablet' => array( |
| 104 |
'type' => 'number', |
| 105 |
'default' => '', |
| 106 |
), |
| 107 |
'spaceBetweenInputAndButtonDecimalMobile' => array( |
| 108 |
'type' => 'number', |
| 109 |
'default' => '', |
| 110 |
), |
| 111 |
'titleFontSize' => array( |
| 112 |
'type' => 'number', |
| 113 |
'default' => '', |
| 114 |
), |
| 115 |
'titleFontSizeUnit' => array( |
| 116 |
'type' => 'string', |
| 117 |
'default' => 'px', |
| 118 |
), |
| 119 |
'titleFontSizeDecimal' => array( |
| 120 |
'type' => 'number', |
| 121 |
'default' => '', |
| 122 |
), |
| 123 |
'titleFontSizeTablet' => array( |
| 124 |
'type' => 'number', |
| 125 |
'default' => '', |
| 126 |
), |
| 127 |
'titleFontSizeMobile' => array( |
| 128 |
'type' => 'number', |
| 129 |
'default' => '', |
| 130 |
), |
| 131 |
'titleFontSizeUnitTablet' => array( |
| 132 |
'type' => 'string', |
| 133 |
'default' => 'px', |
| 134 |
), |
| 135 |
'titleFontSizeUnitMobile' => array( |
| 136 |
'type' => 'string', |
| 137 |
'default' => 'px', |
| 138 |
), |
| 139 |
'titleFontSizeDecimalTablet' => array( |
| 140 |
'type' => 'number', |
| 141 |
'default' => '', |
| 142 |
), |
| 143 |
'titleFontSizeDecimalMobile' => array( |
| 144 |
'type' => 'number', |
| 145 |
'default' => '', |
| 146 |
), |
| 147 |
'titleFontWeight' => array( |
| 148 |
'type' => 'string', |
| 149 |
'default' => '', |
| 150 |
), |
| 151 |
'titleTextTransform' => array( |
| 152 |
'type' => 'string', |
| 153 |
'default' => '', |
| 154 |
), |
| 155 |
'titleFontStyle' => array( |
| 156 |
'type' => 'string', |
| 157 |
'default' => '', |
| 158 |
), |
| 159 |
'titleTextDecoration' => array( |
| 160 |
'type' => 'string', |
| 161 |
'default' => '', |
| 162 |
), |
| 163 |
'titleLineHeight' => array( |
| 164 |
'type' => 'number', |
| 165 |
'default' => '', |
| 166 |
), |
| 167 |
'titleLineHeightUnit' => array( |
| 168 |
'type' => 'string', |
| 169 |
'default' => 'px', |
| 170 |
), |
| 171 |
'titleLineHeightDecimal' => array( |
| 172 |
'type' => 'number', |
| 173 |
'default' => '', |
| 174 |
), |
| 175 |
'titleLineHeightTablet' => array( |
| 176 |
'type' => 'number', |
| 177 |
'default' => '', |
| 178 |
), |
| 179 |
'titleLineHeightMobile' => array( |
| 180 |
'type' => 'number', |
| 181 |
'default' => '', |
| 182 |
), |
| 183 |
'titleLineHeightUnitTablet' => array( |
| 184 |
'type' => 'string', |
| 185 |
'default' => 'px', |
| 186 |
), |
| 187 |
'titleLineHeightUnitMobile' => array( |
| 188 |
'type' => 'string', |
| 189 |
'default' => 'px', |
| 190 |
), |
| 191 |
'titleLineHeightDecimalTablet' => array( |
| 192 |
'type' => 'number', |
| 193 |
'default' => '', |
| 194 |
), |
| 195 |
'titleLineHeightDecimalMobile' => array( |
| 196 |
'type' => 'number', |
| 197 |
'default' => '', |
| 198 |
), |
| 199 |
'titleLetterSpacing' => array( |
| 200 |
'type' => 'number', |
| 201 |
'default' => '', |
| 202 |
), |
| 203 |
'titleLetterSpacingUnit' => array( |
| 204 |
'type' => 'string', |
| 205 |
'default' => 'px', |
| 206 |
), |
| 207 |
'titleLetterSpacingDecimal' => array( |
| 208 |
'type' => 'number', |
| 209 |
'default' => '', |
| 210 |
), |
| 211 |
'titleLetterSpacingTablet' => array( |
| 212 |
'type' => 'number', |
| 213 |
'default' => '', |
| 214 |
), |
| 215 |
'titleLetterSpacingMobile' => array( |
| 216 |
'type' => 'number', |
| 217 |
'default' => '', |
| 218 |
), |
| 219 |
'titleLetterSpacingUnitTablet' => array( |
| 220 |
'type' => 'string', |
| 221 |
'default' => 'px', |
| 222 |
), |
| 223 |
'titleLetterSpacingUnitMobile' => array( |
| 224 |
'type' => 'string', |
| 225 |
'default' => 'px', |
| 226 |
), |
| 227 |
'titleLetterSpacingDecimalTablet' => array( |
| 228 |
'type' => 'number', |
| 229 |
'default' => '', |
| 230 |
), |
| 231 |
'titleLetterSpacingDecimalMobile' => array( |
| 232 |
'type' => 'number', |
| 233 |
'default' => '', |
| 234 |
), |
| 235 |
'titleMarginBottom' => array( |
| 236 |
'type' => 'number', |
| 237 |
'default' => '', |
| 238 |
), |
| 239 |
'titleMarginBottomUnit' => array( |
| 240 |
'type' => 'string', |
| 241 |
'default' => 'px', |
| 242 |
), |
| 243 |
'titleMarginBottomDecimal' => array( |
| 244 |
'type' => 'number', |
| 245 |
'default' => '', |
| 246 |
), |
| 247 |
'titleMarginBottomTablet' => array( |
| 248 |
'type' => 'number', |
| 249 |
'default' => '', |
| 250 |
), |
| 251 |
'titleMarginBottomMobile' => array( |
| 252 |
'type' => 'number', |
| 253 |
'default' => '', |
| 254 |
), |
| 255 |
'titleMarginBottomUnitTablet' => array( |
| 256 |
'type' => 'string', |
| 257 |
'default' => 'px', |
| 258 |
), |
| 259 |
'titleMarginBottomUnitMobile' => array( |
| 260 |
'type' => 'string', |
| 261 |
'default' => 'px', |
| 262 |
), |
| 263 |
'titleMarginBottomDecimalTablet' => array( |
| 264 |
'type' => 'number', |
| 265 |
'default' => '', |
| 266 |
), |
| 267 |
'titleMarginBottomDecimalMobile' => array( |
| 268 |
'type' => 'number', |
| 269 |
'default' => '', |
| 270 |
), |
| 271 |
'inputColor' => array( |
| 272 |
'type' => 'string', |
| 273 |
'default' => '', |
| 274 |
), |
| 275 |
'inputFocusColor' => array( |
| 276 |
'type' => 'string', |
| 277 |
'default' => '', |
| 278 |
), |
| 279 |
'inputBackgroundColor' => array( |
| 280 |
'type' => 'string', |
| 281 |
'default' => '', |
| 282 |
), |
| 283 |
'inputFocusBackgroundColor' => array( |
| 284 |
'type' => 'string', |
| 285 |
'default' => '', |
| 286 |
), |
| 287 |
'inputBorderColor' => array( |
| 288 |
'type' => 'string', |
| 289 |
'default' => '', |
| 290 |
), |
| 291 |
'inputFocusBorderColor' => array( |
| 292 |
'type' => 'string', |
| 293 |
'default' => '', |
| 294 |
), |
| 295 |
), |
| 296 |
qi_blocks_get_block_option_typography_attributes( 'input' ), |
| 297 |
qi_blocks_get_block_option_typography_attributes( 'inputFocus' ), |
| 298 |
array( |
| 299 |
'inputBorderStyle' => array( |
| 300 |
'type' => 'string', |
| 301 |
'default' => '', |
| 302 |
), |
| 303 |
'inputBorderWidthTop' => array( |
| 304 |
'type' => 'number', |
| 305 |
'default' => '', |
| 306 |
), |
| 307 |
'inputBorderWidthTopTablet' => array( |
| 308 |
'type' => 'number', |
| 309 |
'default' => '', |
| 310 |
), |
| 311 |
'inputBorderWidthTopMobile' => array( |
| 312 |
'type' => 'number', |
| 313 |
'default' => '', |
| 314 |
), |
| 315 |
'inputBorderWidthRight' => array( |
| 316 |
'type' => 'number', |
| 317 |
'default' => '', |
| 318 |
), |
| 319 |
'inputBorderWidthRightTablet' => array( |
| 320 |
'type' => 'number', |
| 321 |
'default' => '', |
| 322 |
), |
| 323 |
'inputBorderWidthRightMobile' => array( |
| 324 |
'type' => 'number', |
| 325 |
'default' => '', |
| 326 |
), |
| 327 |
'inputBorderWidthBottom' => array( |
| 328 |
'type' => 'number', |
| 329 |
'default' => '', |
| 330 |
), |
| 331 |
'inputBorderWidthBottomTablet' => array( |
| 332 |
'type' => 'number', |
| 333 |
'default' => '', |
| 334 |
), |
| 335 |
'inputBorderWidthBottomMobile' => array( |
| 336 |
'type' => 'number', |
| 337 |
'default' => '', |
| 338 |
), |
| 339 |
'inputBorderWidthLeft' => array( |
| 340 |
'type' => 'number', |
| 341 |
'default' => '', |
| 342 |
), |
| 343 |
'inputBorderWidthLeftTablet' => array( |
| 344 |
'type' => 'number', |
| 345 |
'default' => '', |
| 346 |
), |
| 347 |
'inputBorderWidthLeftMobile' => array( |
| 348 |
'type' => 'number', |
| 349 |
'default' => '', |
| 350 |
), |
| 351 |
'inputBorderWidthUnit' => array( |
| 352 |
'type' => 'string', |
| 353 |
'default' => 'px', |
| 354 |
), |
| 355 |
'inputBorderWidthUnitTablet' => array( |
| 356 |
'type' => 'string', |
| 357 |
'default' => 'px', |
| 358 |
), |
| 359 |
'inputBorderWidthUnitMobile' => array( |
| 360 |
'type' => 'string', |
| 361 |
'default' => 'px', |
| 362 |
), |
| 363 |
'inputBorderRadiusTop' => array( |
| 364 |
'type' => 'number', |
| 365 |
'default' => '', |
| 366 |
), |
| 367 |
'inputBorderRadiusTopTablet' => array( |
| 368 |
'type' => 'number', |
| 369 |
'default' => '', |
| 370 |
), |
| 371 |
'inputBorderRadiusTopMobile' => array( |
| 372 |
'type' => 'number', |
| 373 |
'default' => '', |
| 374 |
), |
| 375 |
'inputBorderRadiusTopDecimal' => array( |
| 376 |
'type' => 'number', |
| 377 |
'default' => '', |
| 378 |
), |
| 379 |
'inputBorderRadiusTopDecimalTablet' => array( |
| 380 |
'type' => 'number', |
| 381 |
'default' => '', |
| 382 |
), |
| 383 |
'inputBorderRadiusTopDecimalMobile' => array( |
| 384 |
'type' => 'number', |
| 385 |
'default' => '', |
| 386 |
), |
| 387 |
'inputBorderRadiusRight' => array( |
| 388 |
'type' => 'number', |
| 389 |
'default' => '', |
| 390 |
), |
| 391 |
'inputBorderRadiusRightTablet' => array( |
| 392 |
'type' => 'number', |
| 393 |
'default' => '', |
| 394 |
), |
| 395 |
'inputBorderRadiusRightMobile' => array( |
| 396 |
'type' => 'number', |
| 397 |
'default' => '', |
| 398 |
), |
| 399 |
'inputBorderRadiusRightDecimal' => array( |
| 400 |
'type' => 'number', |
| 401 |
'default' => '', |
| 402 |
), |
| 403 |
'inputBorderRadiusRightDecimalTablet' => array( |
| 404 |
'type' => 'number', |
| 405 |
'default' => '', |
| 406 |
), |
| 407 |
'inputBorderRadiusRightDecimalMobile' => array( |
| 408 |
'type' => 'number', |
| 409 |
'default' => '', |
| 410 |
), |
| 411 |
'inputBorderRadiusBottom' => array( |
| 412 |
'type' => 'number', |
| 413 |
'default' => '', |
| 414 |
), |
| 415 |
'inputBorderRadiusBottomTablet' => array( |
| 416 |
'type' => 'number', |
| 417 |
'default' => '', |
| 418 |
), |
| 419 |
'inputBorderRadiusBottomMobile' => array( |
| 420 |
'type' => 'number', |
| 421 |
'default' => '', |
| 422 |
), |
| 423 |
'inputBorderRadiusBottomDecimal' => array( |
| 424 |
'type' => 'number', |
| 425 |
'default' => '', |
| 426 |
), |
| 427 |
'inputBorderRadiusBottomDecimalTablet' => array( |
| 428 |
'type' => 'number', |
| 429 |
'default' => '', |
| 430 |
), |
| 431 |
'inputBorderRadiusBottomDecimalMobile' => array( |
| 432 |
'type' => 'number', |
| 433 |
'default' => '', |
| 434 |
), |
| 435 |
'inputBorderRadiusLeft' => array( |
| 436 |
'type' => 'number', |
| 437 |
'default' => '', |
| 438 |
), |
| 439 |
'inputBorderRadiusLeftTablet' => array( |
| 440 |
'type' => 'number', |
| 441 |
'default' => '', |
| 442 |
), |
| 443 |
'inputBorderRadiusLeftMobile' => array( |
| 444 |
'type' => 'number', |
| 445 |
'default' => '', |
| 446 |
), |
| 447 |
'inputBorderRadiusLeftDecimal' => array( |
| 448 |
'type' => 'number', |
| 449 |
'default' => '', |
| 450 |
), |
| 451 |
'inputBorderRadiusLeftDecimalTablet' => array( |
| 452 |
'type' => 'number', |
| 453 |
'default' => '', |
| 454 |
), |
| 455 |
'inputBorderRadiusLeftDecimalMobile' => array( |
| 456 |
'type' => 'number', |
| 457 |
'default' => '', |
| 458 |
), |
| 459 |
'inputBorderRadiusUnit' => array( |
| 460 |
'type' => 'string', |
| 461 |
'default' => 'px', |
| 462 |
), |
| 463 |
'inputBorderRadiusUnitTablet' => array( |
| 464 |
'type' => 'string', |
| 465 |
'default' => 'px', |
| 466 |
), |
| 467 |
'inputBorderRadiusUnitMobile' => array( |
| 468 |
'type' => 'string', |
| 469 |
'default' => 'px', |
| 470 |
), |
| 471 |
'inputPaddingTop' => array( |
| 472 |
'type' => 'number', |
| 473 |
'default' => '', |
| 474 |
), |
| 475 |
'inputPaddingTopTablet' => array( |
| 476 |
'type' => 'number', |
| 477 |
'default' => '', |
| 478 |
), |
| 479 |
'inputPaddingTopMobile' => array( |
| 480 |
'type' => 'number', |
| 481 |
'default' => '', |
| 482 |
), |
| 483 |
'inputPaddingTopDecimal' => array( |
| 484 |
'type' => 'number', |
| 485 |
'default' => '', |
| 486 |
), |
| 487 |
'inputPaddingTopDecimalTablet' => array( |
| 488 |
'type' => 'number', |
| 489 |
'default' => '', |
| 490 |
), |
| 491 |
'inputPaddingTopDecimalMobile' => array( |
| 492 |
'type' => 'number', |
| 493 |
'default' => '', |
| 494 |
), |
| 495 |
'inputPaddingRight' => array( |
| 496 |
'type' => 'number', |
| 497 |
'default' => '', |
| 498 |
), |
| 499 |
'inputPaddingRightTablet' => array( |
| 500 |
'type' => 'number', |
| 501 |
'default' => '', |
| 502 |
), |
| 503 |
'inputPaddingRightMobile' => array( |
| 504 |
'type' => 'number', |
| 505 |
'default' => '', |
| 506 |
), |
| 507 |
'inputPaddingRightDecimal' => array( |
| 508 |
'type' => 'number', |
| 509 |
'default' => '', |
| 510 |
), |
| 511 |
'inputPaddingRightDecimalTablet' => array( |
| 512 |
'type' => 'number', |
| 513 |
'default' => '', |
| 514 |
), |
| 515 |
'inputPaddingRightDecimalMobile' => array( |
| 516 |
'type' => 'number', |
| 517 |
'default' => '', |
| 518 |
), |
| 519 |
'inputPaddingBottom' => array( |
| 520 |
'type' => 'number', |
| 521 |
'default' => '', |
| 522 |
), |
| 523 |
'inputPaddingBottomTablet' => array( |
| 524 |
'type' => 'number', |
| 525 |
'default' => '', |
| 526 |
), |
| 527 |
'inputPaddingBottomMobile' => array( |
| 528 |
'type' => 'number', |
| 529 |
'default' => '', |
| 530 |
), |
| 531 |
'inputPaddingBottomDecimal' => array( |
| 532 |
'type' => 'number', |
| 533 |
'default' => '', |
| 534 |
), |
| 535 |
'inputPaddingBottomDecimalTablet' => array( |
| 536 |
'type' => 'number', |
| 537 |
'default' => '', |
| 538 |
), |
| 539 |
'inputPaddingBottomDecimalMobile' => array( |
| 540 |
'type' => 'number', |
| 541 |
'default' => '', |
| 542 |
), |
| 543 |
'inputPaddingLeft' => array( |
| 544 |
'type' => 'number', |
| 545 |
'default' => '', |
| 546 |
), |
| 547 |
'inputPaddingLeftTablet' => array( |
| 548 |
'type' => 'number', |
| 549 |
'default' => '', |
| 550 |
), |
| 551 |
'inputPaddingLeftMobile' => array( |
| 552 |
'type' => 'number', |
| 553 |
'default' => '', |
| 554 |
), |
| 555 |
'inputPaddingLeftDecimal' => array( |
| 556 |
'type' => 'number', |
| 557 |
'default' => '', |
| 558 |
), |
| 559 |
'inputPaddingLeftDecimalTablet' => array( |
| 560 |
'type' => 'number', |
| 561 |
'default' => '', |
| 562 |
), |
| 563 |
'inputPaddingLeftDecimalMobile' => array( |
| 564 |
'type' => 'number', |
| 565 |
'default' => '', |
| 566 |
), |
| 567 |
'inputPaddingUnit' => array( |
| 568 |
'type' => 'string', |
| 569 |
'default' => 'px', |
| 570 |
), |
| 571 |
'inputPaddingUnitTablet' => array( |
| 572 |
'type' => 'string', |
| 573 |
'default' => 'px', |
| 574 |
), |
| 575 |
'inputPaddingUnitMobile' => array( |
| 576 |
'type' => 'string', |
| 577 |
'default' => 'px', |
| 578 |
), |
| 579 |
'buttonColor' => array( |
| 580 |
'type' => 'string', |
| 581 |
'default' => '', |
| 582 |
), |
| 583 |
'buttonHoverColor' => array( |
| 584 |
'type' => 'string', |
| 585 |
'default' => '', |
| 586 |
), |
| 587 |
'buttonBackgroundColor' => array( |
| 588 |
'type' => 'string', |
| 589 |
'default' => '', |
| 590 |
), |
| 591 |
'buttonHoverBackgroundColor' => array( |
| 592 |
'type' => 'string', |
| 593 |
'default' => '', |
| 594 |
), |
| 595 |
'buttonBorderColor' => array( |
| 596 |
'type' => 'string', |
| 597 |
'default' => '', |
| 598 |
), |
| 599 |
'buttonBorderHoverColor' => array( |
| 600 |
'type' => 'string', |
| 601 |
'default' => '', |
| 602 |
), |
| 603 |
), |
| 604 |
qi_blocks_get_block_option_typography_attributes( 'button' ), |
| 605 |
qi_blocks_get_block_option_typography_attributes( 'buttonHover' ), |
| 606 |
array( |
| 607 |
'buttonBorderStyle' => array( |
| 608 |
'type' => 'string', |
| 609 |
'default' => '', |
| 610 |
), |
| 611 |
'buttonBorderWidthTop' => array( |
| 612 |
'type' => 'number', |
| 613 |
'default' => '', |
| 614 |
), |
| 615 |
'buttonBorderWidthTopTablet' => array( |
| 616 |
'type' => 'number', |
| 617 |
'default' => '', |
| 618 |
), |
| 619 |
'buttonBorderWidthTopMobile' => array( |
| 620 |
'type' => 'number', |
| 621 |
'default' => '', |
| 622 |
), |
| 623 |
'buttonBorderWidthRight' => array( |
| 624 |
'type' => 'number', |
| 625 |
'default' => '', |
| 626 |
), |
| 627 |
'buttonBorderWidthRightTablet' => array( |
| 628 |
'type' => 'number', |
| 629 |
'default' => '', |
| 630 |
), |
| 631 |
'buttonBorderWidthRightMobile' => array( |
| 632 |
'type' => 'number', |
| 633 |
'default' => '', |
| 634 |
), |
| 635 |
'buttonBorderWidthBottom' => array( |
| 636 |
'type' => 'number', |
| 637 |
'default' => '', |
| 638 |
), |
| 639 |
'buttonBorderWidthBottomTablet' => array( |
| 640 |
'type' => 'number', |
| 641 |
'default' => '', |
| 642 |
), |
| 643 |
'buttonBorderWidthBottomMobile' => array( |
| 644 |
'type' => 'number', |
| 645 |
'default' => '', |
| 646 |
), |
| 647 |
'buttonBorderWidthLeft' => array( |
| 648 |
'type' => 'number', |
| 649 |
'default' => '', |
| 650 |
), |
| 651 |
'buttonBorderWidthLeftTablet' => array( |
| 652 |
'type' => 'number', |
| 653 |
'default' => '', |
| 654 |
), |
| 655 |
'buttonBorderWidthLeftMobile' => array( |
| 656 |
'type' => 'number', |
| 657 |
'default' => '', |
| 658 |
), |
| 659 |
'buttonBorderWidthUnit' => array( |
| 660 |
'type' => 'string', |
| 661 |
'default' => 'px', |
| 662 |
), |
| 663 |
'buttonBorderWidthUnitTablet' => array( |
| 664 |
'type' => 'string', |
| 665 |
'default' => 'px', |
| 666 |
), |
| 667 |
'buttonBorderWidthUnitMobile' => array( |
| 668 |
'type' => 'string', |
| 669 |
'default' => 'px', |
| 670 |
), |
| 671 |
'buttonBorderRadiusTop' => array( |
| 672 |
'type' => 'number', |
| 673 |
'default' => '', |
| 674 |
), |
| 675 |
'buttonBorderRadiusTopTablet' => array( |
| 676 |
'type' => 'number', |
| 677 |
'default' => '', |
| 678 |
), |
| 679 |
'buttonBorderRadiusTopMobile' => array( |
| 680 |
'type' => 'number', |
| 681 |
'default' => '', |
| 682 |
), |
| 683 |
'buttonBorderRadiusTopDecimal' => array( |
| 684 |
'type' => 'number', |
| 685 |
'default' => '', |
| 686 |
), |
| 687 |
'buttonBorderRadiusTopDecimalTablet' => array( |
| 688 |
'type' => 'number', |
| 689 |
'default' => '', |
| 690 |
), |
| 691 |
'buttonBorderRadiusTopDecimalMobile' => array( |
| 692 |
'type' => 'number', |
| 693 |
'default' => '', |
| 694 |
), |
| 695 |
'buttonBorderRadiusRight' => array( |
| 696 |
'type' => 'number', |
| 697 |
'default' => '', |
| 698 |
), |
| 699 |
'buttonBorderRadiusRightTablet' => array( |
| 700 |
'type' => 'number', |
| 701 |
'default' => '', |
| 702 |
), |
| 703 |
'buttonBorderRadiusRightMobile' => array( |
| 704 |
'type' => 'number', |
| 705 |
'default' => '', |
| 706 |
), |
| 707 |
'buttonBorderRadiusRightDecimal' => array( |
| 708 |
'type' => 'number', |
| 709 |
'default' => '', |
| 710 |
), |
| 711 |
'buttonBorderRadiusRightDecimalTablet' => array( |
| 712 |
'type' => 'number', |
| 713 |
'default' => '', |
| 714 |
), |
| 715 |
'buttonBorderRadiusRightDecimalMobile' => array( |
| 716 |
'type' => 'number', |
| 717 |
'default' => '', |
| 718 |
), |
| 719 |
'buttonBorderRadiusBottom' => array( |
| 720 |
'type' => 'number', |
| 721 |
'default' => '', |
| 722 |
), |
| 723 |
'buttonBorderRadiusBottomTablet' => array( |
| 724 |
'type' => 'number', |
| 725 |
'default' => '', |
| 726 |
), |
| 727 |
'buttonBorderRadiusBottomMobile' => array( |
| 728 |
'type' => 'number', |
| 729 |
'default' => '', |
| 730 |
), |
| 731 |
'buttonBorderRadiusBottomDecimal' => array( |
| 732 |
'type' => 'number', |
| 733 |
'default' => '', |
| 734 |
), |
| 735 |
'buttonBorderRadiusBottomDecimalTablet' => array( |
| 736 |
'type' => 'number', |
| 737 |
'default' => '', |
| 738 |
), |
| 739 |
'buttonBorderRadiusBottomDecimalMobile' => array( |
| 740 |
'type' => 'number', |
| 741 |
'default' => '', |
| 742 |
), |
| 743 |
'buttonBorderRadiusLeft' => array( |
| 744 |
'type' => 'number', |
| 745 |
'default' => '', |
| 746 |
), |
| 747 |
'buttonBorderRadiusLeftTablet' => array( |
| 748 |
'type' => 'number', |
| 749 |
'default' => '', |
| 750 |
), |
| 751 |
'buttonBorderRadiusLeftMobile' => array( |
| 752 |
'type' => 'number', |
| 753 |
'default' => '', |
| 754 |
), |
| 755 |
'buttonBorderRadiusLeftDecimal' => array( |
| 756 |
'type' => 'number', |
| 757 |
'default' => '', |
| 758 |
), |
| 759 |
'buttonBorderRadiusLeftDecimalTablet' => array( |
| 760 |
'type' => 'number', |
| 761 |
'default' => '', |
| 762 |
), |
| 763 |
'buttonBorderRadiusLeftDecimalMobile' => array( |
| 764 |
'type' => 'number', |
| 765 |
'default' => '', |
| 766 |
), |
| 767 |
'buttonBorderRadiusUnit' => array( |
| 768 |
'type' => 'string', |
| 769 |
'default' => 'px', |
| 770 |
), |
| 771 |
'buttonBorderRadiusUnitTablet' => array( |
| 772 |
'type' => 'string', |
| 773 |
'default' => 'px', |
| 774 |
), |
| 775 |
'buttonBorderRadiusUnitMobile' => array( |
| 776 |
'type' => 'string', |
| 777 |
'default' => 'px', |
| 778 |
), |
| 779 |
'buttonPaddingTop' => array( |
| 780 |
'type' => 'number', |
| 781 |
'default' => '', |
| 782 |
), |
| 783 |
'buttonPaddingTopTablet' => array( |
| 784 |
'type' => 'number', |
| 785 |
'default' => '', |
| 786 |
), |
| 787 |
'buttonPaddingTopMobile' => array( |
| 788 |
'type' => 'number', |
| 789 |
'default' => '', |
| 790 |
), |
| 791 |
'buttonPaddingTopDecimal' => array( |
| 792 |
'type' => 'number', |
| 793 |
'default' => '', |
| 794 |
), |
| 795 |
'buttonPaddingTopDecimalTablet' => array( |
| 796 |
'type' => 'number', |
| 797 |
'default' => '', |
| 798 |
), |
| 799 |
'buttonPaddingTopDecimalMobile' => array( |
| 800 |
'type' => 'number', |
| 801 |
'default' => '', |
| 802 |
), |
| 803 |
'buttonPaddingRight' => array( |
| 804 |
'type' => 'number', |
| 805 |
'default' => '', |
| 806 |
), |
| 807 |
'buttonPaddingRightTablet' => array( |
| 808 |
'type' => 'number', |
| 809 |
'default' => '', |
| 810 |
), |
| 811 |
'buttonPaddingRightMobile' => array( |
| 812 |
'type' => 'number', |
| 813 |
'default' => '', |
| 814 |
), |
| 815 |
'buttonPaddingRightDecimal' => array( |
| 816 |
'type' => 'number', |
| 817 |
'default' => '', |
| 818 |
), |
| 819 |
'buttonPaddingRightDecimalTablet' => array( |
| 820 |
'type' => 'number', |
| 821 |
'default' => '', |
| 822 |
), |
| 823 |
'buttonPaddingRightDecimalMobile' => array( |
| 824 |
'type' => 'number', |
| 825 |
'default' => '', |
| 826 |
), |
| 827 |
'buttonPaddingBottom' => array( |
| 828 |
'type' => 'number', |
| 829 |
'default' => '', |
| 830 |
), |
| 831 |
'buttonPaddingBottomTablet' => array( |
| 832 |
'type' => 'number', |
| 833 |
'default' => '', |
| 834 |
), |
| 835 |
'buttonPaddingBottomMobile' => array( |
| 836 |
'type' => 'number', |
| 837 |
'default' => '', |
| 838 |
), |
| 839 |
'buttonPaddingBottomDecimal' => array( |
| 840 |
'type' => 'number', |
| 841 |
'default' => '', |
| 842 |
), |
| 843 |
'buttonPaddingBottomDecimalTablet' => array( |
| 844 |
'type' => 'number', |
| 845 |
'default' => '', |
| 846 |
), |
| 847 |
'buttonPaddingBottomDecimalMobile' => array( |
| 848 |
'type' => 'number', |
| 849 |
'default' => '', |
| 850 |
), |
| 851 |
'buttonPaddingLeft' => array( |
| 852 |
'type' => 'number', |
| 853 |
'default' => '', |
| 854 |
), |
| 855 |
'buttonPaddingLeftTablet' => array( |
| 856 |
'type' => 'number', |
| 857 |
'default' => '', |
| 858 |
), |
| 859 |
'buttonPaddingLeftMobile' => array( |
| 860 |
'type' => 'number', |
| 861 |
'default' => '', |
| 862 |
), |
| 863 |
'buttonPaddingLeftDecimal' => array( |
| 864 |
'type' => 'number', |
| 865 |
'default' => '', |
| 866 |
), |
| 867 |
'buttonPaddingLeftDecimalTablet' => array( |
| 868 |
'type' => 'number', |
| 869 |
'default' => '', |
| 870 |
), |
| 871 |
'buttonPaddingLeftDecimalMobile' => array( |
| 872 |
'type' => 'number', |
| 873 |
'default' => '', |
| 874 |
), |
| 875 |
'buttonPaddingUnit' => array( |
| 876 |
'type' => 'string', |
| 877 |
'default' => 'px', |
| 878 |
), |
| 879 |
'buttonPaddingUnitTablet' => array( |
| 880 |
'type' => 'string', |
| 881 |
'default' => 'px', |
| 882 |
), |
| 883 |
'buttonPaddingUnitMobile' => array( |
| 884 |
'type' => 'string', |
| 885 |
'default' => 'px', |
| 886 |
), |
| 887 |
'buttonFullWidth' => array( |
| 888 |
'type' => 'boolean', |
| 889 |
'default' => false, |
| 890 |
), |
| 891 |
) |
| 892 |
), |
| 893 |
); |
| 894 |
|
| 895 |
$this->set_block_options( $block_options ); |
| 896 |
|
| 897 |
parent::__construct(); |
| 898 |
} |
| 899 |
|
| 900 |
/** |
| 901 |
* @return Qi_Blocks_Search_Block |
| 902 |
*/ |
| 903 |
public static function get_instance() { |
| 904 |
if ( is_null( self::$instance ) ) { |
| 905 |
self::$instance = new self(); |
| 906 |
} |
| 907 |
|
| 908 |
return self::$instance; |
| 909 |
} |
| 910 |
|
| 911 |
function dynamic_render_callback( $attributes ) { |
| 912 |
$html = ''; |
| 913 |
|
| 914 |
$block_classes = qi_blocks_get_block_holder_classes( 'search', $attributes ); |
| 915 |
$block_classes[] = 'qodef-layout--' . esc_attr( $attributes['layout'] ); |
| 916 |
$block_classes[] = 'qodef-button-type--' . esc_attr( $attributes['buttonType'] ); |
| 917 |
$block_classes[] = $attributes['buttonFullWidth'] ? 'qodef-button--full-width' : ''; |
| 918 |
|
| 919 |
$html .= '<div ' . qi_blocks_get_block_container_html_attributes_string( $attributes ) . '>'; |
| 920 |
$html .= '<div class="' . implode( ' ', $block_classes ) . '">'; |
| 921 |
|
| 922 |
if ( $attributes['showWidgetTitle'] && ! empty( $attributes['widgetTitle'] ) ) { |
| 923 |
$html .= '<div class="qodef-m-search-title-holder">'; |
| 924 |
$html .= '<' . esc_attr( $attributes['widgetTitleTag'] ) . ' class="qodef-m-search-title">'; |
| 925 |
$html .= wp_kses_post( $attributes['widgetTitle'] ); |
| 926 |
$html .= '</' . esc_attr( $attributes['widgetTitleTag'] ) . '>'; |
| 927 |
$html .= '</div>'; |
| 928 |
} |
| 929 |
|
| 930 |
$html .= '<div class="qodef-m-search-form-holder">'; |
| 931 |
$html .= '<form role="search" method="get" action="' . esc_url( get_home_url( '/' ) ) . '" class="qodef-m-search-form">'; |
| 932 |
|
| 933 |
$html .= '<input type="search" class="qodef-m-search-input" name="s" placeholder="' . esc_attr( $attributes['inputPlaceholder'] ) . '" required/>'; |
| 934 |
$html .= '<button type="submit" class="qodef-m-search-submit">'; |
| 935 |
if ( 'text' === $attributes['buttonType'] ) { |
| 936 |
$html .= wp_kses_post( $attributes['buttonText'] ); |
| 937 |
} elseif ( 'icon' === $attributes['buttonType'] && ! empty( $attributes['buttonIcon'] ) && ! empty( $attributes['buttonIcon']['html'] ) ) { |
| 938 |
$html .= $attributes['buttonIcon']['html']; |
| 939 |
} |
| 940 |
$html .= '</button>'; |
| 941 |
|
| 942 |
$html .= '</form>'; |
| 943 |
$html .= '</div>'; |
| 944 |
|
| 945 |
$html .= '</div>'; |
| 946 |
$html .= '</div>'; |
| 947 |
|
| 948 |
return $html; |
| 949 |
} |
| 950 |
} |
| 951 |
|
| 952 |
Qi_Blocks_Search_Block::get_instance(); |
| 953 |
} |
| 954 |
|