| @@ -3,9 +3,13 @@ | ||
| 3 | 3 | namespace Elementor\Modules\Promotions; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Api; |
| 6 | 6 | use Elementor\Controls_Manager; |
| 7 | +use Elementor\Core\Admin\Menu\Admin_Menu_Manager; | |
| 7 | 8 | use Elementor\Core\Base\Module as Base_Module; |
| 9 | +use Elementor\Modules\Promotions\AdminMenuItems\Custom_Code_Promotion_Item; | |
| 10 | +use Elementor\Modules\Promotions\AdminMenuItems\Custom_Fonts_Promotion_Item; | |
| 11 | +use Elementor\Modules\Promotions\AdminMenuItems\Custom_Icons_Promotion_Item; | |
| 8 | 12 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Custom_Code_Menu; |
| 9 | 13 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Custom_Elements_Menu; |
| 10 | 14 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Fonts_Menu; |
| 11 | 15 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Icons_Menu; |
| @@ -10,15 +14,16 @@ | ||
| 10 | 14 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Fonts_Menu; |
| 11 | 15 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Icons_Menu; |
| 12 | 16 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Popups_Menu; |
| 13 | 17 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Submissions_Menu; |
| 18 | +use Elementor\Modules\Promotions\AdminMenuItems\Form_Submissions_Promotion_Item; | |
| 14 | 19 | use Elementor\Modules\Promotions\AdminMenuItems\Go_Pro_Promotion_Item; |
| 20 | +use Elementor\Modules\Promotions\AdminMenuItems\Popups_Promotion_Item; | |
| 15 | 21 | use Elementor\Modules\Promotions\Controls\Atomic_Promotion_Control; |
| 16 | 22 | use Elementor\Modules\Promotions\Pointers\Birthday; |
| 17 | 23 | use Elementor\Modules\Promotions\Pointers\Black_Friday; |
| 18 | 24 | use Elementor\Modules\Promotions\PropTypes\Promotion_Prop_Type; |
| 19 | 25 | use Elementor\Modules\Promotions\Widgets\Ally_Dashboard_Widget; |
| 20 | -use Elementor\Modules\Promotions\Widgets\Atomic_Form_Widget_Promotion; | |
| 21 | 26 | use Elementor\Widgets_Manager; |
| 22 | 27 | use Elementor\Utils; |
| 23 | 28 | use Elementor\Includes\EditorAssetsAPI; |
| 24 | 29 | use Elementor\Plugin; |
| @@ -48,12 +53,20 @@ | ||
| 48 | 53 | add_action( 'admin_init', function () { |
| 49 | 54 | $this->handle_external_redirects(); |
| 50 | 55 | } ); |
| 51 | 56 | |
| 57 | + add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) { | |
| 58 | + $this->register_menu_items( $admin_menu ); | |
| 59 | + }, static::ADMIN_MENU_PRIORITY ); | |
| 60 | + | |
| 52 | 61 | add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) { |
| 53 | 62 | $this->register_editor_one_menu_items( $menu_data_provider ); |
| 54 | 63 | } ); |
| 55 | 64 | |
| 65 | + add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) { | |
| 66 | + $this->register_promotion_menu_item( $admin_menu ); | |
| 67 | + }, static::ADMIN_MENU_PROMOTIONS_PRIORITY ); | |
| 68 | + | |
| 56 | 69 | add_action( 'elementor/widgets/register', function( Widgets_Manager $manager ) { |
| 57 | 70 | foreach ( Api::get_promotion_widgets() as $widget_data ) { |
| 58 | 71 | $manager->register( new Widgets\Pro_Widget_Promotion( [], [ |
| 59 | 72 | 'widget_name' => $widget_data['name'], |
| @@ -93,9 +106,9 @@ | ||
| 93 | 106 | * |
| 94 | 107 | * @return string |
| 95 | 108 | */ |
| 96 | 109 | public static function get_ally_external_scanner_url(): string { |
| 97 | - return apply_filters( 'elementor/ally_external_scanner_url', 'https://go.elementor.com/acc-checker-dashboard-plg' ); | |
| 110 | + return apply_filters( 'elementor/ally_external_scanner_url', 'https://elementor.com/tools/ally-accessibility-checker/scanner' ); | |
| 98 | 111 | } |
| 99 | 112 | |
| 100 | 113 | private function handle_external_redirects() { |
| 101 | 114 | $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); |
| @@ -108,8 +121,18 @@ | ||
| 108 | 121 | die; |
| 109 | 122 | } |
| 110 | 123 | } |
| 111 | 124 | |
| 125 | + private function register_menu_items( Admin_Menu_Manager $admin_menu ) { | |
| 126 | + if ( ! $this->is_editor_one_active() ) { | |
| 127 | + $admin_menu->register( 'e-form-submissions', new Form_Submissions_Promotion_Item() ); | |
| 128 | + $admin_menu->register( 'elementor_custom_fonts', new Custom_Fonts_Promotion_Item() ); | |
| 129 | + $admin_menu->register( 'elementor_custom_icons', new Custom_Icons_Promotion_Item() ); | |
| 130 | + $admin_menu->register( 'elementor_custom_code', new Custom_Code_Promotion_Item() ); | |
| 131 | + $admin_menu->register( 'popup_templates', new Popups_Promotion_Item() ); | |
| 132 | + } | |
| 133 | + } | |
| 134 | + | |
| 112 | 135 | private function register_editor_one_menu_items( Menu_Data_Provider $menu_data_provider ) { |
| 113 | 136 | $menu_data_provider->register_menu( new Editor_One_Custom_Elements_Menu() ); |
| 114 | 137 | $menu_data_provider->register_menu( new Editor_One_Submissions_Menu() ); |
| 115 | 138 | $menu_data_provider->register_menu( new Editor_One_Fonts_Menu() ); |
| @@ -117,8 +140,14 @@ | ||
| 117 | 140 | $menu_data_provider->register_menu( new Editor_One_Custom_Code_Menu() ); |
| 118 | 141 | $menu_data_provider->register_menu( new Editor_One_Popups_Menu() ); |
| 119 | 142 | } |
| 120 | 143 | |
| 144 | + private function register_promotion_menu_item( Admin_Menu_Manager $admin_menu ) { | |
| 145 | + if ( ! $this->is_editor_one_active() ) { | |
| 146 | + $admin_menu->register( 'go_elementor_pro', new Go_Pro_Promotion_Item() ); | |
| 147 | + } | |
| 148 | + } | |
| 149 | + | |
| 121 | 150 | public function enqueue_react_data(): void { |
| 122 | 151 | if ( ! current_user_can( 'manage_options' ) ) { |
| 123 | 152 | return; |
| 124 | 153 | } |
| @@ -204,8 +233,12 @@ | ||
| 204 | 233 | EditorAssetsAPI::ASSETS_DATA_KEY => 'promotions', |
| 205 | 234 | ]; |
| 206 | 235 | } |
| 207 | 236 | |
| 237 | + private function is_editor_one_active(): bool { | |
| 238 | + return (bool) Plugin::instance()->modules_manager->get_modules( 'editor-one' ); | |
| 239 | + } | |
| 240 | + | |
| 208 | 241 | private function is_atomic_widgets_active(): bool { |
| 209 | 242 | return Plugin::$instance->experiments->is_feature_active( 'e_atomic_elements' ); |
| 210 | 243 | } |
| 211 | 244 | |
| @@ -245,10 +278,8 @@ | ||
| 245 | 278 | 2 |
| 246 | 279 | ); |
| 247 | 280 | } |
| 248 | 281 | } ); |
| 249 | - | |
| 250 | - ( new Atomic_Form_Widget_Promotion() )->register(); | |
| 251 | 282 | } |
| 252 | 283 | |
| 253 | 284 | public function inject_atomic_promotion_props( array $schema ): array { |
| 254 | 285 | foreach ( $this->get_atomic_promotion_configs() as $config ) { |