| @@ -3,21 +3,19 @@ | ||
| 3 | 3 | namespace Elementor\Modules\LinkInBio; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Core\Base\Module as BaseModule; |
| 6 | 6 | use Elementor\Core\Experiments\Manager; |
| 7 | -use Elementor\Plugin; | |
| 8 | -use Elementor\Utils; | |
| 9 | 7 | |
| 10 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | - exit; // Exit if accessed directly. | |
| 9 | + exit; // Exit if accessed directly | |
| 12 | 10 | } |
| 13 | 11 | |
| 14 | 12 | class Module extends BaseModule { |
| 15 | 13 | |
| 16 | - const WIDGET_HAS_CUSTOM_BREAKPOINTS = true; | |
| 14 | + const EXPERIMENT_NAME = 'link-in-bio'; | |
| 17 | 15 | |
| 18 | 16 | public function get_name(): string { |
| 19 | - return 'link-in-bio'; | |
| 17 | + return static::EXPERIMENT_NAME; | |
| 20 | 18 | } |
| 21 | 19 | |
| 22 | 20 | public function get_widgets(): array { |
| 23 | 21 | return [ |
| @@ -24,8 +22,20 @@ | ||
| 24 | 22 | 'Link_In_Bio', |
| 25 | 23 | ]; |
| 26 | 24 | } |
| 27 | 25 | |
| 26 | + // TODO: This is a hidden experiment which needs to remain enabled like this until 3.26 for pro compatibility. | |
| 27 | + public static function get_experimental_data() { | |
| 28 | + return [ | |
| 29 | + 'name' => self::EXPERIMENT_NAME, | |
| 30 | + 'title' => esc_html__( 'Link In Bio', 'elementor' ), | |
| 31 | + 'hidden' => true, | |
| 32 | + 'default' => Manager::STATE_ACTIVE, | |
| 33 | + 'release_status' => Manager::RELEASE_STATUS_STABLE, | |
| 34 | + 'mutable' => false, | |
| 35 | + ]; | |
| 36 | + } | |
| 37 | + | |
| 28 | 38 | public function __construct() { |
| 29 | 39 | parent::__construct(); |
| 30 | 40 | |
| 31 | 41 | add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] ); |
| @@ -33,38 +43,18 @@ | ||
| 33 | 43 | |
| 34 | 44 | /** |
| 35 | 45 | * Register styles. |
| 36 | 46 | * |
| 37 | - * At build time, Elementor compiles `/modules/link-in-bio/assets/scss/widgets/*.scss` | |
| 38 | - * to `/assets/css/widget-*.min.css`. | |
| 47 | + * At build time, Elementor compiles `/modules/link-in-bio/assets/scss/frontend.scss` | |
| 48 | + * to `/assets/css/widget-link-in-bio.min.css`. | |
| 39 | 49 | * |
| 40 | 50 | * @return void |
| 41 | 51 | */ |
| 42 | 52 | 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 { | |
| 60 | - 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, | |
| 68 | - ]; | |
| 53 | + wp_register_style( | |
| 54 | + 'widget-link-in-bio', | |
| 55 | + $this->get_css_assets_url( 'widget-link-in-bio', null, true, true ), | |
| 56 | + [ 'elementor-frontend' ], | |
| 57 | + ELEMENTOR_VERSION | |
| 58 | + ); | |
| 69 | 59 | } |
| 70 | 60 | } |