← All changes
|
modules/atomic-widgets/elements/base/atomic-element-base.php
+3
-13
4.2.0-dev2
→
4.0.1
View file →
| @@ -2,8 +2,9 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\AtomicWidgets\Elements\Base; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Element_Base; |
| 6 | +use Elementor\Modules\AtomicWidgets\Elements\Loader\Frontend_Assets_Loader; | |
| 6 | 7 | use Elementor\Modules\AtomicWidgets\PropDependencies\Manager as Dependency_Manager; |
| 7 | 8 | use Elementor\Modules\AtomicWidgets\PropTypes\Contracts\Prop_Type; |
| 8 | 9 | use Elementor\Modules\AtomicWidgets\PropTypes\Concerns\Has_Meta; |
| 9 | 10 | use Elementor\Plugin; |
| @@ -32,13 +33,12 @@ | ||
| 32 | 33 | $this->version = $data['version'] ?? '0.0'; |
| 33 | 34 | $this->styles = $data['styles'] ?? []; |
| 34 | 35 | $this->interactions = $this->parse_atomic_interactions( $data['interactions'] ?? [] ); |
| 35 | 36 | $this->editor_settings = $data['editor_settings'] ?? []; |
| 36 | - | |
| 37 | + $this->add_script_depends( Frontend_Assets_Loader::ATOMIC_WIDGETS_HANDLER ); | |
| 37 | 38 | if ( static::$widget_description ) { |
| 38 | 39 | $this->description( static::$widget_description ); |
| 39 | 40 | } |
| 40 | - | |
| 41 | 41 | $this->origin_id = $data['origin_id'] ?? null; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | private function parse_atomic_interactions( $interactions ) { |
| @@ -84,9 +84,8 @@ | ||
| 84 | 84 | $config['atomic_style_states'] = $this->define_atomic_style_states(); |
| 85 | 85 | $config['atomic_pseudo_states'] = $this->define_atomic_pseudo_states(); |
| 86 | 86 | $config['dependencies_per_target_mapping'] = Dependency_Manager::get_source_to_dependents( $props_schema ); |
| 87 | 87 | $config['base_styles'] = $this->get_base_styles(); |
| 88 | - $config['base_settings'] = $this->get_base_settings(); | |
| 89 | 88 | $config['version'] = $this->version; |
| 90 | 89 | $config['show_in_panel'] = $this->should_show_in_panel(); |
| 91 | 90 | $config['categories'] = $this->define_panel_categories(); |
| 92 | 91 | $config['hide_on_search'] = false; |
| @@ -163,13 +162,9 @@ | ||
| 163 | 162 | protected function get_html_tag(): string { |
| 164 | 163 | $settings = $this->get_atomic_settings(); |
| 165 | 164 | $default_html_tag = $this->define_default_html_tag(); |
| 166 | 165 | |
| 167 | - if ( ! empty( $settings['link']['tag'] ) ) { | |
| 168 | - return $settings['link']['tag']; | |
| 169 | - } | |
| 170 | - | |
| 171 | - return $settings['tag'] ?? $default_html_tag; | |
| 166 | + return ! empty( $settings['link']['href'] ) ? $settings['link']['tag'] : ( $settings['tag'] ?? $default_html_tag ); | |
| 172 | 167 | } |
| 173 | 168 | |
| 174 | 169 | /** |
| 175 | 170 | * Print safe HTML tag for the element based on the element settings. |
| @@ -188,13 +183,8 @@ | ||
| 188 | 183 | */ |
| 189 | 184 | protected function print_custom_attributes() { |
| 190 | 185 | $settings = $this->get_atomic_settings(); |
| 191 | 186 | $attributes = $settings['attributes'] ?? ''; |
| 192 | - | |
| 193 | - if ( isset( $settings['link']['attributes'] ) ) { | |
| 194 | - $attributes .= ' ' . ( $settings['link']['attributes'] ?? '' ); | |
| 195 | - } | |
| 196 | - | |
| 197 | 187 | if ( ! empty( $attributes ) && is_string( $attributes ) ) { |
| 198 | 188 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 199 | 189 | echo ' ' . $attributes; |
| 200 | 190 | } |