| @@ -2,143 +2,123 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\FloatingButtons; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Controls_Manager; |
| 6 | +use Elementor\Core\Admin\Menu\Admin_Menu_Manager; | |
| 6 | 7 | use Elementor\Core\Base\Document; |
| 7 | 8 | use Elementor\Core\Base\Module as BaseModule; |
| 8 | 9 | use Elementor\Core\Documents_Manager; |
| 9 | -use Elementor\Modules\FloatingButtons\Base\Widget_Floating_Bars_Base; | |
| 10 | +use Elementor\Core\Experiments\Manager; | |
| 11 | +use Elementor\Modules\FloatingButtons\AdminMenuItems\Floating_Buttons_Empty_View_Menu_Item; | |
| 12 | +use Elementor\Modules\FloatingButtons\AdminMenuItems\Floating_Buttons_Menu_Item; | |
| 10 | 13 | use Elementor\Modules\FloatingButtons\Base\Widget_Contact_Button_Base; |
| 11 | -use Elementor\Modules\FloatingButtons\Classes\Action\Action_Handler; | |
| 12 | 14 | use Elementor\Modules\FloatingButtons\Control\Hover_Animation_Floating_Buttons; |
| 13 | 15 | use Elementor\Modules\FloatingButtons\Documents\Floating_Buttons; |
| 14 | 16 | use Elementor\Plugin; |
| 15 | 17 | use Elementor\TemplateLibrary\Source_Local; |
| 16 | 18 | use Elementor\Utils as ElementorUtils; |
| 17 | -use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider; | |
| 18 | -use Elementor\Modules\FloatingButtons\AdminMenuItems\Editor_One_Floating_Elements_Menu; | |
| 19 | 19 | |
| 20 | 20 | if ( ! defined( 'ABSPATH' ) ) { |
| 21 | - exit; // Exit if accessed directly. | |
| 21 | + exit; // Exit if accessed directly | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | class Module extends BaseModule { |
| 25 | 25 | |
| 26 | - const FLOATING_ELEMENTS_TYPE_META_KEY = '_elementor_floating_elements_type'; | |
| 26 | + const EXPERIMENT_NAME = 'floating-buttons'; | |
| 27 | + | |
| 28 | + const ROUTER_VERSION = '1.0.0'; | |
| 27 | 29 | const ROUTER_OPTION_KEY = 'elementor_floating_buttons_router_version'; |
| 30 | + | |
| 28 | 31 | const META_CLICK_TRACKING = '_elementor_click_tracking'; |
| 32 | + | |
| 29 | 33 | const CLICK_TRACKING_NONCE = 'elementor-conversion-center-click'; |
| 34 | + | |
| 30 | 35 | const FLOATING_BUTTONS_DOCUMENT_TYPE = 'floating-buttons'; |
| 31 | 36 | const CPT_FLOATING_BUTTONS = 'e-floating-buttons'; |
| 32 | 37 | const ADMIN_PAGE_SLUG_CONTACT = 'edit.php?post_type=e-floating-buttons'; |
| 33 | - const WIDGET_HAS_CUSTOM_BREAKPOINTS = true; | |
| 34 | 38 | |
| 35 | 39 | private $has_contact_pages = null; |
| 36 | 40 | private $trashed_contact_pages; |
| 37 | 41 | |
| 38 | 42 | public static function is_active(): bool { |
| 39 | - return Plugin::$instance->experiments->is_feature_active( 'container' ); | |
| 43 | + return Plugin::$instance->experiments->is_feature_active( static::EXPERIMENT_NAME ); | |
| 40 | 44 | } |
| 41 | 45 | |
| 42 | - public static function get_floating_elements_types() { | |
| 43 | - return [ | |
| 44 | - 'floating-buttons' => esc_html__( 'Floating Buttons', 'elementor' ), | |
| 45 | - 'floating-bars' => esc_html__( 'Floating Bars', 'elementor' ), | |
| 46 | - ]; | |
| 47 | - } | |
| 48 | - | |
| 49 | 46 | public function get_name(): string { |
| 50 | - return 'floating-buttons'; | |
| 47 | + return static::EXPERIMENT_NAME; | |
| 51 | 48 | } |
| 52 | 49 | |
| 53 | 50 | public function get_widgets(): array { |
| 51 | + return [ | |
| 52 | + 'Contact_Buttons', | |
| 53 | + ]; | |
| 54 | + } | |
| 54 | 55 | |
| 56 | + public static function get_experimental_data(): array { | |
| 55 | 57 | return [ |
| 56 | - 'Contact_Buttons', | |
| 57 | - 'Floating_Bars_Var_1', | |
| 58 | + 'name' => static::EXPERIMENT_NAME, | |
| 59 | + 'title' => esc_html__( 'Floating Buttons', 'elementor' ), | |
| 60 | + 'description' => esc_html__( 'Boost visitor engagement with Floating Buttons. The Floating Button template library offers a variety of interactive one-click contact options, highlighted links, and calls to action to increase your website conversions.', 'elementor' ), | |
| 61 | + 'default' => Manager::STATE_INACTIVE, | |
| 62 | + 'release_status' => Manager::RELEASE_STATUS_BETA, | |
| 63 | + 'dependencies' => [ | |
| 64 | + 'container', | |
| 65 | + ], | |
| 66 | + 'new_site' => [ | |
| 67 | + 'default_active' => true, | |
| 68 | + 'minimum_installation_version' => '3.23.0', | |
| 69 | + ], | |
| 58 | 70 | ]; |
| 59 | 71 | } |
| 60 | 72 | |
| 61 | - private function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ) { | |
| 62 | - $menu_data_provider->register_menu( new Editor_One_Floating_Elements_Menu() ); | |
| 73 | + private function register_admin_menu_legacy( Admin_Menu_Manager $admin_menu ) { | |
| 74 | + $menu_args = $this->get_contact_menu_args(); | |
| 75 | + $function = $menu_args['function']; | |
| 76 | + if ( is_callable( $function ) ) { | |
| 77 | + $admin_menu->register( $menu_args['menu_slug'], new Floating_Buttons_Empty_View_Menu_Item( $function ) ); | |
| 78 | + } else { | |
| 79 | + $admin_menu->register( $menu_args['menu_slug'], new Floating_Buttons_Menu_Item() ); | |
| 80 | + }; | |
| 81 | + | |
| 63 | 82 | } |
| 64 | 83 | |
| 65 | 84 | public function __construct() { |
| 66 | 85 | parent::__construct(); |
| 67 | 86 | |
| 68 | - if ( Floating_Buttons::is_creating_floating_buttons_page() || Floating_Buttons::is_editing_existing_floating_buttons_page() ) { | |
| 87 | + if ( $this->is_editing_existing_floating_buttons_page() || $this->is_creating_floating_buttons_page() ) { | |
| 69 | 88 | Controls_Manager::add_tab( |
| 70 | 89 | Widget_Contact_Button_Base::TAB_ADVANCED, |
| 71 | 90 | esc_html__( 'Advanced', 'elementor' ) |
| 72 | 91 | ); |
| 73 | - | |
| 74 | - Controls_Manager::add_tab( | |
| 75 | - Widget_Floating_Bars_Base::TAB_ADVANCED, | |
| 76 | - esc_html__( 'Advanced', 'elementor' ) | |
| 77 | - ); | |
| 78 | 92 | } |
| 79 | 93 | |
| 80 | 94 | $this->register_contact_pages_cpt(); |
| 81 | 95 | |
| 82 | - add_action( 'elementor/documents/register', function ( Documents_Manager $documents_manager ) { | |
| 83 | - $documents_manager->register_document_type( | |
| 84 | - static::FLOATING_BUTTONS_DOCUMENT_TYPE, | |
| 85 | - Floating_Buttons::get_class_full_name() | |
| 86 | - ); | |
| 87 | - } ); | |
| 96 | + if ( ! ElementorUtils::has_pro() ) { | |
| 97 | + add_action( 'elementor/documents/register', function ( Documents_Manager $documents_manager ) { | |
| 98 | + $documents_manager->register_document_type( | |
| 99 | + static::FLOATING_BUTTONS_DOCUMENT_TYPE, | |
| 100 | + Floating_Buttons::get_class_full_name() | |
| 101 | + ); | |
| 102 | + } ); | |
| 103 | + } | |
| 88 | 104 | |
| 89 | - add_action( 'current_screen', function() { | |
| 90 | - $screen = get_current_screen(); | |
| 91 | - if ( $screen && 'edit-e-floating-buttons' === $screen->id ) { | |
| 92 | - $this->flush_permalinks_on_elementor_version_change(); | |
| 93 | - } | |
| 94 | - }); | |
| 105 | + add_action( 'save_post_' . static::CPT_FLOATING_BUTTONS, [ $this, 'flush_permalinks_on_save' ] ); | |
| 95 | 106 | |
| 96 | - add_filter( 'elementor/editor-one/menu/elementor_post_types', function ( array $elementor_post_types ): array { | |
| 97 | - $elementor_post_types[ static::CPT_FLOATING_BUTTONS ] = [ | |
| 98 | - 'menu_slug' => 'elementor-editor-templates', | |
| 99 | - 'child_slug' => 'edit.php?post_type=e-floating-buttons', | |
| 100 | - ]; | |
| 101 | - return $elementor_post_types; | |
| 102 | - } ); | |
| 103 | - | |
| 104 | 107 | add_action( 'wp_ajax_elementor_send_clicks', [ $this, 'handle_click_tracking' ] ); |
| 105 | 108 | add_action( 'wp_ajax_nopriv_elementor_send_clicks', [ $this, 'handle_click_tracking' ] ); |
| 106 | 109 | |
| 107 | - add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] ); | |
| 108 | - | |
| 109 | 110 | add_action( 'elementor/controls/register', function ( Controls_Manager $controls_manager ) { |
| 110 | 111 | $controls_manager->register( new Hover_Animation_Floating_Buttons() ); |
| 111 | 112 | }); |
| 112 | 113 | |
| 113 | 114 | add_filter( 'elementor/widget/common/register_css_attributes_control', function ( $common_controls ) { |
| 114 | - if ( Floating_Buttons::is_creating_floating_buttons_page() || Floating_Buttons::is_editing_existing_floating_buttons_page() ) { | |
| 115 | + if ( $this->is_creating_floating_buttons_page() || $this->is_editing_existing_floating_buttons_page() ) { | |
| 115 | 116 | return false; |
| 116 | 117 | } |
| 117 | - | |
| 118 | 118 | return $common_controls; |
| 119 | 119 | } ); |
| 120 | 120 | |
| 121 | - add_filter( 'elementor/settings/controls/checkbox_list_cpt/post_type_objects', function ( $post_types ) { | |
| 122 | - unset( $post_types[ static::CPT_FLOATING_BUTTONS ] ); | |
| 123 | - | |
| 124 | - return $post_types; | |
| 125 | - } ); | |
| 126 | - | |
| 127 | - add_filter( | |
| 128 | - 'elementor/template_library/sources/local/is_valid_template_type', | |
| 129 | - function ( $is_valid_template_type, $cpt ) { | |
| 130 | - | |
| 131 | - if ( in_array( static::CPT_FLOATING_BUTTONS, $cpt, true ) ) { | |
| 132 | - return true; | |
| 133 | - } | |
| 134 | - | |
| 135 | - return $is_valid_template_type; | |
| 136 | - }, | |
| 137 | - 10, | |
| 138 | - 2 | |
| 139 | - ); | |
| 140 | - | |
| 141 | 121 | if ( ! ElementorUtils::has_pro() ) { |
| 142 | 122 | add_action( 'wp_footer', function () { |
| 143 | 123 | $this->render_floating_buttons(); |
| 144 | 124 | } ); |
| @@ -152,11 +132,11 @@ | ||
| 152 | 132 | |
| 153 | 133 | return $is_top_bar_active; |
| 154 | 134 | }, 10, 2 ); |
| 155 | 135 | |
| 156 | - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) { | |
| 157 | - $this->register_editor_one_menu( $menu_data_provider ); | |
| 158 | - } ); | |
| 136 | + add_action( 'elementor/admin/menu/register', function( Admin_Menu_Manager $admin_menu ) { | |
| 137 | + $this->register_admin_menu_legacy( $admin_menu ); | |
| 138 | + }, Source_Local::ADMIN_MENU_PRIORITY + 20 ); | |
| 159 | 139 | |
| 160 | 140 | add_action( 'elementor/admin/localize_settings', function ( array $settings ) { |
| 161 | 141 | return $this->admin_localize_settings( $settings ); |
| 162 | 142 | } ); |
| @@ -171,14 +151,41 @@ | ||
| 171 | 151 | return $cpts; |
| 172 | 152 | } ); |
| 173 | 153 | |
| 174 | 154 | add_action( 'admin_init', function () { |
| 175 | - $action = sanitize_text_field( filter_input( INPUT_GET, 'action' ) ); | |
| 155 | + $action = filter_input( INPUT_GET, 'action' ); | |
| 156 | + $menu_args = $this->get_contact_menu_args(); | |
| 176 | 157 | |
| 177 | - if ( $action ) { | |
| 178 | - $menu_args = $this->get_contact_menu_args(); | |
| 179 | - $action_handler = new Action_Handler( $action, $menu_args ); | |
| 180 | - $action_handler->process_action(); | |
| 158 | + switch ( $action ) { | |
| 159 | + case 'remove_from_entire_site': | |
| 160 | + $post = filter_input( INPUT_GET, 'post', FILTER_VALIDATE_INT ); | |
| 161 | + check_admin_referer( 'remove_from_entire_site_' . $post ); | |
| 162 | + delete_post_meta( $post, '_elementor_conditions' ); | |
| 163 | + wp_redirect( $menu_args['menu_slug'] ); | |
| 164 | + exit; | |
| 165 | + case 'set_as_entire_site': | |
| 166 | + $post = filter_input( INPUT_GET, 'post', FILTER_VALIDATE_INT ); | |
| 167 | + check_admin_referer( 'set_as_entire_site_' . $post ); | |
| 168 | + | |
| 169 | + $posts = get_posts( [ | |
| 170 | + 'post_type' => static::CPT_FLOATING_BUTTONS, | |
| 171 | + 'posts_per_page' => -1, | |
| 172 | + 'post_status' => 'publish', | |
| 173 | + 'fields' => 'ids', | |
| 174 | + 'meta_key' => '_elementor_conditions', | |
| 175 | + 'meta_compare' => 'EXISTS', | |
| 176 | + ] ); | |
| 177 | + | |
| 178 | + foreach ( $posts as $post_id ) { | |
| 179 | + delete_post_meta( $post_id, '_elementor_conditions' ); | |
| 180 | + } | |
| 181 | + | |
| 182 | + update_post_meta( $post, '_elementor_conditions', [ 'include/general' ] ); | |
| 183 | + | |
| 184 | + wp_redirect( $menu_args['menu_slug'] ); | |
| 185 | + exit; | |
| 186 | + default: | |
| 187 | + break; | |
| 181 | 188 | } |
| 182 | 189 | } ); |
| 183 | 190 | |
| 184 | 191 | add_action( 'manage_' . static::CPT_FLOATING_BUTTONS . '_posts_columns', function( $posts_columns ) { |
| @@ -206,15 +213,8 @@ | ||
| 206 | 213 | $this->override_admin_bar_add_contact( $admin_bar ); |
| 207 | 214 | }, 100 ); |
| 208 | 215 | } |
| 209 | 216 | |
| 210 | - public function is_preview_for_document( $post_id ) { | |
| 211 | - $preview_id = ElementorUtils::get_super_global_value( $_GET, 'preview_id' ); | |
| 212 | - $preview = ElementorUtils::get_super_global_value( $_GET, 'preview' ); | |
| 213 | - | |
| 214 | - return 'true' === $preview && (int) $post_id === (int) $preview_id; | |
| 215 | - } | |
| 216 | - | |
| 217 | 217 | public function handle_click_tracking() { |
| 218 | 218 | $data = filter_input_array( INPUT_POST, [ |
| 219 | 219 | 'clicks' => [ |
| 220 | 220 | 'filter' => FILTER_VALIDATE_INT, |
| @@ -237,20 +237,12 @@ | ||
| 237 | 237 | if ( ! isset( $posts_to_update[ $post_id ] ) ) { |
| 238 | 238 | $starting_clicks = (int) get_post_meta( $post_id, static::META_CLICK_TRACKING, true ); |
| 239 | 239 | $posts_to_update[ $post_id ] = $starting_clicks ? $starting_clicks : 0; |
| 240 | 240 | } |
| 241 | - ++$posts_to_update[ $post_id ]; | |
| 241 | + $posts_to_update[ $post_id ] ++; | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | foreach ( $posts_to_update as $post_id => $clicks ) { |
| 245 | - if ( self::CPT_FLOATING_BUTTONS !== get_post_type( $post_id ) ) { | |
| 246 | - continue; | |
| 247 | - } | |
| 248 | - | |
| 249 | - if ( 'publish' !== get_post_status( $post_id ) ) { | |
| 250 | - continue; | |
| 251 | - } | |
| 252 | - | |
| 253 | 245 | update_post_meta( $post_id, static::META_CLICK_TRACKING, $clicks ); |
| 254 | 246 | } |
| 255 | 247 | |
| 256 | 248 | wp_send_json_success(); |
| @@ -281,12 +273,16 @@ | ||
| 281 | 273 | break; |
| 282 | 274 | } |
| 283 | 275 | } |
| 284 | 276 | |
| 285 | - public function flush_permalinks_on_elementor_version_change() { | |
| 286 | - if ( get_option( static::ROUTER_OPTION_KEY ) !== ELEMENTOR_VERSION ) { | |
| 277 | + public function flush_permalinks_on_save() { | |
| 278 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { | |
| 279 | + return; | |
| 280 | + } | |
| 281 | + | |
| 282 | + if ( get_option( static::ROUTER_OPTION_KEY ) !== static::ROUTER_VERSION ) { | |
| 287 | 283 | flush_rewrite_rules(); |
| 288 | - update_option( static::ROUTER_OPTION_KEY, ELEMENTOR_VERSION ); | |
| 284 | + update_option( static::ROUTER_OPTION_KEY, static::ROUTER_VERSION ); | |
| 289 | 285 | } |
| 290 | 286 | } |
| 291 | 287 | |
| 292 | 288 | private function get_trashed_contact_posts(): array { |
| @@ -338,11 +334,11 @@ | ||
| 338 | 334 | <div class="e-landing-pages-empty"> |
| 339 | 335 | <?php |
| 340 | 336 | /** @var Source_Local $source_local */ |
| 341 | 337 | $source_local->print_blank_state_template( |
| 342 | - esc_html__( 'Floating Element', 'elementor' ), | |
| 338 | + esc_html__( 'Floating Button', 'elementor' ), | |
| 343 | 339 | $this->get_add_new_contact_page_url(), |
| 344 | - nl2br( esc_html__( 'Add a Floating element so your users can easily get in touch!', 'elementor' ) ) | |
| 340 | + nl2br( esc_html__( 'Add a Floating button so your users can easily get in touch!', 'elementor' ) ) | |
| 345 | 341 | ); |
| 346 | 342 | |
| 347 | 343 | if ( ! empty( $trashed_posts ) ) : ?> |
| 348 | 344 | <div class="e-trashed-items"> |
| @@ -347,10 +343,10 @@ | ||
| 347 | 343 | if ( ! empty( $trashed_posts ) ) : ?> |
| 348 | 344 | <div class="e-trashed-items"> |
| 349 | 345 | <?php |
| 350 | 346 | printf( |
| 351 | - /* translators: %1$s Link open tag, %2$s: Link close tag. */ | |
| 352 | - esc_html__( 'Or view %1$sTrashed Items%2$s', 'elementor' ), | |
| 347 | + /* translators: %1$s Link open tag, %2$s: Link close tag. */ | |
| 348 | + esc_html__( 'Or view %1$sTrashed Items%1$s', 'elementor' ), | |
| 353 | 349 | '<a href="' . esc_url( admin_url( 'edit.php?post_status=trash&post_type=' . self::CPT_FLOATING_BUTTONS ) ) . '">', |
| 354 | 350 | '</a>' |
| 355 | 351 | ); |
| 356 | 352 | ?> |
| @@ -386,26 +382,33 @@ | ||
| 386 | 382 | static::CPT_FLOATING_BUTTONS |
| 387 | 383 | ); |
| 388 | 384 | } |
| 389 | 385 | |
| 386 | + private function is_editing_existing_floating_buttons_page() { | |
| 387 | + $action = ElementorUtils::get_super_global_value( $_GET, 'action' ); | |
| 388 | + $post_id = ElementorUtils::get_super_global_value( $_GET, 'post' ); | |
| 389 | + | |
| 390 | + return 'elementor' === $action && $this->is_floating_buttons_type_meta_key( $post_id ); | |
| 391 | + } | |
| 392 | + | |
| 393 | + private function is_creating_floating_buttons_page() { | |
| 394 | + $action = ElementorUtils::get_super_global_value( $_POST, 'action' ); //phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 395 | + $post_id = ElementorUtils::get_super_global_value( $_POST, 'editor_post_id' ); //phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 396 | + | |
| 397 | + return 'elementor_ajax' === $action && $this->is_floating_buttons_type_meta_key( $post_id ); | |
| 398 | + } | |
| 399 | + | |
| 400 | + private function is_floating_buttons_type_meta_key( $post_id ) { | |
| 401 | + return static::FLOATING_BUTTONS_DOCUMENT_TYPE === get_post_meta( $post_id, Document::TYPE_META_KEY, true ); | |
| 402 | + } | |
| 403 | + | |
| 390 | 404 | private function register_post_type( array $labels, string $cpt ) { |
| 391 | 405 | $args = [ |
| 392 | 406 | 'labels' => $labels, |
| 393 | 407 | 'public' => true, |
| 394 | 408 | 'show_in_menu' => 'edit.php?post_type=elementor_library&tabs_group=library', |
| 395 | - 'show_in_nav_menus' => false, | |
| 396 | - 'capabilities' => [ | |
| 397 | - 'edit_post' => 'manage_options', | |
| 398 | - 'read_post' => 'manage_options', | |
| 399 | - 'delete_post' => 'manage_options', | |
| 400 | - 'edit_posts' => 'manage_options', | |
| 401 | - 'edit_others_posts' => 'manage_options', | |
| 402 | - 'publish_posts' => 'manage_options', | |
| 403 | - 'read_private_posts' => 'manage_options', | |
| 404 | - 'create_posts' => 'manage_options', | |
| 405 | - ], | |
| 409 | + 'capability_type' => 'page', | |
| 406 | 410 | 'taxonomies' => [ Source_Local::TAXONOMY_TYPE_SLUG ], |
| 407 | - 'show_in_rest' => true, | |
| 408 | 411 | 'supports' => [ |
| 409 | 412 | 'title', |
| 410 | 413 | 'editor', |
| 411 | 414 | 'comments', |
| @@ -447,8 +450,9 @@ | ||
| 447 | 450 | 'meta_value' => $document_type, |
| 448 | 451 | ] ); |
| 449 | 452 | |
| 450 | 453 | return $posts_query->post_count > 0; |
| 454 | + | |
| 451 | 455 | } |
| 452 | 456 | |
| 453 | 457 | private function get_contact_menu_args(): array { |
| 454 | 458 | if ( $this->has_contact_pages() ) { |
| @@ -507,63 +511,16 @@ | ||
| 507 | 511 | } |
| 508 | 512 | |
| 509 | 513 | foreach ( $query->posts as $post_id ) { |
| 510 | 514 | $conditions = get_post_meta( $post_id, '_elementor_conditions', true ); |
| 511 | - | |
| 512 | 515 | if ( ! $conditions ) { |
| 513 | 516 | continue; |
| 514 | 517 | } |
| 515 | - | |
| 516 | - if ( | |
| 517 | - in_array( 'include/general', $conditions ) && | |
| 518 | - ! $this->is_preview_for_document( $post_id ) && | |
| 519 | - get_the_ID() !== $post_id | |
| 520 | - ) { | |
| 518 | + if ( in_array( 'include/general', $conditions ) ) { | |
| 521 | 519 | $document = Plugin::$instance->documents->get( $post_id ); |
| 522 | 520 | $document->print_content(); |
| 521 | + break; | |
| 523 | 522 | } |
| 524 | 523 | } |
| 525 | 524 | } |
| 526 | 525 | |
| 527 | - /** | |
| 528 | - * Register styles. | |
| 529 | - * | |
| 530 | - * At build time, Elementor compiles `/modules/floating-buttons/assets/scss/widgets/*.scss` | |
| 531 | - * to `/assets/css/widget-*.min.css`. | |
| 532 | - * | |
| 533 | - * @return void | |
| 534 | - */ | |
| 535 | - public function register_styles() { | |
| 536 | - $direction_suffix = is_rtl() ? '-rtl' : ''; | |
| 537 | - $widget_styles = $this->get_widgets_style_list(); | |
| 538 | - $has_custom_breakpoints = Plugin::$instance->breakpoints->has_custom_breakpoints(); | |
| 539 | - | |
| 540 | - foreach ( $widget_styles as $widget_style_name => $widget_has_responsive_style ) { | |
| 541 | - $should_load_responsive_css = $widget_has_responsive_style ? $has_custom_breakpoints : false; | |
| 542 | - | |
| 543 | - wp_register_style( | |
| 544 | - $widget_style_name, | |
| 545 | - $this->get_frontend_file_url( "{$widget_style_name}{$direction_suffix}.min.css", $should_load_responsive_css ), | |
| 546 | - [ 'elementor-frontend', 'elementor-icons' ], | |
| 547 | - $should_load_responsive_css ? null : ELEMENTOR_VERSION | |
| 548 | - ); | |
| 549 | - } | |
| 550 | - } | |
| 551 | - | |
| 552 | - private function get_widgets_style_list(): array { | |
| 553 | - return [ | |
| 554 | - 'widget-floating-buttons' => self::WIDGET_HAS_CUSTOM_BREAKPOINTS, // TODO: Remove in v3.27.0 [ED-15717] | |
| 555 | - 'widget-floating-bars-base' => self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 556 | - 'widget-floating-bars-var-2' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 557 | - 'widget-floating-bars-var-3' => self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 558 | - 'widget-contact-buttons-base' => self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 559 | - 'widget-contact-buttons-var-1' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 560 | - 'widget-contact-buttons-var-3' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 561 | - 'widget-contact-buttons-var-4' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 562 | - 'widget-contact-buttons-var-6' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 563 | - 'widget-contact-buttons-var-7' => self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 564 | - 'widget-contact-buttons-var-8' => ! self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 565 | - 'widget-contact-buttons-var-9' => self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 566 | - 'widget-contact-buttons-var-10' => self::WIDGET_HAS_CUSTOM_BREAKPOINTS, | |
| 567 | - ]; | |
| 568 | - } | |
| 569 | 526 | } |