| @@ -70,31 +70,9 @@ | ||
| 70 | 70 | public function get_keywords() { |
| 71 | 71 | return [ 'menu', 'anchor', 'link' ]; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - protected function is_dynamic_content(): bool { | |
| 75 | - return false; | |
| 76 | - } | |
| 77 | - | |
| 78 | 74 | /** |
| 79 | - * Get style dependencies. | |
| 80 | - * | |
| 81 | - * Retrieve the list of style dependencies the widget requires. | |
| 82 | - * | |
| 83 | - * @since 3.24.0 | |
| 84 | - * @access public | |
| 85 | - * | |
| 86 | - * @return array Widget style dependencies. | |
| 87 | - */ | |
| 88 | - public function get_style_depends(): array { | |
| 89 | - return [ 'widget-menu-anchor' ]; | |
| 90 | - } | |
| 91 | - | |
| 92 | - public function has_widget_inner_wrapper(): bool { | |
| 93 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 94 | - } | |
| 95 | - | |
| 96 | - /** | |
| 97 | 75 | * Register menu anchor widget controls. |
| 98 | 76 | * |
| 99 | 77 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 100 | 78 | * |
| @@ -104,9 +82,9 @@ | ||
| 104 | 82 | protected function register_controls() { |
| 105 | 83 | $this->start_controls_section( |
| 106 | 84 | 'section_anchor', |
| 107 | 85 | [ |
| 108 | - 'label' => esc_html__( 'Menu Anchor', 'elementor' ), | |
| 86 | + 'label' => esc_html__( 'Anchor', 'elementor' ), | |
| 109 | 87 | ] |
| 110 | 88 | ); |
| 111 | 89 | |
| 112 | 90 | $this->add_control( |
| @@ -128,15 +106,15 @@ | ||
| 128 | 106 | |
| 129 | 107 | $this->add_control( |
| 130 | 108 | 'anchor_note', |
| 131 | 109 | [ |
| 132 | - 'type' => Controls_Manager::ALERT, | |
| 133 | - 'alert_type' => 'warning', | |
| 134 | - 'content' => sprintf( | |
| 110 | + 'type' => Controls_Manager::RAW_HTML, | |
| 111 | + 'raw' => sprintf( | |
| 135 | 112 | /* translators: %s: Accepted chars. */ |
| 136 | 113 | esc_html__( 'Note: The ID link ONLY accepts these chars: %s', 'elementor' ), |
| 137 | 114 | '`A-Z, a-z, 0-9, _ , -`' |
| 138 | 115 | ), |
| 116 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', | |
| 139 | 117 | ] |
| 140 | 118 | ); |
| 141 | 119 | |
| 142 | 120 | $this->end_controls_section(); |
| @@ -152,19 +130,13 @@ | ||
| 152 | 130 | */ |
| 153 | 131 | protected function render() { |
| 154 | 132 | $anchor = $this->get_settings_for_display( 'anchor' ); |
| 155 | 133 | |
| 156 | - if ( empty( $anchor ) ) { | |
| 157 | - return; | |
| 134 | + if ( ! empty( $anchor ) ) { | |
| 135 | + $this->add_render_attribute( 'inner', 'id', sanitize_html_class( $anchor ) ); | |
| 158 | 136 | } |
| 159 | 137 | |
| 160 | - $this->add_render_attribute( | |
| 161 | - 'inner', | |
| 162 | - [ | |
| 163 | - 'class' => 'elementor-menu-anchor', | |
| 164 | - 'id' => sanitize_html_class( $anchor ), | |
| 165 | - ] | |
| 166 | - ); | |
| 138 | + $this->add_render_attribute( 'inner', 'class', 'elementor-menu-anchor' ); | |
| 167 | 139 | ?> |
| 168 | 140 | <div <?php $this->print_render_attribute_string( 'inner' ); ?>></div> |
| 169 | 141 | <?php |
| 170 | 142 | } |
| @@ -178,27 +150,10 @@ | ||
| 178 | 150 | * @access protected |
| 179 | 151 | */ |
| 180 | 152 | protected function content_template() { |
| 181 | 153 | ?> |
| 182 | - <# | |
| 183 | - if ( '' === settings.anchor ) { | |
| 184 | - return; | |
| 185 | - } | |
| 186 | - | |
| 187 | - view.addRenderAttribute( | |
| 188 | - 'inner', | |
| 189 | - { | |
| 190 | - 'class': 'elementor-menu-anchor', | |
| 191 | - 'id': settings.anchor, | |
| 192 | - } | |
| 193 | - ); | |
| 194 | - #> | |
| 195 | - <div {{{ view.getRenderAttributeString( 'inner' ) }}}></div> | |
| 154 | + <div class="elementor-menu-anchor"{{{ settings.anchor ? ' id="' + settings.anchor + '"' : '' }}}></div> | |
| 196 | 155 | <?php |
| 197 | - } | |
| 198 | - | |
| 199 | - public function render_markdown(): string { | |
| 200 | - return ''; | |
| 201 | 156 | } |
| 202 | 157 | |
| 203 | 158 | protected function on_save( array $settings ) { |
| 204 | 159 | $settings['anchor'] = sanitize_html_class( $settings['anchor'] ); |