| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\Promotions\Widgets; |
| 4 |
|
| 5 |
use Elementor\Plugin; |
| 6 |
use Elementor\Utils; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
class Atomic_Form_Widget_Promotion { |
| 13 |
|
| 14 |
public function register(): void { |
| 15 |
add_filter( 'elementor/editor/localize_settings', [ $this, 'add_promotion_data' ] ); |
| 16 |
} |
| 17 |
|
| 18 |
private function is_active(): bool { |
| 19 |
return Plugin::$instance->experiments->is_feature_active( 'e_atomic_elements' ); |
| 20 |
} |
| 21 |
|
| 22 |
public function add_promotion_data( array $settings ): array { |
| 23 |
if ( ! current_user_can( 'manage_options' ) || ! $this->is_active() ) { |
| 24 |
return $settings; |
| 25 |
} |
| 26 |
|
| 27 |
$settings['atomicFormPromotionWidgets'] = $this->get_widgets(); |
| 28 |
$settings['atomicFormPromotion'] = $this->get_promotion_content(); |
| 29 |
|
| 30 |
return $settings; |
| 31 |
} |
| 32 |
|
| 33 |
private function get_widgets(): array { |
| 34 |
return [ |
| 35 |
[ |
| 36 |
'name' => 'e-form', |
| 37 |
'title' => __( 'Form', 'elementor' ), |
| 38 |
'icon' => 'eicon-atomic-form', |
| 39 |
'categories' => '["atomic-form"]', |
| 40 |
], |
| 41 |
[ |
| 42 |
'name' => 'e-form-input', |
| 43 |
'title' => __( 'Input', 'elementor' ), |
| 44 |
'icon' => 'eicon-atomic-input', |
| 45 |
'categories' => '["atomic-form"]', |
| 46 |
], |
| 47 |
[ |
| 48 |
'name' => 'e-form-label', |
| 49 |
'title' => __( 'Label', 'elementor' ), |
| 50 |
'icon' => 'eicon-atomic-label', |
| 51 |
'categories' => '["atomic-form"]', |
| 52 |
], |
| 53 |
[ |
| 54 |
'name' => 'e-form-textarea', |
| 55 |
'title' => __( 'Text area', 'elementor' ), |
| 56 |
'icon' => 'eicon-atomic-text-area', |
| 57 |
'categories' => '["atomic-form"]', |
| 58 |
], |
| 59 |
[ |
| 60 |
'name' => 'e-form-submit-button', |
| 61 |
'title' => __( 'Submit button', 'elementor' ), |
| 62 |
'icon' => 'eicon-atomic-submit-button', |
| 63 |
'categories' => '["atomic-form"]', |
| 64 |
], |
| 65 |
[ |
| 66 |
'name' => 'e-form-checkbox', |
| 67 |
'title' => __( 'Checkbox', 'elementor' ), |
| 68 |
'icon' => 'eicon-atomic-checkbox', |
| 69 |
'categories' => '["atomic-form"]', |
| 70 |
], |
| 71 |
]; |
| 72 |
} |
| 73 |
|
| 74 |
private function get_promotion_content(): array { |
| 75 |
return [ |
| 76 |
'title' => __( 'Atomic form', 'elementor' ), |
| 77 |
'content' => __( 'Design fully customized forms to capture leads without compromising on style.', 'elementor' ), |
| 78 |
'ctaText' => __( 'Upgrade now', 'elementor' ), |
| 79 |
'widgetCtaUrl' => 'https://go.elementor.com/go-pro-atomic-form-modal/', |
| 80 |
'sectionCtaUrl' => 'https://go.elementor.com/go-pro-atomic-form-section/', |
| 81 |
]; |
| 82 |
} |
| 83 |
} |
| 84 |
|