class-button.php
2 months ago
class-insert-button.php
2 months ago
class-premium-button.php
2 months ago
class-preview-button.php
2 months ago
class-premium-button.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SuperbAddons\Components\Buttons; |
| 4 | |
| 5 | defined('ABSPATH') || exit(); |
| 6 | |
| 7 | use SuperbAddons\Admin\Utils\AdminLinkUtil; |
| 8 | use SuperbAddons\Components\Buttons\Button; |
| 9 | use SuperbAddons\Components\Buttons\ButtonIcon; |
| 10 | use SuperbAddons\Components\Buttons\ButtonType; |
| 11 | |
| 12 | class PremiumButton |
| 13 | { |
| 14 | public function __construct($source, $options = false, $additional_attributes = false) |
| 15 | { |
| 16 | $attributes = array( |
| 17 | 'text' => __('Get Premium', "superb-blocks"), |
| 18 | 'url' => AdminLinkUtil::GetLink($source, $options), |
| 19 | 'class' => 'superb-addons-template-library-template-item-premium-btn superbaddons-element-button-pro superbaddons-element-flex1 superbaddons-item-premium-element', |
| 20 | 'target' => '_blank', |
| 21 | // Progressive-enhancement hook: the admin upsell modal JS bundle |
| 22 | // intercepts clicks on elements with this data attribute and opens |
| 23 | // the upsell modal with the matching AdminLinkSource copy before |
| 24 | // the anchor's href navigates. |
| 25 | 'data' => array('superb-upsell-source' => $source), |
| 26 | ); |
| 27 | |
| 28 | if (!empty($additional_attributes)) { |
| 29 | $attributes = array_merge($attributes, $additional_attributes); |
| 30 | } |
| 31 | |
| 32 | new Button( |
| 33 | ButtonType::Primary, |
| 34 | ButtonIcon::ExternalLink, |
| 35 | $attributes |
| 36 | ); |
| 37 | } |
| 38 | } |
| 39 |