| @@ -4,20 +4,23 @@ | ||
| 4 | 4 | |
| 5 | 5 | use Elementor\Core\Base\Module as BaseModule; |
| 6 | 6 | use Elementor\Core\Experiments\Manager; |
| 7 | 7 | use Elementor\Plugin; |
| 8 | -use Elementor\Utils; | |
| 9 | 8 | |
| 10 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | - exit; // Exit if accessed directly. | |
| 10 | + exit; // Exit if accessed directly | |
| 12 | 11 | } |
| 13 | 12 | |
| 14 | 13 | class Module extends BaseModule { |
| 15 | 14 | |
| 16 | - const WIDGET_HAS_CUSTOM_BREAKPOINTS = true; | |
| 15 | + const EXPERIMENT_NAME = 'link-in-bio'; | |
| 17 | 16 | |
| 17 | + public static function is_active(): bool { | |
| 18 | + return Plugin::$instance->experiments->is_feature_active( static::EXPERIMENT_NAME ); | |
| 19 | + } | |
| 20 | + | |
| 18 | 21 | public function get_name(): string { |
| 19 | - return 'link-in-bio'; | |
| 22 | + return static::EXPERIMENT_NAME; | |
| 20 | 23 | } |
| 21 | 24 | |
| 22 | 25 | public function get_widgets(): array { |
| 23 | 26 | return [ |
| @@ -24,47 +27,18 @@ | ||
| 24 | 27 | 'Link_In_Bio', |
| 25 | 28 | ]; |
| 26 | 29 | } |
| 27 | 30 | |
| 28 | - public function __construct() { | |
| 29 | - parent::__construct(); | |
| 30 | - | |
| 31 | - add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] ); | |
| 32 | - } | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * Register styles. | |
| 36 | - * | |
| 37 | - * At build time, Elementor compiles `/modules/link-in-bio/assets/scss/widgets/*.scss` | |
| 38 | - * to `/assets/css/widget-*.min.css`. | |
| 39 | - * | |
| 40 | - * @return void | |
| 41 | - */ | |
| 42 | - public function register_styles() { | |
| 43 | - $direction_suffix = is_rtl() ? '-rtl' : ''; | |
| 44 | - $widget_styles = $this->get_widgets_style_list(); | |
| 45 | - $has_custom_breakpoints = Plugin::$instance->breakpoints->has_custom_breakpoints(); | |
| 46 | - | |
| 47 | - foreach ( $widget_styles as $widget_style_name => $widget_has_responsive_style ) { | |
| 48 | - $should_load_responsive_css = $widget_has_responsive_style ? $has_custom_breakpoints : false; | |
| 49 | - | |
| 50 | - wp_register_style( | |
| 51 | - $widget_style_name, | |
| 52 | - $this->get_frontend_file_url( "{$widget_style_name}{$direction_suffix}.min.css", $should_load_responsive_css ), | |
| 53 | - [ 'elementor-frontend' ], | |
| 54 | - $should_load_responsive_css ? null : ELEMENTOR_VERSION | |
| 55 | - ); | |
| 56 | - } | |
| 57 | - } | |
| 58 | - | |
| 59 | - private function get_widgets_style_list(): array { | |
| 31 | + public static function get_experimental_data(): array { | |
| 60 | 32 | return [ |
| 61 | - 'widget-link-in-bio' => self::WIDGET_HAS_CUSTOM_BREAKPOINTS, // TODO: Remove in v3.27.0 [ED-15717] | |
| 62 | - 'widget-link-in-bio-base' => self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 63 | - 'widget-link-in-bio-var-2' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 64 | - 'widget-link-in-bio-var-3' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 65 | - 'widget-link-in-bio-var-4' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 66 | - 'widget-link-in-bio-var-5' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 67 | - 'widget-link-in-bio-var-7' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 33 | + 'name' => static::EXPERIMENT_NAME, | |
| 34 | + 'title' => esc_html__( 'Link In Bio', 'elementor' ), | |
| 35 | + 'description' => esc_html__( 'Create bio link landing pages and digital business cards that convert with Link in Bio widgets. Share your link in bio pages on your social media profiles. Create as many as you need for different audiences and goals.', 'elementor' ), | |
| 36 | + 'default' => Manager::STATE_INACTIVE, | |
| 37 | + 'release_status' => Manager::RELEASE_STATUS_BETA, | |
| 38 | + 'new_site' => [ | |
| 39 | + 'default_active' => true, | |
| 40 | + 'minimum_installation_version' => '3.23.0', | |
| 41 | + ], | |
| 68 | 42 | ]; |
| 69 | 43 | } |
| 70 | 44 | } |