SBR_Customize_Tab.php
1 month ago
SBR_Review_Alert_Tab.php
1 month ago
SBR_Settings_Tab.php
1 month ago
SBR_Customize_Tab.php
1637 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Class Customize Tab |
| 5 | * |
| 6 | * @since 1.0 |
| 7 | */ |
| 8 | |
| 9 | namespace SmashBalloon\Reviews\Common\Customizer\Tabs; |
| 10 | |
| 11 | use Smashballoon\Customizer\V2\SB_Sidebar_Tab; |
| 12 | use SmashBalloon\Reviews\Common\Util; |
| 13 | |
| 14 | if (!defined('ABSPATH')) { |
| 15 | exit; // Exit if accessed directly |
| 16 | } |
| 17 | |
| 18 | class SBR_Customize_Tab extends SB_Sidebar_Tab { |
| 19 | /** |
| 20 | * Get the Sidebar Tab info |
| 21 | * |
| 22 | * @since 1.0 |
| 23 | * |
| 24 | * @return array |
| 25 | */ |
| 26 | protected function tab_info() |
| 27 | { |
| 28 | return [ |
| 29 | 'id' => 'sb-customize-tab', |
| 30 | 'name' => __('Customize', 'reviews-feed') |
| 31 | ]; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Get the Sidebar Tab Section |
| 36 | * |
| 37 | * @since 1.0 |
| 38 | * |
| 39 | * @return array |
| 40 | */ |
| 41 | protected function tab_sections() |
| 42 | { |
| 43 | return [ |
| 44 | 'template_section' => [ |
| 45 | 'heading' => __('Templates', 'reviews-feed'), |
| 46 | 'icon' => 'templates', |
| 47 | 'controls' => self::get_templates_controls(), |
| 48 | 'separator' => true |
| 49 | ], |
| 50 | /* |
| 51 | 'theme_section' => [ |
| 52 | 'heading' => __('Theme', 'reviews-feed'), |
| 53 | 'icon' => 'theme', |
| 54 | 'controls' => self::get_theme_controls(), |
| 55 | 'separator' => true |
| 56 | ], |
| 57 | */ |
| 58 | 'layout_section' => [ |
| 59 | 'heading' => __('Layout', 'reviews-feed'), |
| 60 | 'icon' => 'layout', |
| 61 | 'highlight' => 'posts-layout', |
| 62 | 'controls' => self::get_layout_controls(), |
| 63 | ], |
| 64 | /* |
| 65 | 'colorpalette_section' => [ |
| 66 | 'heading' => __('Color Palette', 'reviews-feed'), |
| 67 | 'icon' => 'colorpalette', |
| 68 | 'controls' => self::get_colorpalette_controls(), |
| 69 | ], |
| 70 | 'typography_section' => [ |
| 71 | 'heading' => __('Typography', 'reviews-feed'), |
| 72 | 'icon' => 'typography', |
| 73 | 'controls' => self::get_typography_controls(), |
| 74 | 'separator' => true |
| 75 | ], |
| 76 | */ |
| 77 | 'header_section' => [ |
| 78 | 'heading' => __('Header', 'reviews-feed'), |
| 79 | 'icon' => 'header', |
| 80 | 'highlight' => 'header', |
| 81 | 'controls' => self::get_header_controls() |
| 82 | ], |
| 83 | 'reviews_section' => [ |
| 84 | 'heading' => __('Reviews', 'reviews-feed'), |
| 85 | 'icon' => 'reviews', |
| 86 | 'highlight' => 'reviews', |
| 87 | 'controls' => self::get_reviews_controls() |
| 88 | ], |
| 89 | 'loadbutton_section' => [ |
| 90 | 'heading' => __('Load More Button', 'reviews-feed'), |
| 91 | 'description' => Util::sbr_is_pro() ? '' : |
| 92 | sprintf( |
| 93 | __('Upgrade to Pro to Load posts asynchronously with Load more button. %sLearn More%s', 'reviews-feed'), |
| 94 | '<a>', |
| 95 | '</a>' |
| 96 | ), |
| 97 | 'icon' => 'loadbutton', |
| 98 | 'highlight' => 'loadmore-button', |
| 99 | 'upsellModal' => 'loadMoreModal', |
| 100 | 'controls' => self::get_loadbutton_controls() |
| 101 | ], |
| 102 | |
| 103 | |
| 104 | |
| 105 | ]; |
| 106 | } |
| 107 | |
| 108 | |
| 109 | /** |
| 110 | * Get Templates Controls |
| 111 | * |
| 112 | * @since 1.0 |
| 113 | * |
| 114 | * @return array |
| 115 | */ |
| 116 | public static function get_templates_controls() |
| 117 | { |
| 118 | return [ |
| 119 | [//Feed Template |
| 120 | 'type' => 'feedtemplate', |
| 121 | 'id' => 'feedTemplate' |
| 122 | ] |
| 123 | ]; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Get Themes Controls |
| 128 | * |
| 129 | * @since 1.0 |
| 130 | * |
| 131 | * @return array |
| 132 | */ |
| 133 | public static function get_theme_controls() |
| 134 | { |
| 135 | return [ |
| 136 | |
| 137 | ]; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Get Layout Controls |
| 142 | * |
| 143 | * @since 1.0 |
| 144 | * |
| 145 | * @return array |
| 146 | */ |
| 147 | public static function get_layout_controls() |
| 148 | { |
| 149 | return [ |
| 150 | [//Layout Type |
| 151 | 'type' => 'toggleset', |
| 152 | 'id' => 'layout', |
| 153 | 'options' => [ |
| 154 | [ |
| 155 | 'value' => 'list', |
| 156 | 'icon' => 'list', |
| 157 | 'label' => __('List', 'reviews-feed') |
| 158 | ], |
| 159 | /* |
| 160 | [ |
| 161 | 'value' => 'grid', |
| 162 | 'icon' => 'grid', |
| 163 | 'label' => __( 'Grid', 'reviews-feed' ) |
| 164 | ], |
| 165 | */ |
| 166 | [ |
| 167 | 'value' => 'masonry', |
| 168 | 'icon' => 'masonry', |
| 169 | 'label' => __('Masonry', 'reviews-feed') |
| 170 | ], |
| 171 | [ |
| 172 | 'value' => 'carousel', |
| 173 | 'icon' => 'carousel', |
| 174 | 'label' => __('Carousel', 'reviews-feed'), |
| 175 | 'upsellModal' => 'carouselModal' |
| 176 | ] |
| 177 | ] |
| 178 | ], |
| 179 | [//Spacing |
| 180 | 'type' => 'group', |
| 181 | 'id' => 'layout_spacing', |
| 182 | 'heading' => __('Spacing', 'reviews-feed'), |
| 183 | 'controls' => [ |
| 184 | [ |
| 185 | 'type' => 'slider', |
| 186 | 'id' => 'verticalSpacing', |
| 187 | 'label' => __('Vertical', 'reviews-feed'), |
| 188 | 'labelIcon' => 'verticalspacing', |
| 189 | 'unit' => 'px', |
| 190 | 'style' => [ '.sb-post-item-wrap' => 'margin-bottom:{{value}}px!important;' ] |
| 191 | ], |
| 192 | [ |
| 193 | 'type' => 'slider', |
| 194 | 'id' => 'horizontalSpacing', |
| 195 | 'label' => __('Horizontal', 'reviews-feed'), |
| 196 | 'condition' => [ |
| 197 | 'layout' => [ |
| 198 | 'grid', |
| 199 | 'masonry', |
| 200 | 'carousel' |
| 201 | ] |
| 202 | ], |
| 203 | 'labelIcon' => 'horizontalspacing', |
| 204 | 'unit' => 'px' |
| 205 | ] |
| 206 | |
| 207 | ] |
| 208 | ], |
| 209 | [//Number of Reviews |
| 210 | 'type' => 'group', |
| 211 | 'id' => 'number_reviews', |
| 212 | 'heading' => __('Number of reviews to display', 'reviews-feed'), |
| 213 | 'controls' => [ |
| 214 | [ |
| 215 | 'type' => 'list', |
| 216 | 'controls' => [ |
| 217 | [ |
| 218 | 'type' => 'number', |
| 219 | 'id' => 'numPostDesktop', |
| 220 | 'ajaxAction' => 'feedFlyPreview', |
| 221 | 'leadingIcon' => 'desktop', |
| 222 | 'min' => 0, |
| 223 | 'max' => Util::sbr_is_pro() ? 1000 : 10 |
| 224 | ], |
| 225 | [ |
| 226 | 'type' => 'number', |
| 227 | 'id' => 'numPostTablet', |
| 228 | 'ajaxAction' => 'feedFlyPreview', |
| 229 | 'leadingIcon' => 'tablet', |
| 230 | 'min' => 0, |
| 231 | 'upsellModal' => 'moreReviewsModal' |
| 232 | ], |
| 233 | [ |
| 234 | 'type' => 'number', |
| 235 | 'id' => 'numPostMobile', |
| 236 | 'ajaxAction' => 'feedFlyPreview', |
| 237 | 'leadingIcon' => 'mobile', |
| 238 | 'min' => 0, |
| 239 | 'upsellModal' => 'moreReviewsModal' |
| 240 | ], |
| 241 | ] |
| 242 | ], |
| 243 | ] |
| 244 | ], |
| 245 | [//Carousel Breakpoints |
| 246 | 'type' => 'group', |
| 247 | 'id' => 'carousel_breakpoints', |
| 248 | 'heading' => __('Carousel Breakpoints', 'reviews-feed'), |
| 249 | 'condition' => [ |
| 250 | 'layout' => [ |
| 251 | 'carousel' |
| 252 | ] |
| 253 | ], |
| 254 | 'controls' => [ |
| 255 | [ |
| 256 | 'type' => 'list', |
| 257 | 'controls' => [ |
| 258 | [ |
| 259 | 'type' => 'number', |
| 260 | 'id' => 'carouselBreakpointDesktop', |
| 261 | 'leadingIcon' => 'desktop', |
| 262 | 'min' => 0, |
| 263 | 'max' => 3000 |
| 264 | ], |
| 265 | [ |
| 266 | 'type' => 'number', |
| 267 | 'id' => 'carouselBreakpointTablet', |
| 268 | 'leadingIcon' => 'tablet', |
| 269 | 'min' => 0, |
| 270 | 'max' => 3000 |
| 271 | ] |
| 272 | ] |
| 273 | ], |
| 274 | ] |
| 275 | ], |
| 276 | [//Grid Columns |
| 277 | 'type' => 'group', |
| 278 | 'id' => 'grid_columns', |
| 279 | 'heading' => __('Columns', 'reviews-feed'), |
| 280 | 'condition' => [ |
| 281 | 'layout' => [ |
| 282 | 'grid' |
| 283 | ] |
| 284 | ], |
| 285 | 'controls' => [ |
| 286 | [ |
| 287 | 'type' => 'list', |
| 288 | 'controls' => [ |
| 289 | [ |
| 290 | 'type' => 'number', |
| 291 | 'id' => 'gridDesktopColumns', |
| 292 | 'min' => 1, |
| 293 | 'max' => 6, |
| 294 | 'leadingIcon' => 'desktop' |
| 295 | ], |
| 296 | [ |
| 297 | 'type' => 'number', |
| 298 | 'id' => 'gridTabletColumns', |
| 299 | 'min' => 1, |
| 300 | 'max' => 6, |
| 301 | 'leadingIcon' => 'tablet', |
| 302 | 'upsellModal' => 'responsiveModal', |
| 303 | ], |
| 304 | [ |
| 305 | 'type' => 'number', |
| 306 | 'id' => 'gridMobileColumns', |
| 307 | 'min' => 1, |
| 308 | 'max' => 6, |
| 309 | 'leadingIcon' => 'mobile', |
| 310 | 'upsellModal' => 'responsiveModal', |
| 311 | ], |
| 312 | ] |
| 313 | ], |
| 314 | ] |
| 315 | ], |
| 316 | [//Masonry Columns |
| 317 | 'type' => 'group', |
| 318 | 'id' => 'masonry_columns', |
| 319 | 'heading' => __('Columns', 'reviews-feed'), |
| 320 | 'condition' => [ |
| 321 | 'layout' => [ |
| 322 | 'masonry' |
| 323 | ] |
| 324 | ], |
| 325 | 'controls' => [ |
| 326 | [ |
| 327 | 'type' => 'list', |
| 328 | 'controls' => [ |
| 329 | [ |
| 330 | 'type' => 'number', |
| 331 | 'id' => 'masonryDesktopColumns', |
| 332 | 'min' => 1, |
| 333 | 'max' => 6, |
| 334 | 'leadingIcon' => 'desktop' |
| 335 | ], |
| 336 | [ |
| 337 | 'type' => 'number', |
| 338 | 'id' => 'masonryTabletColumns', |
| 339 | 'min' => 1, |
| 340 | 'max' => 6, |
| 341 | 'leadingIcon' => 'tablet', |
| 342 | 'upsellModal' => 'responsiveModal', |
| 343 | ], |
| 344 | [ |
| 345 | 'type' => 'number', |
| 346 | 'id' => 'masonryMobileColumns', |
| 347 | 'min' => 1, |
| 348 | 'max' => 6, |
| 349 | 'leadingIcon' => 'mobile', |
| 350 | 'upsellModal' => 'responsiveModal', |
| 351 | ] |
| 352 | ] |
| 353 | ], |
| 354 | ] |
| 355 | ], |
| 356 | [//Carousel Columns & Rows |
| 357 | 'type' => 'group', |
| 358 | 'id' => 'carousel_columns_rows', |
| 359 | 'heading' => __('Columns and Rows', 'reviews-feed'), |
| 360 | 'condition' => [ |
| 361 | 'layout' => [ |
| 362 | 'carousel' |
| 363 | ] |
| 364 | ], |
| 365 | 'controls' => [ |
| 366 | [ |
| 367 | 'type' => 'list', |
| 368 | 'heading' => __('Columns', 'reviews-feed'), |
| 369 | 'controls' => [ |
| 370 | [ |
| 371 | 'type' => 'number', |
| 372 | 'id' => 'carouselDesktopColumns', |
| 373 | 'min' => 1, |
| 374 | 'max' => 6, |
| 375 | 'leadingIcon' => 'desktop' |
| 376 | ], |
| 377 | [ |
| 378 | 'type' => 'number', |
| 379 | 'id' => 'carouselTabletColumns', |
| 380 | 'min' => 1, |
| 381 | 'max' => 6, |
| 382 | 'leadingIcon' => 'tablet', |
| 383 | ], |
| 384 | [ |
| 385 | 'type' => 'number', |
| 386 | 'id' => 'carouselMobileColumns', |
| 387 | 'min' => 1, |
| 388 | 'max' => 6, |
| 389 | 'leadingIcon' => 'mobile', |
| 390 | ], |
| 391 | ] |
| 392 | ], |
| 393 | [ |
| 394 | 'type' => 'select', |
| 395 | 'id' => 'carouselDesktopRows', |
| 396 | 'min' => 1, |
| 397 | 'max' => 2, |
| 398 | 'heading' => __('Number of Rows', 'reviews-feed'), |
| 399 | 'options' => [ |
| 400 | 1 => __('1', 'reviews-feed'), |
| 401 | 2 => __('2', 'reviews-feed') |
| 402 | ] |
| 403 | ], |
| 404 | /* |
| 405 | [ |
| 406 | 'type' => 'list', |
| 407 | 'heading' => __('Rows', 'reviews-feed'), |
| 408 | 'controls' => [ |
| 409 | [ |
| 410 | 'type' => 'number', |
| 411 | 'id' => 'carouselDesktopRows', |
| 412 | 'leadingIcon' => 'desktop', |
| 413 | 'min' => 1, |
| 414 | 'max' => 3 |
| 415 | ], |
| 416 | [ |
| 417 | 'type' => 'number', |
| 418 | 'id' => 'carouselTabletRows', |
| 419 | 'leadingIcon' => 'tablet', |
| 420 | 'min' => 1, |
| 421 | 'max' => 3 |
| 422 | ], |
| 423 | [ |
| 424 | 'type' => 'number', |
| 425 | 'id' => 'carouselMobileRows', |
| 426 | 'leadingIcon' => 'mobile', |
| 427 | 'min' => 1, |
| 428 | 'max' => 3 |
| 429 | ], |
| 430 | ] |
| 431 | ], |
| 432 | */ |
| 433 | ] |
| 434 | ], |
| 435 | /* |
| 436 | [//Layout Alignment |
| 437 | 'type' => 'group', |
| 438 | 'id' => 'layout_alignment', |
| 439 | 'heading' => __('Content Alignment', 'reviews-feed'), |
| 440 | 'condition' => [ |
| 441 | 'layout' => [ |
| 442 | 'grid', |
| 443 | 'masonry', |
| 444 | 'carousel' |
| 445 | ] |
| 446 | ], |
| 447 | 'controls' => [ |
| 448 | [ |
| 449 | 'type' => 'togglebuttons', |
| 450 | 'id' => 'contentAlignment', |
| 451 | 'options' => [ |
| 452 | [ |
| 453 | 'value' => 'left', |
| 454 | 'icon' => 'leftalign', |
| 455 | ], |
| 456 | [ |
| 457 | 'value' => 'center', |
| 458 | 'icon' => 'centeralign', |
| 459 | ], |
| 460 | [ |
| 461 | 'value' => 'right', |
| 462 | 'icon' => 'rightalign', |
| 463 | ] |
| 464 | ] |
| 465 | ] |
| 466 | ] |
| 467 | ], |
| 468 | */ |
| 469 | [//Carousel Pagination |
| 470 | 'type' => 'group', |
| 471 | 'id' => 'carousel_pagination', |
| 472 | 'heading' => __('Pagination', 'reviews-feed'), |
| 473 | 'condition' => [ |
| 474 | 'layout' => [ |
| 475 | 'carousel' |
| 476 | ] |
| 477 | ], |
| 478 | 'controls' => [ |
| 479 | [ |
| 480 | 'type' => 'select', |
| 481 | 'id' => 'carouselLoopType', |
| 482 | 'layout' => 'half', |
| 483 | 'strongheading' => false, |
| 484 | 'stacked' => true, |
| 485 | 'heading' => __('Loop Type', 'reviews-feed'), |
| 486 | 'options' => [ |
| 487 | 'rewind' => __('Rewind', 'reviews-feed'), |
| 488 | 'infinity' => __('Infinity', 'reviews-feed') |
| 489 | ] |
| 490 | ], |
| 491 | [ |
| 492 | 'type' => 'number', |
| 493 | 'id' => 'carouselIntervalTime', |
| 494 | 'layout' => 'half', |
| 495 | 'strongheading' => false, |
| 496 | 'stacked' => true, |
| 497 | 'heading' => __('Interval Time', 'reviews-feed'), |
| 498 | 'trailingText' => 'ms', |
| 499 | ], |
| 500 | [ |
| 501 | 'type' => 'checkbox', |
| 502 | 'id' => 'carouselShowArrows', |
| 503 | 'label' => __('Show Navigation Arrows', 'reviews-feed'), |
| 504 | 'stacked' => true, |
| 505 | 'options' => [ |
| 506 | 'enabled' => true, |
| 507 | 'disabled' => false |
| 508 | ] |
| 509 | ], |
| 510 | [ |
| 511 | 'type' => 'checkbox', |
| 512 | 'id' => 'carouselShowPagination', |
| 513 | 'label' => __('Show Pagination', 'reviews-feed'), |
| 514 | 'stacked' => true, |
| 515 | 'options' => [ |
| 516 | 'enabled' => true, |
| 517 | 'disabled' => false |
| 518 | ] |
| 519 | ], |
| 520 | [ |
| 521 | 'type' => 'checkbox', |
| 522 | 'id' => 'carouselEnableAutoplay', |
| 523 | 'label' => __('Enable Autoplay', 'reviews-feed'), |
| 524 | 'stacked' => true, |
| 525 | 'options' => [ |
| 526 | 'enabled' => true, |
| 527 | 'disabled' => false |
| 528 | ] |
| 529 | ], |
| 530 | ] |
| 531 | ], |
| 532 | [//Content Length |
| 533 | 'type' => 'group', |
| 534 | 'id' => 'content_lengthreviews', |
| 535 | 'heading' => __('Content Length', 'reviews-feed'), |
| 536 | 'controls' => [ |
| 537 | [ |
| 538 | 'type' => 'number', |
| 539 | 'id' => 'contentLength', |
| 540 | 'trailingText' => __('characters', 'reviews-feed'), |
| 541 | ] |
| 542 | ], |
| 543 | ], |
| 544 | ]; |
| 545 | } |
| 546 | |
| 547 | |
| 548 | /** |
| 549 | * Get Color Palette Controls |
| 550 | * |
| 551 | * @since 1.0 |
| 552 | * |
| 553 | * @return array |
| 554 | */ |
| 555 | public static function get_colorpalette_controls() |
| 556 | { |
| 557 | return [ |
| 558 | [//Layout Type |
| 559 | 'type' => 'toggleset', |
| 560 | 'id' => 'colorScheme', |
| 561 | 'options' => [ |
| 562 | [ |
| 563 | 'value' => 'inherit', |
| 564 | 'label' => __('Inherit from Theme', 'reviews-feed') |
| 565 | ], |
| 566 | [ |
| 567 | 'value' => 'light', |
| 568 | 'icon' => 'sun', |
| 569 | 'label' => __('Light', 'reviews-feed') |
| 570 | ], |
| 571 | [ |
| 572 | 'value' => 'dark', |
| 573 | 'icon' => 'moon', |
| 574 | 'label' => __('Dark', 'reviews-feed') |
| 575 | ], |
| 576 | [ |
| 577 | 'value' => 'custom', |
| 578 | 'icon' => 'cog', |
| 579 | 'label' => __('Custom', 'reviews-feed') |
| 580 | ] |
| 581 | ] |
| 582 | ], |
| 583 | ]; |
| 584 | } |
| 585 | |
| 586 | |
| 587 | /** |
| 588 | * Get Typography Controls |
| 589 | * |
| 590 | * @since 1.0 |
| 591 | * |
| 592 | * @return array |
| 593 | */ |
| 594 | public static function get_typography_controls() |
| 595 | { |
| 596 | return [ |
| 597 | |
| 598 | ]; |
| 599 | } |
| 600 | |
| 601 | |
| 602 | /** |
| 603 | * Get Header Controls |
| 604 | * |
| 605 | * @since 1.0 |
| 606 | * |
| 607 | * @return array |
| 608 | */ |
| 609 | public static function get_header_controls() |
| 610 | { |
| 611 | return [ |
| 612 | [ |
| 613 | 'type' => 'switcher', |
| 614 | 'id' => 'showHeader', |
| 615 | 'layout' => 'third', |
| 616 | 'label' => __('Enable', 'reviews-feed'), |
| 617 | 'options' => [ |
| 618 | 'enabled' => true, |
| 619 | 'disabled' => false |
| 620 | ] |
| 621 | ], |
| 622 | [ |
| 623 | 'type' => 'checkboxsection', |
| 624 | 'id' => 'header_content_sections', |
| 625 | 'settingId' => 'headerContent', |
| 626 | 'topLabel' => __('Name', 'reviews-feed'), |
| 627 | 'condition' => [ |
| 628 | 'showHeader' => [ true ] |
| 629 | ], |
| 630 | 'includeTop' => true, |
| 631 | 'controls' => [ |
| 632 | [//Heading Section |
| 633 | 'heading' => __('Heading', 'reviews-feed'), |
| 634 | 'id' => 'heading', |
| 635 | 'highlight' => 'heading', |
| 636 | 'controls' => [ |
| 637 | [ |
| 638 | 'type' => 'text', |
| 639 | 'layout' => 'third', |
| 640 | 'id' => 'headerHeadingContent', |
| 641 | 'heading' => __('Content', 'reviews-feed'), |
| 642 | 'stacked' => true, |
| 643 | 'strongheading' => false, |
| 644 | 'bottom' => -2, |
| 645 | ], |
| 646 | [//Heading Font |
| 647 | 'type' => 'font', |
| 648 | 'id' => 'headingFont', |
| 649 | 'stacked' => true, |
| 650 | 'bottom' => 10, |
| 651 | 'style' => [ |
| 652 | '.sb-feed-header-heading' => '{{value}}' |
| 653 | ] |
| 654 | ], |
| 655 | [//Heading Color |
| 656 | 'type' => 'group', |
| 657 | 'id' => 'heading_color', |
| 658 | 'heading' => __('Color', 'reviews-feed'), |
| 659 | 'controls' => [ |
| 660 | [ |
| 661 | 'type' => 'colorpicker', |
| 662 | 'id' => 'headingColor', |
| 663 | 'heading' => __('Text', 'reviews-feed'), |
| 664 | 'layout' => 'third', |
| 665 | 'stacked' => true, |
| 666 | 'strongheading' => false, |
| 667 | 'style' => [ |
| 668 | '.sb-feed-header-heading' => 'color:{{value}};' |
| 669 | ] |
| 670 | ] |
| 671 | ] |
| 672 | ], |
| 673 | [ |
| 674 | 'type' => 'separator', |
| 675 | 'top' => 5, |
| 676 | 'bottom' => 15, |
| 677 | ], |
| 678 | [//Heading Spacing |
| 679 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 680 | 'type' => 'heading', |
| 681 | 'stacked' => true |
| 682 | ], |
| 683 | [ |
| 684 | 'type' => 'distance', |
| 685 | 'distancetype' => 'padding', |
| 686 | 'id' => 'headerHeadingPadding', |
| 687 | 'heading' => __('Padding', 'reviews-feed'), |
| 688 | 'style' => [ '.sb-feed-header-heading' => 'padding:{{value}};' ] |
| 689 | ], |
| 690 | [ |
| 691 | 'type' => 'distance', |
| 692 | 'distancetype' => 'margin', |
| 693 | 'id' => 'headerHeadingMargin', |
| 694 | 'heading' => __('Margin', 'reviews-feed'), |
| 695 | 'style' => [ '.sb-feed-header-heading' => 'margin:{{value}};' ] |
| 696 | ] |
| 697 | ] |
| 698 | ], |
| 699 | [//Header Button Section |
| 700 | 'heading' => __('Button', 'reviews-feed'), |
| 701 | 'id' => 'button', |
| 702 | 'highlight' => 'header-button', |
| 703 | 'controls' => [ |
| 704 | [//Button Link To |
| 705 | 'type' => 'group', |
| 706 | 'id' => 'button_linkto_gr', |
| 707 | 'heading' => __('Link to', 'reviews-feed'), |
| 708 | 'controls' => [ |
| 709 | [ |
| 710 | 'type' => 'select', |
| 711 | 'id' => 'headerButtonLinkTo', |
| 712 | 'strongheading' => false, |
| 713 | 'stacked' => true, |
| 714 | 'options' => [ |
| 715 | 'google' => __('Google (Write a Review)', 'reviews-feed'), |
| 716 | 'external' => __('External Link', 'reviews-feed') |
| 717 | ] |
| 718 | ], |
| 719 | [ |
| 720 | 'type' => 'text', |
| 721 | 'id' => 'headerButtonExternalLink', |
| 722 | 'leadingText' => 'https//', |
| 723 | 'condition' => [ |
| 724 | 'headerButtonLinkTo' => [ 'external' ] |
| 725 | ] |
| 726 | ], |
| 727 | |
| 728 | ] |
| 729 | ], |
| 730 | /* |
| 731 | [//Button Icon |
| 732 | 'type' => 'group', |
| 733 | 'id' => 'button_icon_gr', |
| 734 | 'heading' => __('Icon', 'reviews-feed'), |
| 735 | 'controls' => [ |
| 736 | |
| 737 | ] |
| 738 | ], |
| 739 | */ |
| 740 | [//Button Text |
| 741 | 'type' => 'group', |
| 742 | 'id' => 'button_text_gr', |
| 743 | 'heading' => __('Text', 'reviews-feed'), |
| 744 | 'controls' => [ |
| 745 | [ |
| 746 | 'type' => 'font', |
| 747 | 'id' => 'headerButtonFont', |
| 748 | 'style' => [ '.sb-feed-header-btn' => '{{value}}'] |
| 749 | ] |
| 750 | ] |
| 751 | ], |
| 752 | [//Button Color |
| 753 | 'type' => 'group', |
| 754 | 'id' => 'button_color_gr', |
| 755 | 'heading' => __('Color', 'reviews-feed'), |
| 756 | 'controls' => [ |
| 757 | [ |
| 758 | 'type' => 'colorpicker', |
| 759 | 'id' => 'headerButtonColor', |
| 760 | 'stacked' => true, |
| 761 | 'strongheading' => false, |
| 762 | 'layout' => 'third', |
| 763 | 'heading' => __('Text', 'reviews-feed'), |
| 764 | 'style' => [ '.sb-feed-header-btn' => 'color:{{value}};'] |
| 765 | ], |
| 766 | [ |
| 767 | 'type' => 'colorpicker', |
| 768 | 'id' => 'headerButtonBg', |
| 769 | 'stacked' => true, |
| 770 | 'strongheading' => false, |
| 771 | 'layout' => 'third', |
| 772 | 'heading' => __('Background', 'reviews-feed'), |
| 773 | 'style' => [ '.sb-feed-header-btn' => 'background:{{value}};'] |
| 774 | ], |
| 775 | [ |
| 776 | 'type' => 'colorpicker', |
| 777 | 'id' => 'headerButtonHoverColor', |
| 778 | 'stacked' => true, |
| 779 | 'strongheading' => false, |
| 780 | 'layout' => 'third', |
| 781 | 'heading' => __('Text/ Hover', 'reviews-feed'), |
| 782 | 'style' => [ '.sb-feed-header-btn:hover' => 'color:{{value}};'] |
| 783 | ], |
| 784 | [ |
| 785 | 'type' => 'colorpicker', |
| 786 | 'id' => 'headerButtonHoverBg', |
| 787 | 'stacked' => true, |
| 788 | 'strongheading' => false, |
| 789 | 'layout' => 'third', |
| 790 | 'heading' => __('Bg/ Hover', 'reviews-feed'), |
| 791 | 'style' => [ '.sb-feed-header-btn:hover' => 'background:{{value}};'] |
| 792 | ] |
| 793 | |
| 794 | ] |
| 795 | ], |
| 796 | [//Button Spacing |
| 797 | 'type' => 'group', |
| 798 | 'id' => 'button_spacing', |
| 799 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 800 | 'controls' => [ |
| 801 | [ |
| 802 | 'type' => 'distance', |
| 803 | 'distancetype' => 'padding', |
| 804 | 'id' => 'headerButtonPadding', |
| 805 | 'heading' => __('Padding', 'reviews-feed'), |
| 806 | 'style' => [ '.sb-feed-header-btn' => 'padding:{{value}};' ] |
| 807 | ], |
| 808 | [ |
| 809 | 'type' => 'distance', |
| 810 | 'distancetype' => 'margin', |
| 811 | 'id' => 'headerButtonMargin', |
| 812 | 'heading' => __('Margin', 'reviews-feed'), |
| 813 | 'style' => [ '.sb-feed-header-btn' => 'margin:{{value}};' ] |
| 814 | ] |
| 815 | |
| 816 | ] |
| 817 | ], |
| 818 | ] |
| 819 | ], |
| 820 | [ |
| 821 | 'heading' => __('Average Review Rating', 'reviews-feed'), |
| 822 | 'id' => 'averagereview', |
| 823 | 'highlight' => 'header-average', |
| 824 | 'upsellModal' => 'averageRatingModal', |
| 825 | 'controls' => [ |
| 826 | [//Rating Text |
| 827 | 'type' => 'group', |
| 828 | 'id' => 'rating_gr', |
| 829 | 'heading' => __('Rating', 'reviews-feed'), |
| 830 | 'controls' => [ |
| 831 | [ |
| 832 | 'type' => 'font', |
| 833 | 'id' => 'headerAvReviewFont', |
| 834 | 'style' => [ '.sb-feed-header-rating' => '{{value}}'] |
| 835 | ] |
| 836 | ] |
| 837 | ], |
| 838 | [//Rating Text |
| 839 | 'type' => 'group', |
| 840 | 'id' => 'ratingsubtext_gr', |
| 841 | 'heading' => __('Rating Subtext', 'reviews-feed'), |
| 842 | 'controls' => [ |
| 843 | [ |
| 844 | 'type' => 'font', |
| 845 | 'id' => 'headerAvSubtextReviewFont', |
| 846 | 'style' => [ '.sb-feed-header-rating-subtext' => '{{value}}'] |
| 847 | ] |
| 848 | ] |
| 849 | ], |
| 850 | [//Rating Color |
| 851 | 'type' => 'group', |
| 852 | 'id' => 'button_color_gr', |
| 853 | 'heading' => __('Color', 'reviews-feed'), |
| 854 | 'controls' => [ |
| 855 | [ |
| 856 | 'type' => 'colorpicker', |
| 857 | 'id' => 'headerAvReviewIconColor', |
| 858 | 'layout' => 'third', |
| 859 | 'stacked' => true, |
| 860 | 'strongheading' => false, |
| 861 | 'heading' => __('Rating Icon', 'reviews-feed'), |
| 862 | 'style' => [ '.sb-feed-header-rating-icons' => 'color:{{value}};'] |
| 863 | ], |
| 864 | [ |
| 865 | 'type' => 'colorpicker', |
| 866 | 'id' => 'headerAvReviewColor', |
| 867 | 'layout' => 'third', |
| 868 | 'stacked' => true, |
| 869 | 'strongheading' => false, |
| 870 | 'heading' => __('Rating', 'reviews-feed'), |
| 871 | 'style' => [ '.sb-feed-header-rating' => 'color:{{value}};'] |
| 872 | ], |
| 873 | [ |
| 874 | 'type' => 'colorpicker', |
| 875 | 'id' => 'headerAvReviewSubtextColor', |
| 876 | 'layout' => 'third', |
| 877 | 'stacked' => true, |
| 878 | 'strongheading' => false, |
| 879 | 'heading' => __('Subtext', 'reviews-feed'), |
| 880 | 'style' => [ '.sb-feed-header-rating-subtext' => 'color:{{value}};'] |
| 881 | ] |
| 882 | ] |
| 883 | ], |
| 884 | [//Rating Spacing |
| 885 | 'type' => 'group', |
| 886 | 'id' => 'rating_spacing', |
| 887 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 888 | 'controls' => [ |
| 889 | [ |
| 890 | 'type' => 'distance', |
| 891 | 'distancetype' => 'padding', |
| 892 | 'id' => 'headerAvReviewPadding', |
| 893 | 'heading' => __('Padding', 'reviews-feed'), |
| 894 | 'style' => [ '.sb-feed-header-bottom' => 'padding:{{value}};' ] |
| 895 | ], |
| 896 | [ |
| 897 | 'type' => 'distance', |
| 898 | 'distancetype' => 'margin', |
| 899 | 'id' => 'headerAvReviewMargin', |
| 900 | 'heading' => __('Margin', 'reviews-feed'), |
| 901 | 'style' => [ '.sb-feed-header-bottom' => 'margin:{{value}};' ] |
| 902 | ] |
| 903 | |
| 904 | ] |
| 905 | ], |
| 906 | ] |
| 907 | ], |
| 908 | ] |
| 909 | ], |
| 910 | |
| 911 | [//Header Spacing |
| 912 | 'type' => 'group', |
| 913 | 'id' => 'header_spacing', |
| 914 | 'heading' => __('Element Header Spacing', 'reviews-feed'), |
| 915 | 'condition' => [ |
| 916 | 'showHeader' => [ true ] |
| 917 | ], |
| 918 | 'controls' => [ |
| 919 | [ |
| 920 | 'type' => 'distance', |
| 921 | 'distancetype' => 'padding', |
| 922 | 'id' => 'headerPadding', |
| 923 | 'condition' => [ |
| 924 | 'showHeader' => [ true ] |
| 925 | ], |
| 926 | 'heading' => __('Padding', 'reviews-feed'), |
| 927 | 'style' => [ '.sb-feed-header' => 'padding:{{value}};' ] |
| 928 | ], |
| 929 | [ |
| 930 | 'type' => 'distance', |
| 931 | 'distancetype' => 'margin', |
| 932 | 'id' => 'headerMargin', |
| 933 | 'condition' => [ |
| 934 | 'showHeader' => [ true ] |
| 935 | ], |
| 936 | 'heading' => __('Margin', 'reviews-feed'), |
| 937 | 'style' => [ '.sb-feed-header' => 'margin:{{value}};' ] |
| 938 | ] |
| 939 | ] |
| 940 | ], |
| 941 | ]; |
| 942 | } |
| 943 | |
| 944 | |
| 945 | /** |
| 946 | * Get Reviews Controls |
| 947 | * |
| 948 | * @since 1.0 |
| 949 | * |
| 950 | * @return array |
| 951 | */ |
| 952 | public static function get_reviews_controls() |
| 953 | { |
| 954 | return [ |
| 955 | [ |
| 956 | 'type' => 'section', |
| 957 | 'id' => 'reviews_style_nested', |
| 958 | 'heading' => __('Post Style', 'reviews-feed'), |
| 959 | 'icon' => 'theme', |
| 960 | 'highlight' => 'reviews', |
| 961 | 'controls' => self::get_nested_post_style_controls(), |
| 962 | ], |
| 963 | [ |
| 964 | 'type' => 'section', |
| 965 | 'id' => 'reviews_individual_nested', |
| 966 | 'heading' => __('Edit Individual Elements', 'reviews-feed'), |
| 967 | 'description' => __('Hide or Show individual elements of a post or edit their options', 'reviews-feed'), |
| 968 | 'icon' => 'reviews', |
| 969 | 'highlight' => 'reviews', |
| 970 | 'controls' => self::get_nested_review_elements_controls(), |
| 971 | ] |
| 972 | ]; |
| 973 | } |
| 974 | |
| 975 | /** |
| 976 | * Get Load More Button Controls |
| 977 | * |
| 978 | * @since 1.0 |
| 979 | * |
| 980 | * @return array |
| 981 | */ |
| 982 | public static function get_loadbutton_controls() |
| 983 | { |
| 984 | return [ |
| 985 | [ |
| 986 | 'type' => 'switcher', |
| 987 | 'id' => 'showLoadButton', |
| 988 | 'layout' => 'third', |
| 989 | 'label' => __('Enable', 'reviews-feed'), |
| 990 | 'hidePro' => true, |
| 991 | 'options' => [ |
| 992 | 'enabled' => true, |
| 993 | 'disabled' => false |
| 994 | ] |
| 995 | ], |
| 996 | /* |
| 997 | [//Load More Icon |
| 998 | 'type' => 'group', |
| 999 | 'id' => 'loadmorebutton_icon', |
| 1000 | 'heading' => __('Icon', 'reviews-feed'), |
| 1001 | 'condition' => [ |
| 1002 | 'showLoadButton' => [ true ] |
| 1003 | ], |
| 1004 | 'controls' => [ |
| 1005 | //ICON GOES HERE |
| 1006 | |
| 1007 | ] |
| 1008 | ], |
| 1009 | */[//Load More Text |
| 1010 | 'type' => 'group', |
| 1011 | 'id' => 'loadmorebutton_text', |
| 1012 | 'heading' => __('Text', 'reviews-feed'), |
| 1013 | 'condition' => [ |
| 1014 | 'showLoadButton' => [ true ] |
| 1015 | ], |
| 1016 | 'controls' => [ |
| 1017 | [ |
| 1018 | 'type' => 'text', |
| 1019 | 'id' => 'loadButtonText', |
| 1020 | 'condition' => [ |
| 1021 | 'showLoadButton' => [ true ] |
| 1022 | ], |
| 1023 | 'upsellModal' => 'loadMoreModal', |
| 1024 | 'heading' => __('Text', 'reviews-feed'), |
| 1025 | 'headingstrong' => false, |
| 1026 | 'stacked' => true, |
| 1027 | 'layout' => 'third' |
| 1028 | ], |
| 1029 | [ |
| 1030 | 'type' => 'font', |
| 1031 | 'id' => 'loadButtonFont', |
| 1032 | 'upsellModal' => 'loadMoreModal', |
| 1033 | 'condition' => [ |
| 1034 | 'showLoadButton' => [ true ] |
| 1035 | ], |
| 1036 | 'style' => [ '.sb-load-button' => '{{value}}' ] |
| 1037 | ], |
| 1038 | ] |
| 1039 | ], |
| 1040 | [//Load More Color |
| 1041 | 'type' => 'group', |
| 1042 | 'id' => 'loadmorebutton_color', |
| 1043 | 'heading' => __('Color', 'reviews-feed'), |
| 1044 | 'condition' => [ |
| 1045 | 'showLoadButton' => [ true ] |
| 1046 | ], |
| 1047 | 'controls' => [ |
| 1048 | [ |
| 1049 | 'type' => 'colorpicker', |
| 1050 | 'id' => 'loadButtonColor', |
| 1051 | 'upsellModal' => 'loadMoreModal', |
| 1052 | 'condition' => [ |
| 1053 | 'showLoadButton' => [ true ] |
| 1054 | ], |
| 1055 | 'heading' => __('Text', 'reviews-feed'), |
| 1056 | 'layout' => 'third', |
| 1057 | 'stacked' => true, |
| 1058 | 'headingstrong' => false, |
| 1059 | 'style' => [ '.sb-load-button' => 'color:{{value}};' ] |
| 1060 | ], |
| 1061 | [ |
| 1062 | 'type' => 'colorpicker', |
| 1063 | 'id' => 'loadButtonBg', |
| 1064 | 'upsellModal' => 'loadMoreModal', |
| 1065 | 'condition' => [ |
| 1066 | 'showLoadButton' => [ true ] |
| 1067 | ], |
| 1068 | 'heading' => __('Text', 'reviews-feed'), |
| 1069 | 'layout' => 'third', |
| 1070 | 'stacked' => true, |
| 1071 | 'headingstrong' => false, |
| 1072 | 'style' => [ '.sb-load-button' => 'background:{{value}};' ] |
| 1073 | ], |
| 1074 | [ |
| 1075 | 'type' => 'colorpicker', |
| 1076 | 'id' => 'loadButtonHoverColor', |
| 1077 | 'upsellModal' => 'loadMoreModal', |
| 1078 | 'condition' => [ |
| 1079 | 'showLoadButton' => [ true ] |
| 1080 | ], |
| 1081 | 'heading' => __('Text / Hover', 'reviews-feed'), |
| 1082 | 'layout' => 'third', |
| 1083 | 'stacked' => true, |
| 1084 | 'headingstrong' => false, |
| 1085 | 'style' => [ '.sb-load-button:hover' => 'color:{{value}};' ] |
| 1086 | ], |
| 1087 | [ |
| 1088 | 'type' => 'colorpicker', |
| 1089 | 'id' => 'loadButtonHoverBg', |
| 1090 | 'upsellModal' => 'loadMoreModal', |
| 1091 | 'condition' => [ |
| 1092 | 'showLoadButton' => [ true ] |
| 1093 | ], |
| 1094 | 'heading' => __('Bg / Hover', 'reviews-feed'), |
| 1095 | 'layout' => 'third', |
| 1096 | 'stacked' => true, |
| 1097 | 'headingstrong' => false, |
| 1098 | 'style' => [ '.sb-load-button:hover' => 'background:{{value}};' ] |
| 1099 | ], |
| 1100 | ] |
| 1101 | ], |
| 1102 | [//Load More Spacing |
| 1103 | 'type' => 'group', |
| 1104 | 'id' => 'loadmorebutton_spacing', |
| 1105 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 1106 | 'condition' => [ |
| 1107 | 'showLoadButton' => [ true ] |
| 1108 | ], |
| 1109 | 'controls' => [ |
| 1110 | [ |
| 1111 | 'type' => 'distance', |
| 1112 | 'distancetype' => 'padding', |
| 1113 | 'id' => 'loadButtonPadding', |
| 1114 | 'upsellModal' => 'loadMoreModal', |
| 1115 | 'heading' => __('Padding', 'reviews-feed'), |
| 1116 | 'condition' => [ |
| 1117 | 'showLoadButton' => [ true ] |
| 1118 | ], |
| 1119 | 'style' => [ '.sb-load-button' => 'padding:{{value}};' ] |
| 1120 | ], |
| 1121 | [ |
| 1122 | 'type' => 'distance', |
| 1123 | 'distancetype' => 'margin', |
| 1124 | 'id' => 'loadButtonMargin', |
| 1125 | 'upsellModal' => 'loadMoreModal', |
| 1126 | 'heading' => __('Margin', 'reviews-feed'), |
| 1127 | 'condition' => [ |
| 1128 | 'showLoadButton' => [ true ] |
| 1129 | ], |
| 1130 | 'style' => [ '.sb-load-button-ctn' => 'margin:{{value}};' ] |
| 1131 | ] |
| 1132 | |
| 1133 | ] |
| 1134 | ], |
| 1135 | ]; |
| 1136 | } |
| 1137 | |
| 1138 | /** |
| 1139 | * Get Nested Reviews Post Style Controls |
| 1140 | * |
| 1141 | * @since 1.0 |
| 1142 | * |
| 1143 | * @return array |
| 1144 | */ |
| 1145 | public static function get_nested_post_style_controls() |
| 1146 | { |
| 1147 | return [ |
| 1148 | [ |
| 1149 | 'type' => 'toggleset', |
| 1150 | 'id' => 'postStyle', |
| 1151 | 'options' => [ |
| 1152 | [ |
| 1153 | 'value' => 'boxed', |
| 1154 | 'icon' => 'post-boxed', |
| 1155 | 'label' => __('Boxed', 'reviews-feed') |
| 1156 | ], |
| 1157 | [ |
| 1158 | |
| 1159 | 'value' => 'regular', |
| 1160 | 'icon' => 'regular', |
| 1161 | 'label' => __('Regular', 'reviews-feed') |
| 1162 | ] |
| 1163 | ] |
| 1164 | ], |
| 1165 | [ |
| 1166 | 'type' => 'group', |
| 1167 | 'id' => 'reviews_boxed_background', |
| 1168 | 'condition' => [ |
| 1169 | 'postStyle' => ['boxed'] |
| 1170 | ], |
| 1171 | 'heading' => __('Colors', 'reviews-feed'), |
| 1172 | 'controls' => [ |
| 1173 | [ |
| 1174 | 'type' => 'colorpicker', |
| 1175 | 'id' => 'boxedBackgroundColor', |
| 1176 | 'heading' => __('Background Color', 'reviews-feed'), |
| 1177 | 'condition' => [ |
| 1178 | 'postStyle' => ['boxed'] |
| 1179 | ], |
| 1180 | 'stacked' => true, |
| 1181 | 'strongheading' => false, |
| 1182 | 'layout' => 'half', |
| 1183 | 'style' => [ '.sb-post-item-wrap' => 'background:{{value}};' ] |
| 1184 | ] |
| 1185 | ] |
| 1186 | ], |
| 1187 | |
| 1188 | [ |
| 1189 | 'type' => 'group', |
| 1190 | 'id' => 'reviews_properties', |
| 1191 | 'heading' => __('Properties', 'reviews-feed'), |
| 1192 | 'controls' => [ |
| 1193 | [ |
| 1194 | 'type' => 'boxshadow', |
| 1195 | 'id' => 'boxedBoxShadow', |
| 1196 | 'condition' => [ |
| 1197 | 'postStyle' => ['boxed'] |
| 1198 | ], |
| 1199 | 'label' => __('Box Shadow', 'reviews-feed'), |
| 1200 | 'style' => [ '.sb-post-item-wrap' => 'box-shadow:{{value}};' ] |
| 1201 | ], |
| 1202 | [ |
| 1203 | 'type' => 'borderradius', |
| 1204 | 'id' => 'boxedBorderRadius', |
| 1205 | 'condition' => [ |
| 1206 | 'postStyle' => ['boxed'] |
| 1207 | ], |
| 1208 | 'label' => __('Corner Radius', 'reviews-feed'), |
| 1209 | 'style' => [ '.sb-post-item-wrap' => 'border-radius:{{value}};' ] |
| 1210 | ], |
| 1211 | [ |
| 1212 | 'type' => 'stroke', |
| 1213 | 'id' => 'postStroke', |
| 1214 | 'label' => __('Stroke', 'reviews-feed'), |
| 1215 | 'style' => [ |
| 1216 | '[data-post-style="boxed"] .sb-post-item-wrap' => 'border:{{value}};', |
| 1217 | '[data-post-style="regular"] .sb-post-item-wrap' => 'border-bottom:{{value}};' |
| 1218 | ] |
| 1219 | ], |
| 1220 | ] |
| 1221 | ], |
| 1222 | |
| 1223 | [//Post Item Padding |
| 1224 | 'type' => 'group', |
| 1225 | 'id' => 'reviews_item_spacing', |
| 1226 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 1227 | 'controls' => [ |
| 1228 | [ |
| 1229 | 'type' => 'distance', |
| 1230 | 'distancetype' => 'padding', |
| 1231 | 'id' => 'postPadding', |
| 1232 | 'heading' => __('Padding', 'reviews-feed'), |
| 1233 | 'style' => [ '.sb-post-item-wrap' => 'padding:{{value}};' ] |
| 1234 | ] |
| 1235 | ] |
| 1236 | ] |
| 1237 | ]; |
| 1238 | } |
| 1239 | |
| 1240 | /** |
| 1241 | * Get Reviews Individual Elements Controls |
| 1242 | * |
| 1243 | * @since 1.0 |
| 1244 | * |
| 1245 | * @return array |
| 1246 | */ |
| 1247 | public static function get_nested_review_elements_controls() |
| 1248 | { |
| 1249 | return [ |
| 1250 | [ |
| 1251 | 'type' => 'checkboxsection', |
| 1252 | 'id' => 'individual_elements_sections', |
| 1253 | 'settingId' => 'postElements', |
| 1254 | 'topLabel' => __('Name', 'reviews-feed'), |
| 1255 | 'includeTop' => true, |
| 1256 | 'enableSorting' => Util::sbr_is_pro() ? true : false, |
| 1257 | // Canonical element order for the list (disabled/empty state falls back to this). |
| 1258 | 'defaultOrder' => ['author', 'rating', 'text', 'media'], |
| 1259 | 'controls' => [ |
| 1260 | [//Post Rating |
| 1261 | 'heading' => __('Rating', 'reviews-feed'), |
| 1262 | 'id' => 'rating', |
| 1263 | 'highlight' => 'post-rating-icon', |
| 1264 | 'controls' => [ |
| 1265 | [ |
| 1266 | 'type' => 'group', |
| 1267 | 'id' => 'rating_icon', |
| 1268 | 'heading' => __('Icon Color', 'reviews-feed'), |
| 1269 | 'controls' => [ |
| 1270 | //ICON CHOOSER HERE |
| 1271 | [ |
| 1272 | 'type' => 'colorpicker', |
| 1273 | 'id' => 'ratingIconColor', |
| 1274 | 'heading' => __('Color', 'reviews-feed'), |
| 1275 | 'layout' => 'third', |
| 1276 | 'style' => [ '.sb-item-rating' => 'color:{{value}}' ] |
| 1277 | ], |
| 1278 | ] |
| 1279 | ], |
| 1280 | |
| 1281 | [//Rating Spacing |
| 1282 | 'type' => 'group', |
| 1283 | 'id' => 'rating_icon_spacing', |
| 1284 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 1285 | 'controls' => [ |
| 1286 | [ |
| 1287 | 'type' => 'distance', |
| 1288 | 'distancetype' => 'padding', |
| 1289 | 'id' => 'ratingIconPadding', |
| 1290 | 'heading' => __('Padding', 'reviews-feed'), |
| 1291 | 'style' => [ '.sb-item-rating' => 'padding:{{value}};' ] |
| 1292 | ], |
| 1293 | [ |
| 1294 | 'type' => 'distance', |
| 1295 | 'distancetype' => 'margin', |
| 1296 | 'id' => 'ratingIconMargin', |
| 1297 | 'heading' => __('Margin', 'reviews-feed'), |
| 1298 | 'style' => [ '.sb-item-rating' => 'margin:{{value}};' ] |
| 1299 | ] |
| 1300 | ] |
| 1301 | ] |
| 1302 | ] |
| 1303 | ], |
| 1304 | [//Post Review Paragraph |
| 1305 | 'heading' => __('Review Paragraph', 'reviews-feed'), |
| 1306 | 'id' => 'text', |
| 1307 | 'highlight' => 'post-text', |
| 1308 | 'controls' => [ |
| 1309 | [//Paragraph Text Font |
| 1310 | 'type' => 'group', |
| 1311 | 'id' => 'text_paragraph_font', |
| 1312 | 'heading' => __('Font', 'reviews-feed'), |
| 1313 | 'controls' => [ |
| 1314 | [ |
| 1315 | 'type' => 'font', |
| 1316 | 'id' => 'paragraphFont', |
| 1317 | // `.sb-item-pros-cons` is Booking's review body (no `.sb-item-text` |
| 1318 | // wrapper). Listed as its own selector key — not a comma-join — so the |
| 1319 | // JS generator prefixes each with the container id; the Booking body then |
| 1320 | // tracks the same paragraph font (size / weight / line-height) as every |
| 1321 | // other provider instead of falling back to the base size. SMASH-782. |
| 1322 | 'style' => [ |
| 1323 | '.sb-item-text' => '{{value}}', |
| 1324 | '.sb-item-pros-cons' => '{{value}}', |
| 1325 | ] |
| 1326 | ] |
| 1327 | ] |
| 1328 | ], |
| 1329 | [//Paragraph Text Color |
| 1330 | 'type' => 'group', |
| 1331 | 'id' => 'text_paragraph_color', |
| 1332 | 'heading' => __('Color', 'reviews-feed'), |
| 1333 | 'controls' => [ |
| 1334 | [ |
| 1335 | 'type' => 'colorpicker', |
| 1336 | 'id' => 'paragraphColor', |
| 1337 | 'layout' => 'third', |
| 1338 | 'strongheading' => false, |
| 1339 | 'heading' => __('Text', 'reviews-feed'), |
| 1340 | 'style' => [ '.sb-item-text' => 'color:{{value}};' ] |
| 1341 | ] |
| 1342 | ] |
| 1343 | ], |
| 1344 | [//Paragraph Text Spacing |
| 1345 | 'type' => 'group', |
| 1346 | 'id' => 'text_paragraph_spacing', |
| 1347 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 1348 | 'controls' => [ |
| 1349 | [ |
| 1350 | 'type' => 'distance', |
| 1351 | 'distancetype' => 'padding', |
| 1352 | 'id' => 'paragraphPadding', |
| 1353 | 'heading' => __('Padding', 'reviews-feed'), |
| 1354 | 'style' => [ '.sb-item-text' => 'padding:{{value}};' ] |
| 1355 | ], |
| 1356 | [ |
| 1357 | 'type' => 'distance', |
| 1358 | 'distancetype' => 'margin', |
| 1359 | 'id' => 'paragraphMargin', |
| 1360 | 'heading' => __('Margin', 'reviews-feed'), |
| 1361 | 'style' => [ '.sb-item-text' => 'margin:{{value}};' ] |
| 1362 | ] |
| 1363 | ] |
| 1364 | ] |
| 1365 | ] |
| 1366 | ], |
| 1367 | [//Post Author Date |
| 1368 | 'heading' => __('Author and Date', 'reviews-feed'), |
| 1369 | 'id' => 'author', |
| 1370 | 'highlight' => 'post-author-date', |
| 1371 | 'controls' => [ |
| 1372 | [ |
| 1373 | 'type' => 'checkboxsection', |
| 1374 | 'id' => 'author_content_sections', |
| 1375 | 'settingId' => 'authorContent', |
| 1376 | 'topLabel' => __('Name', 'reviews-feed'), |
| 1377 | 'includeTop' => true, |
| 1378 | 'controls' => [ |
| 1379 | [//Author Name |
| 1380 | 'heading' => __('Author Name', 'reviews-feed'), |
| 1381 | 'id' => 'name', |
| 1382 | 'highlight' => 'post-author-name', |
| 1383 | 'controls' => [ |
| 1384 | [//Author Font |
| 1385 | 'type' => 'group', |
| 1386 | 'id' => 'author_font', |
| 1387 | 'heading' => __('Font', 'reviews-feed'), |
| 1388 | 'controls' => [ |
| 1389 | [ |
| 1390 | 'type' => 'font', |
| 1391 | 'id' => 'authorNameFont', |
| 1392 | 'style' => [ '.sb-item-author-name' => '{{value}}' ] |
| 1393 | ] |
| 1394 | ] |
| 1395 | ], |
| 1396 | [//Author Name Spacing |
| 1397 | 'type' => 'group', |
| 1398 | 'id' => 'author_name_spacing', |
| 1399 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 1400 | 'controls' => [ |
| 1401 | [ |
| 1402 | 'type' => 'distance', |
| 1403 | 'distancetype' => 'padding', |
| 1404 | 'id' => 'authorNamePadding', |
| 1405 | 'heading' => __('Padding', 'reviews-feed'), |
| 1406 | 'style' => [ '.sb-item-author-name' => 'padding:{{value}};' ] |
| 1407 | ], |
| 1408 | [ |
| 1409 | 'type' => 'distance', |
| 1410 | 'distancetype' => 'margin', |
| 1411 | 'id' => 'authorNameMargin', |
| 1412 | 'heading' => __('Margin', 'reviews-feed'), |
| 1413 | 'style' => [ '.sb-item-author-name' => 'margin:{{value}};' ] |
| 1414 | ] |
| 1415 | ] |
| 1416 | ] |
| 1417 | ] |
| 1418 | ], |
| 1419 | [//Author Image |
| 1420 | 'heading' => __('Author Image', 'reviews-feed'), |
| 1421 | 'id' => 'image', |
| 1422 | 'highlight' => 'post-author-image', |
| 1423 | 'upsellModal' => 'authorImageModal', |
| 1424 | 'controls' => [ |
| 1425 | [ |
| 1426 | 'type' => 'separator', |
| 1427 | 'top' => 10, |
| 1428 | 'bottom' => 20, |
| 1429 | ], |
| 1430 | [ |
| 1431 | 'type' => 'number', |
| 1432 | 'id' => 'authorImageBorderRadius', |
| 1433 | 'heading' => __('Border Radius', 'reviews-feed'), |
| 1434 | 'trailingText' => 'px', |
| 1435 | 'layout' => 'half', |
| 1436 | 'stacked' => true, |
| 1437 | 'strongheading' => false, |
| 1438 | 'bottom' => 20, |
| 1439 | 'style' => ['.sb-item-author-img img' => 'border-radius:{{value}}px;'] |
| 1440 | ], |
| 1441 | [//Author Image Spacing |
| 1442 | 'type' => 'group', |
| 1443 | 'id' => 'author_image_spacing', |
| 1444 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 1445 | 'controls' => [ |
| 1446 | [ |
| 1447 | 'type' => 'distance', |
| 1448 | 'distancetype' => 'margin', |
| 1449 | 'id' => 'authorImageMargin', |
| 1450 | 'heading' => __('Margin', 'reviews-feed'), |
| 1451 | 'style' => [ '.sb-item-author-img' => 'margin:{{value}};' ] |
| 1452 | ] |
| 1453 | ] |
| 1454 | ] |
| 1455 | ] |
| 1456 | ], |
| 1457 | [//Author Date |
| 1458 | 'heading' => __('Date', 'reviews-feed'), |
| 1459 | 'id' => 'date', |
| 1460 | 'highlight' => 'post-date', |
| 1461 | 'controls' => [ |
| 1462 | [//Date Font |
| 1463 | 'type' => 'group', |
| 1464 | 'id' => 'date_font', |
| 1465 | 'heading' => __('Font', 'reviews-feed'), |
| 1466 | 'controls' => [ |
| 1467 | [ |
| 1468 | 'type' => 'font', |
| 1469 | 'id' => 'dateFont', |
| 1470 | 'style' => [ '.sb-item-author-date' => '{{value}}' ] |
| 1471 | ] |
| 1472 | ] |
| 1473 | ], |
| 1474 | [//Date Font |
| 1475 | 'type' => 'group', |
| 1476 | 'id' => 'date_format', |
| 1477 | 'heading' => __('Format', 'reviews-feed'), |
| 1478 | 'controls' => [ |
| 1479 | [ |
| 1480 | 'type' => 'select', |
| 1481 | 'id' => 'dateFormat', |
| 1482 | 'stacked' => true, |
| 1483 | 'options' => self::get_date_format_options() |
| 1484 | ], |
| 1485 | [ |
| 1486 | 'type' => 'text', |
| 1487 | 'id' => 'dateCustomFormat', |
| 1488 | 'stacked' => true, |
| 1489 | 'condition' => [ |
| 1490 | 'dateFormat' => [ 'custom' ] |
| 1491 | ] |
| 1492 | ], |
| 1493 | [ |
| 1494 | 'type' => 'text', |
| 1495 | 'id' => 'dateBeforeText', |
| 1496 | 'heading' => __('Add text before date', 'reviews-feed'), |
| 1497 | 'layout' => 'half', |
| 1498 | 'stacked' => true, |
| 1499 | 'strongheading' => false |
| 1500 | ], |
| 1501 | [ |
| 1502 | 'type' => 'text', |
| 1503 | 'id' => 'dateAfterText', |
| 1504 | 'heading' => __('Add text after date', 'reviews-feed'), |
| 1505 | 'layout' => 'half', |
| 1506 | 'stacked' => true, |
| 1507 | 'strongheading' => false |
| 1508 | ], |
| 1509 | |
| 1510 | ] |
| 1511 | ], |
| 1512 | [//Date Spacing |
| 1513 | 'type' => 'group', |
| 1514 | 'id' => 'date_spacing', |
| 1515 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 1516 | 'controls' => [ |
| 1517 | [ |
| 1518 | 'type' => 'distance', |
| 1519 | 'distancetype' => 'padding', |
| 1520 | 'id' => 'datePadding', |
| 1521 | 'heading' => __('Padding', 'reviews-feed'), |
| 1522 | 'style' => [ '.sb-item-author-date' => 'padding:{{value}};' ] |
| 1523 | ], |
| 1524 | [ |
| 1525 | 'type' => 'distance', |
| 1526 | 'distancetype' => 'margin', |
| 1527 | 'id' => 'dateMargin', |
| 1528 | 'heading' => __('Margin', 'reviews-feed'), |
| 1529 | 'style' => [ '.sb-item-author-date' => 'margin:{{value}};' ] |
| 1530 | ] |
| 1531 | ] |
| 1532 | ] |
| 1533 | ] |
| 1534 | ] |
| 1535 | |
| 1536 | ] |
| 1537 | ], |
| 1538 | [//Author & Date Colors |
| 1539 | 'type' => 'group', |
| 1540 | 'id' => 'author_date_color', |
| 1541 | 'heading' => __('Colors', 'reviews-feed'), |
| 1542 | 'controls' => [ |
| 1543 | [ |
| 1544 | 'type' => 'colorpicker', |
| 1545 | 'id' => 'authorNameColor', |
| 1546 | 'layout' => 'half', |
| 1547 | 'strongheading' => false, |
| 1548 | 'heading' => __('Author Name', 'reviews-feed'), |
| 1549 | 'style' => [ '.sb-item-author-name' => 'color:{{value}};' ] |
| 1550 | ], |
| 1551 | [ |
| 1552 | 'type' => 'colorpicker', |
| 1553 | 'id' => 'dateColor', |
| 1554 | 'layout' => 'half', |
| 1555 | 'strongheading' => false, |
| 1556 | 'heading' => __('Date', 'reviews-feed'), |
| 1557 | 'style' => [ '.sb-item-author-date' => 'color:{{value}};' ] |
| 1558 | ] |
| 1559 | ] |
| 1560 | ], |
| 1561 | [//Author Content Spacing |
| 1562 | 'type' => 'group', |
| 1563 | 'id' => 'author_content_spacing', |
| 1564 | 'heading' => __('Element Spacing', 'reviews-feed'), |
| 1565 | 'controls' => [ |
| 1566 | [ |
| 1567 | 'type' => 'distance', |
| 1568 | 'distancetype' => 'padding', |
| 1569 | 'id' => 'authorPadding', |
| 1570 | 'heading' => __('Padding', 'reviews-feed'), |
| 1571 | 'style' => [ '.sb-item-author-ctn' => 'padding:{{value}};' ] |
| 1572 | ], |
| 1573 | [ |
| 1574 | 'type' => 'distance', |
| 1575 | 'distancetype' => 'margin', |
| 1576 | 'id' => 'authorMargin', |
| 1577 | 'heading' => __('Margin', 'reviews-feed'), |
| 1578 | 'style' => [ '.sb-item-author-ctn' => 'margin:{{value}};' ] |
| 1579 | ] |
| 1580 | ] |
| 1581 | ] |
| 1582 | ] |
| 1583 | ], |
| 1584 | [ //Post Media |
| 1585 | 'heading' => __('Images or Videos', 'reviews-feed'), |
| 1586 | 'id' => 'media', |
| 1587 | 'upsellModal' => 'reviewsMediaModal', |
| 1588 | 'controls' => [ |
| 1589 | |
| 1590 | ] |
| 1591 | ] |
| 1592 | |
| 1593 | |
| 1594 | |
| 1595 | ] |
| 1596 | ], |
| 1597 | ]; |
| 1598 | } |
| 1599 | |
| 1600 | /** |
| 1601 | * Date Format Options |
| 1602 | * |
| 1603 | * |
| 1604 | * @since 1.0 |
| 1605 | * @access public |
| 1606 | * |
| 1607 | * @return array |
| 1608 | */ |
| 1609 | public static function get_date_format_options() |
| 1610 | { |
| 1611 | $original = strtotime('2016-07-25T17:30:00+0000'); |
| 1612 | return [ |
| 1613 | '1' => __('2 days ago', 'reviews-feed'), |
| 1614 | '2' => date('F jS, g:i a', $original), |
| 1615 | '3' => date('F jS', $original), |
| 1616 | '4' => date('D F jS', $original), |
| 1617 | '5' => date('l F jS', $original), |
| 1618 | '6' => date('D M jS, Y', $original), |
| 1619 | '7' => date('l F jS, Y', $original), |
| 1620 | '8' => date('l F jS, Y - g:i a', $original), |
| 1621 | '9' => date("l M jS, 'y", $original), |
| 1622 | '10' => date('m.d.y', $original), |
| 1623 | '18' => date('m.d.y - G:i', $original), |
| 1624 | '11' => date('m/d/y', $original), |
| 1625 | '12' => date('d.m.y', $original), |
| 1626 | '19' => date('d.m.y - G:i', $original), |
| 1627 | '13' => date('d/m/y', $original), |
| 1628 | '14' => date('d-m-Y, G:i', $original), |
| 1629 | '15' => date('jS F Y, G:i', $original), |
| 1630 | '16' => date('d M Y, G:i', $original), |
| 1631 | '17' => date('l jS F Y, G:i', $original), |
| 1632 | '18' => date('Y-m-d', $original), |
| 1633 | 'custom' => __('Custom', 'reviews-feed') |
| 1634 | ]; |
| 1635 | } |
| 1636 | } |
| 1637 |