migrate_legacy_options(); $this->settings_page = new Settings_Page(); add_action( 'admin_notices', array( $this, 'render_dependency_notice' ) ); add_action( 'elementor_pro/forms/actions/register', array( $this, 'register_form_action' ) ); } /** * Moves settings saved under the plugin's original development prefix. */ private function migrate_legacy_options(): void { $legacy_options = array( 'ebs_brevo_api_key' => self::OPTION_API_KEY, 'ebs_brevo_lists' => self::OPTION_LISTS, 'ebs_delete_data_on_uninstall' => self::OPTION_DELETE_DATA, ); foreach ( $legacy_options as $legacy_name => $current_name ) { $legacy_value = get_option( $legacy_name, null ); if ( null === $legacy_value ) { continue; } if ( null === get_option( $current_name, null ) ) { add_option( $current_name, $legacy_value, '', false ); } delete_option( $legacy_name ); } } /** * Registers the Brevo action with Elementor Pro Forms. * * @param object $form_actions_registrar Elementor form action registrar. */ public function register_form_action( $form_actions_registrar ): void { if ( ! class_exists( '\ElementorPro\Modules\Forms\Classes\Action_Base' ) ) { return; } require_once ABDWP_BECS_PLUGIN_DIR . 'includes/class-elementor-action.php'; $form_actions_registrar->register( new Elementor_Action() ); } /** * Shows an admin notice when Elementor Pro Forms is unavailable. */ public function render_dependency_notice(): void { if ( ! current_user_can( 'activate_plugins' ) ) { return; } if ( did_action( 'elementor/loaded' ) && class_exists( '\ElementorPro\Plugin' ) ) { return; } $screen = get_current_screen(); if ( ! $screen || 'plugins' !== $screen->id ) { return; } printf( '
%s