← All changes
|
modules/atomic-widgets/elements/atomic-image/atomic-image.php
+13
-22
4.1.0-dev2
→
3.32.0-dev3
View file →
| @@ -1,21 +1,20 @@ | ||
| 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; | |
| 10 | +use Elementor\Modules\AtomicWidgets\Elements\Atomic_Widget_Base; | |
| 11 | 11 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 12 | 12 | use Elementor\Modules\AtomicWidgets\Controls\Types\Image_Control; |
| 13 | -use Elementor\Modules\AtomicWidgets\Utils\Image\Placeholder_Image; | |
| 13 | +use Elementor\Modules\AtomicWidgets\Image\Placeholder_Image; | |
| 14 | 14 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| 15 | 15 | use Elementor\Modules\AtomicWidgets\Styles\Style_Variant; |
| 16 | 16 | use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control; |
| 17 | -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type; | |
| 18 | 17 | |
| 19 | 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | 19 | exit; // Exit if accessed directly. |
| 21 | 20 | } |
| @@ -22,10 +21,8 @@ | ||
| 22 | 21 | |
| 23 | 22 | class Atomic_Image extends Atomic_Widget_Base { |
| 24 | 23 | use Has_Template; |
| 25 | 24 | |
| 26 | - public static $widget_description = 'Display an image with customizable styles and link options.'; | |
| 27 | - | |
| 28 | 25 | const LINK_BASE_STYLE_KEY = 'link-base'; |
| 29 | 26 | const BASE_STYLE_KEY = 'base'; |
| 30 | 27 | |
| 31 | 28 | public static function get_element_type(): string { |
| @@ -54,9 +51,9 @@ | ||
| 54 | 51 | ->default_size( 'full' ), |
| 55 | 52 | |
| 56 | 53 | 'link' => Link_Prop_Type::make(), |
| 57 | 54 | |
| 58 | - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), | |
| 55 | + 'attributes' => Attributes_Prop_Type::make(), | |
| 59 | 56 | ]; |
| 60 | 57 | |
| 61 | 58 | return $props; |
| 62 | 59 | } |
| @@ -66,8 +63,9 @@ | ||
| 66 | 63 | Section::make() |
| 67 | 64 | ->set_label( esc_html__( 'Content', 'elementor' ) ) |
| 68 | 65 | ->set_items( [ |
| 69 | 66 | Image_Control::bind_to( 'image' ) |
| 67 | + ->set_show_mode( 'media' ) | |
| 70 | 68 | ->set_label( __( 'Image', 'elementor' ) ), |
| 71 | 69 | ] ), |
| 72 | 70 | Section::make() |
| 73 | 71 | ->set_label( __( 'Settings', 'elementor' ) ) |
| @@ -77,11 +75,17 @@ | ||
| 77 | 75 | } |
| 78 | 76 | |
| 79 | 77 | protected function get_settings_controls(): array { |
| 80 | 78 | return [ |
| 79 | + Image_Control::bind_to( 'image' ) | |
| 80 | + ->set_show_mode( 'sizes' ) | |
| 81 | + ->set_label( __( 'Image resolution', 'elementor' ) ) | |
| 82 | + ->set_meta( [ 'layout' => 'two-columns' ] ), | |
| 81 | 83 | Link_Control::bind_to( 'link' ) |
| 82 | - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) ) | |
| 83 | - ->set_label( __( 'Link', 'elementor' ) ), | |
| 84 | + ->set_label( __( 'Link', 'elementor' ) ) | |
| 85 | + ->set_meta( [ | |
| 86 | + 'topDivider' => true, | |
| 87 | + ] ), | |
| 84 | 88 | Text_Control::bind_to( '_cssid' ) |
| 85 | 89 | ->set_label( __( 'ID', 'elementor' ) ) |
| 86 | 90 | ->set_meta( $this->get_css_id_control_meta() ), |
| 87 | 91 | ]; |
| @@ -106,19 +110,6 @@ | ||
| 106 | 110 | protected function get_templates(): array { |
| 107 | 111 | return [ |
| 108 | 112 | 'elementor/elements/atomic-image' => __DIR__ . '/atomic-image.html.twig', |
| 109 | 113 | ]; |
| 110 | - } | |
| 111 | - | |
| 112 | - public function render_markdown(): string { | |
| 113 | - $settings = $this->get_atomic_settings(); | |
| 114 | - $src = $settings['image']['src'] ?? ''; | |
| 115 | - | |
| 116 | - if ( empty( $src ) ) { | |
| 117 | - return ''; | |
| 118 | - } | |
| 119 | - | |
| 120 | - $alt = $settings['image']['alt'] ?? ''; | |
| 121 | - | |
| 122 | - return ' . ')'; | |
| 123 | 114 | } |
| 124 | 115 | } |