PluginProbe
Elementor Website Builder – more than just a page builder / 3.31.4
Elementor Website Builder – more than just a page builder v3.31.4
4.3.1 4.3.0 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 All 454 releases
← All changes | modules/atomic-widgets/elements/atomic-image/atomic-image.php +16 -47 4.3.0-beta3 → 3.31.4 View file →
@@ -1,22 +1,19 @@
1 1 <?php
2 2 namespace Elementor\Modules\AtomicWidgets\Elements\Atomic_Image;
3 3
4 4 use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control;
5 -use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template;
5 +use Elementor\Modules\AtomicWidgets\Elements\Has_Template;
6 6 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
7 7 use Elementor\Modules\AtomicWidgets\PropTypes\Image_Prop_Type;
8 8 use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type;
9 9 use Elementor\Modules\AtomicWidgets\Controls\Section;
10 -use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base;
11 -use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer;
12 -use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
10 +use Elementor\Modules\AtomicWidgets\Elements\Atomic_Widget_Base;
11 +use Elementor\Modules\AtomicWidgets\PropTypes\Key_Value_Array_Prop_Type;
13 12 use Elementor\Modules\AtomicWidgets\Controls\Types\Image_Control;
14 -use Elementor\Modules\AtomicWidgets\Utils\Image\Placeholder_Image;
13 +use Elementor\Modules\AtomicWidgets\Image\Placeholder_Image;
15 14 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
16 15 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
17 -use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
18 -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
19 16
20 17 if ( ! defined( 'ABSPATH' ) ) {
21 18 exit; // Exit if accessed directly.
22 19 }
@@ -23,10 +20,8 @@
23 20
24 21 class Atomic_Image extends Atomic_Widget_Base {
25 22 use Has_Template;
26 23
27 - public static $widget_description = 'Display an image with customizable styles and link options.';
28 -
29 24 const LINK_BASE_STYLE_KEY = 'link-base';
30 25 const BASE_STYLE_KEY = 'base';
31 26
32 27 public static function get_element_type(): string {
@@ -37,9 +32,9 @@
37 32 return esc_html__( 'Image', 'elementor' );
38 33 }
39 34
40 35 public function get_keywords() {
41 - return [ 'ato', 'atom', 'atoms', 'atomic', 'image', 'photo', 'picture' ];
36 + return [ 'ato', 'atom', 'atoms', 'atomic' ];
42 37 }
43 38
44 39 public function get_icon() {
45 40 return 'eicon-e-image';
@@ -44,18 +39,8 @@
44 39 public function get_icon() {
45 40 return 'eicon-e-image';
46 41 }
47 42
48 - public static function html_tag_follows_link(): bool {
49 - return false;
50 - }
51 -
52 - public static function get_computed_html_tag( array $settings ): string {
53 - return Html_Tag_Computer::compute( $settings, 'img', [
54 - Html_Tag_Computer::FOLLOW_LINK_OPTION => static::html_tag_follows_link(),
55 - ] );
56 - }
57 -
58 43 protected static function define_props_schema(): array {
59 44 $props = [
60 45 'classes' => Classes_Prop_Type::make()
61 46 ->default( [] ),
@@ -65,9 +50,9 @@
65 50 ->default_size( 'full' ),
66 51
67 52 'link' => Link_Prop_Type::make(),
68 53
69 - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
54 + 'attributes' => Key_Value_Array_Prop_Type::make(),
70 55 ];
71 56
72 57 return $props;
73 58 }
@@ -75,28 +60,27 @@
75 60 protected function define_atomic_controls(): array {
76 61 return [
77 62 Section::make()
78 63 ->set_label( esc_html__( 'Content', 'elementor' ) )
79 - ->set_id( 'content' )
80 64 ->set_items( [
81 65 Image_Control::bind_to( 'image' )
82 - ->set_label( __( 'Image', 'elementor' ) ),
66 + ->set_label( __( 'Image', 'elementor' ) )
67 + ->set_show_mode( 'media' ),
83 68 ] ),
84 - Section::make()
85 - ->set_label( __( 'Settings', 'elementor' ) )
86 - ->set_id( 'settings' )
87 - ->set_items( $this->get_settings_controls() ),
88 69 ];
89 70 }
90 71
91 72 protected function get_settings_controls(): array {
92 73 return [
74 + Image_Control::bind_to( 'image' )
75 + ->set_label( __( 'Image resolution', 'elementor' ) )
76 + ->set_show_mode( 'sizes' )
77 + ->set_meta( [ 'layout' => 'two-columns' ] ),
93 78 Link_Control::bind_to( 'link' )
94 - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) )
95 - ->set_label( __( 'Link', 'elementor' ) ),
96 - Text_Control::bind_to( '_cssid' )
97 - ->set_label( __( 'ID', 'elementor' ) )
98 - ->set_meta( $this->get_css_id_control_meta() ),
79 + ->set_label( __( 'Link', 'elementor' ) )
80 + ->set_meta( [
81 + 'topDivider' => true,
82 + ] ),
99 83 ];
100 84 }
101 85
102 86 protected function define_base_styles(): array {
@@ -103,12 +87,10 @@
103 87 return [
104 88 self::LINK_BASE_STYLE_KEY => Style_Definition::make()
105 89 ->add_variant(
106 90 Style_Variant::make()
107 - ->add_prop( 'all', 'unset' )
108 91 ->add_prop( 'display', 'inherit' )
109 92 ->add_prop( 'width', 'fit-content' )
110 - ->add_prop( 'cursor', 'pointer' )
111 93 ),
112 94 self::BASE_STYLE_KEY => Style_Definition::make()
113 95 ->add_variant(
114 96 Style_Variant::make()
@@ -120,19 +102,6 @@
120 102 protected function get_templates(): array {
121 103 return [
122 104 'elementor/elements/atomic-image' => __DIR__ . '/atomic-image.html.twig',
123 105 ];
124 - }
125 -
126 - public function render_markdown(): string {
127 - $settings = $this->get_atomic_settings();
128 - $src = $settings['image']['src'] ?? '';
129 -
130 - if ( empty( $src ) ) {
131 - return '';
132 - }
133 -
134 - $alt = $settings['image']['alt'] ?? '';
135 -
136 - return '![' . $alt . '](' . esc_url( $src ) . ')';
137 106 }
138 107 }