PluginProbe
Elementor Website Builder – more than just a page builder / 3.10.0-dev1
Elementor Website Builder – more than just a page builder v3.10.0-dev1
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/widgets/menu-anchor.php +8 -56 4.2.33.10.0-dev1 View file →
@@ -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(
@@ -113,11 +91,8 @@
113 91 'anchor',
114 92 [
115 93 'label' => esc_html__( 'The ID of Menu Anchor.', 'elementor' ),
116 94 'type' => Controls_Manager::TEXT,
117 - 'ai' => [
118 - 'active' => false,
119 - ],
120 95 'placeholder' => esc_html__( 'For Example: About', 'elementor' ),
121 96 'description' => esc_html__( 'This ID will be the CSS ID you will have to use in your own page, Without #.', 'elementor' ),
122 97 'label_block' => true,
123 98 'dynamic' => [
@@ -128,15 +103,15 @@
128 103
129 104 $this->add_control(
130 105 'anchor_note',
131 106 [
132 - 'type' => Controls_Manager::ALERT,
133 - 'alert_type' => 'warning',
134 - 'content' => sprintf(
107 + 'type' => Controls_Manager::RAW_HTML,
108 + 'raw' => sprintf(
135 109 /* translators: %s: Accepted chars. */
136 110 esc_html__( 'Note: The ID link ONLY accepts these chars: %s', 'elementor' ),
137 111 '`A-Z, a-z, 0-9, _ , -`'
138 112 ),
113 + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
139 114 ]
140 115 );
141 116
142 117 $this->end_controls_section();
@@ -152,19 +127,13 @@
152 127 */
153 128 protected function render() {
154 129 $anchor = $this->get_settings_for_display( 'anchor' );
155 130
156 - if ( empty( $anchor ) ) {
157 - return;
131 + if ( ! empty( $anchor ) ) {
132 + $this->add_render_attribute( 'inner', 'id', sanitize_html_class( $anchor ) );
158 133 }
159 134
160 - $this->add_render_attribute(
161 - 'inner',
162 - [
163 - 'class' => 'elementor-menu-anchor',
164 - 'id' => sanitize_html_class( $anchor ),
165 - ]
166 - );
135 + $this->add_render_attribute( 'inner', 'class', 'elementor-menu-anchor' );
167 136 ?>
168 137 <div <?php $this->print_render_attribute_string( 'inner' ); ?>></div>
169 138 <?php
170 139 }
@@ -178,27 +147,10 @@
178 147 * @access protected
179 148 */
180 149 protected function content_template() {
181 150 ?>
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>
151 + <div class="elementor-menu-anchor"{{{ settings.anchor ? ' id="' + settings.anchor + '"' : '' }}}></div>
196 152 <?php
197 - }
198 -
199 - public function render_markdown(): string {
200 - return '';
201 153 }
202 154
203 155 protected function on_save( array $settings ) {
204 156 $settings['anchor'] = sanitize_html_class( $settings['anchor'] );