← All changes
|
modules/atomic-widgets/elements/base/atomic-element-base.php
+3
-12
4.1.4
→
4.0.0-dev3
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 ) { |
| @@ -162,13 +162,9 @@ | ||
| 162 | 162 | protected function get_html_tag(): string { |
| 163 | 163 | $settings = $this->get_atomic_settings(); |
| 164 | 164 | $default_html_tag = $this->define_default_html_tag(); |
| 165 | 165 | |
| 166 | - if ( ! empty( $settings['link']['tag'] ) ) { | |
| 167 | - return $settings['link']['tag']; | |
| 168 | - } | |
| 169 | - | |
| 170 | - return $settings['tag'] ?? $default_html_tag; | |
| 166 | + return ! empty( $settings['link']['href'] ) ? $settings['link']['tag'] : ( $settings['tag'] ?? $default_html_tag ); | |
| 171 | 167 | } |
| 172 | 168 | |
| 173 | 169 | /** |
| 174 | 170 | * Print safe HTML tag for the element based on the element settings. |
| @@ -187,13 +183,8 @@ | ||
| 187 | 183 | */ |
| 188 | 184 | protected function print_custom_attributes() { |
| 189 | 185 | $settings = $this->get_atomic_settings(); |
| 190 | 186 | $attributes = $settings['attributes'] ?? ''; |
| 191 | - | |
| 192 | - if ( isset( $settings['link']['attributes'] ) ) { | |
| 193 | - $attributes .= ' ' . ( $settings['link']['attributes'] ?? '' ); | |
| 194 | - } | |
| 195 | - | |
| 196 | 187 | if ( ! empty( $attributes ) && is_string( $attributes ) ) { |
| 197 | 188 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 198 | 189 | echo ' ' . $attributes; |
| 199 | 190 | } |