class-css-blocks-base-slot.php
2 months ago
class-css-blocks-export-selected-slot.php
2 months ago
class-css-blocks-export-single-slot.php
2 months ago
class-css-blocks-target-slot.php
2 months ago
class-premium-option-wrapper.php
2 months ago
class-premium-slot.php
2 months ago
class-slot-render-utility.php
2 months ago
class-premium-option-wrapper.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SuperbAddons\Components\Slots; |
| 4 | |
| 5 | use SuperbAddons\Admin\Utils\AdminLinkUtil; |
| 6 | |
| 7 | defined('ABSPATH') || exit(); |
| 8 | |
| 9 | class PremiumOptionWrapper |
| 10 | { |
| 11 | public function __construct($contentCallback, $classes = array(), $source = false, $link_options = false, $allow_pointer_events = false) |
| 12 | { |
| 13 | $this->Render($contentCallback, $classes, $source, $link_options, $allow_pointer_events); |
| 14 | } |
| 15 | |
| 16 | private function Render($contentCallback, $classes, $source, $link_options, $allow_pointer_events) |
| 17 | { |
| 18 | // data-superb-upsell-source lives on the wrapper (not the inner <a>) so |
| 19 | // clicks anywhere inside — including from inner content that has its |
| 20 | // own pointer events — bubble up and open the upsell modal. The badge |
| 21 | // anchor is the graceful no-JS / middle-click target. Children that |
| 22 | // need their own click behavior (e.g. .sba-wizard-preview-btn) just |
| 23 | // stopPropagation and the document delegation never fires. |
| 24 | $passthrough_class = $allow_pointer_events ? ' superbaddons-premium-only-option-wrapper-passthrough' : ''; |
| 25 | ?> |
| 26 | <div class="superbaddons-element-inlineflex-center superbaddons-premium-only-option-wrapper<?php echo esc_attr($passthrough_class); ?> <?php echo esc_attr(join(" ", $classes)); ?>"<?php echo $source ? ' data-superb-upsell-source="' . esc_attr($source) . '"' : ''; ?> title="<?php echo esc_attr__("Premium Feature", "superb-blocks"); ?>"> |
| 27 | <a href="<?php echo esc_url(AdminLinkUtil::GetLink($source, $link_options)); ?>" target="_blank" class="superbaddons-premium-only-option" aria-label="<?php echo esc_attr__("Premium Feature", "superb-blocks"); ?>"> |
| 28 | <div class="superbaddons-premium-only-option-icon"> |
| 29 | <img width="16" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-crown.svg'); ?>" /> |
| 30 | <span><?php echo esc_html__("Premium", "superb-blocks"); ?></span> |
| 31 | </div> |
| 32 | </a> |
| 33 | <div class="superbaddons-premium-only-content" style="<?php echo $allow_pointer_events ? '' : 'pointer-events: none;'; ?> opacity:0.5;"> |
| 34 | <?php SlotRenderUtility::Render($contentCallback); ?> |
| 35 | </div> |
| 36 | </div> |
| 37 | <?php |
| 38 | } |
| 39 | } |
| 40 |