PluginProbe
Elementor Website Builder – more than just a page builder / 3.4.3
Elementor Website Builder – more than just a page builder v3.4.3
4.3.0-beta3 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 All 452 releases
← All changes | includes/widgets/menu-anchor.php +8 -69 4.1.33.4.3 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,17 +91,11 @@
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 - 'dynamic' => [
124 - 'active' => true,
125 - ],
126 98 ]
127 99 );
128 100
129 101 $this->add_control(
@@ -128,15 +100,11 @@
128 100
129 101 $this->add_control(
130 102 'anchor_note',
131 103 [
132 - 'type' => Controls_Manager::ALERT,
133 - 'alert_type' => 'warning',
134 - 'content' => sprintf(
135 - /* translators: %s: Accepted chars. */
136 - esc_html__( 'Note: The ID link ONLY accepts these chars: %s', 'elementor' ),
137 - '`A-Z, a-z, 0-9, _ , -`'
138 - ),
104 + 'type' => Controls_Manager::RAW_HTML,
105 + 'raw' => sprintf( esc_html__( 'Note: The ID link ONLY accepts these chars: %s', 'elementor' ), '`A-Z, a-z, 0-9, _ , -`' ),
106 + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
139 107 ]
140 108 );
141 109
142 110 $this->end_controls_section();
@@ -152,19 +120,13 @@
152 120 */
153 121 protected function render() {
154 122 $anchor = $this->get_settings_for_display( 'anchor' );
155 123
156 - if ( empty( $anchor ) ) {
157 - return;
124 + if ( ! empty( $anchor ) ) {
125 + $this->add_render_attribute( 'inner', 'id', sanitize_html_class( $anchor ) );
158 126 }
159 127
160 - $this->add_render_attribute(
161 - 'inner',
162 - [
163 - 'class' => 'elementor-menu-anchor',
164 - 'id' => sanitize_html_class( $anchor ),
165 - ]
166 - );
128 + $this->add_render_attribute( 'inner', 'class', 'elementor-menu-anchor' );
167 129 ?>
168 130 <div <?php $this->print_render_attribute_string( 'inner' ); ?>></div>
169 131 <?php
170 132 }
@@ -178,31 +140,8 @@
178 140 * @access protected
179 141 */
180 142 protected function content_template() {
181 143 ?>
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>
144 + <div class="elementor-menu-anchor"{{{ settings.anchor ? ' id="' + settings.anchor + '"' : '' }}}></div>
196 145 <?php
197 - }
198 -
199 - public function render_markdown(): string {
200 - return '';
201 - }
202 -
203 - protected function on_save( array $settings ) {
204 - $settings['anchor'] = sanitize_html_class( $settings['anchor'] );
205 -
206 - return $settings;
207 146 }
208 147 }