| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Core\Kits\Documents\Tabs; |
| 4 |
|
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Group_Control_Border; |
| 7 |
use Elementor\Group_Control_Box_Shadow; |
| 8 |
use Elementor\Group_Control_Css_Filter; |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit; // Exit if accessed directly |
| 12 |
} |
| 13 |
|
| 14 |
class Theme_Style_Images extends Tab_Base { |
| 15 |
|
| 16 |
public function get_id() { |
| 17 |
return 'theme-style-images'; |
| 18 |
} |
| 19 |
|
| 20 |
public function get_title() { |
| 21 |
return __( 'Images', 'elementor' ); |
| 22 |
} |
| 23 |
|
| 24 |
protected function register_tab_controls() { |
| 25 |
$image_selectors = [ |
| 26 |
'{{WRAPPER}} img', |
| 27 |
]; |
| 28 |
|
| 29 |
$image_hover_selectors = [ |
| 30 |
'{{WRAPPER}} img:hover', |
| 31 |
]; |
| 32 |
|
| 33 |
$image_selectors = implode( ',', $image_selectors ); |
| 34 |
$image_hover_selectors = implode( ',', $image_hover_selectors ); |
| 35 |
|
| 36 |
$this->start_controls_section( |
| 37 |
'section_images', |
| 38 |
[ |
| 39 |
'label' => __( 'Images', 'elementor' ), |
| 40 |
'tab' => $this->get_id(), |
| 41 |
] |
| 42 |
); |
| 43 |
|
| 44 |
$this->add_default_globals_notice(); |
| 45 |
|
| 46 |
$this->start_controls_tabs( 'tabs_image_style' ); |
| 47 |
|
| 48 |
$this->start_controls_tab( |
| 49 |
'tab_image_normal', |
| 50 |
[ |
| 51 |
'label' => __( 'Normal', 'elementor' ), |
| 52 |
] |
| 53 |
); |
| 54 |
|
| 55 |
$this->add_group_control( |
| 56 |
Group_Control_Border::get_type(), |
| 57 |
[ |
| 58 |
'name' => 'image_border', |
| 59 |
'selector' => $image_selectors, |
| 60 |
'fields_options' => [ |
| 61 |
'color' => [ |
| 62 |
'dynamic' => [], |
| 63 |
], |
| 64 |
], |
| 65 |
] |
| 66 |
); |
| 67 |
|
| 68 |
$this->add_responsive_control( |
| 69 |
'image_border_radius', |
| 70 |
[ |
| 71 |
'label' => __( 'Border Radius', 'elementor' ), |
| 72 |
'type' => Controls_Manager::DIMENSIONS, |
| 73 |
'size_units' => [ 'px', '%' ], |
| 74 |
'selectors' => [ |
| 75 |
$image_selectors => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 76 |
], |
| 77 |
] |
| 78 |
); |
| 79 |
|
| 80 |
$this->add_control( |
| 81 |
'image_opacity', |
| 82 |
[ |
| 83 |
'label' => __( 'Opacity', 'elementor' ), |
| 84 |
'type' => Controls_Manager::SLIDER, |
| 85 |
'range' => [ |
| 86 |
'px' => [ |
| 87 |
'max' => 1, |
| 88 |
'min' => 0.10, |
| 89 |
'step' => 0.01, |
| 90 |
], |
| 91 |
], |
| 92 |
'selectors' => [ |
| 93 |
$image_selectors => 'opacity: {{SIZE}};', |
| 94 |
], |
| 95 |
] |
| 96 |
); |
| 97 |
|
| 98 |
$this->add_group_control( |
| 99 |
Group_Control_Box_Shadow::get_type(), |
| 100 |
[ |
| 101 |
'name' => 'image_box_shadow', |
| 102 |
'exclude' => [ |
| 103 |
'box_shadow_position', |
| 104 |
], |
| 105 |
'selector' => $image_selectors, |
| 106 |
] |
| 107 |
); |
| 108 |
|
| 109 |
$this->add_group_control( |
| 110 |
Group_Control_Css_Filter::get_type(), |
| 111 |
[ |
| 112 |
'name' => 'image_css_filters', |
| 113 |
'selector' => '{{WRAPPER}} img', |
| 114 |
] |
| 115 |
); |
| 116 |
|
| 117 |
$this->end_controls_tab(); |
| 118 |
|
| 119 |
$this->start_controls_tab( |
| 120 |
'tab_image_hover', |
| 121 |
[ |
| 122 |
'label' => __( 'Hover', 'elementor' ), |
| 123 |
] |
| 124 |
); |
| 125 |
|
| 126 |
$this->add_group_control( |
| 127 |
Group_Control_Border::get_type(), |
| 128 |
[ |
| 129 |
'name' => 'image_hover_border', |
| 130 |
'selector' => '{{WRAPPER}} img:hover', |
| 131 |
'fields_options' => [ |
| 132 |
'color' => [ |
| 133 |
'dynamic' => [], |
| 134 |
], |
| 135 |
], |
| 136 |
] |
| 137 |
); |
| 138 |
|
| 139 |
$this->add_responsive_control( |
| 140 |
'image_hover_border_radius', |
| 141 |
[ |
| 142 |
'label' => __( 'Border Radius', 'elementor' ), |
| 143 |
'type' => Controls_Manager::DIMENSIONS, |
| 144 |
'size_units' => [ 'px', '%' ], |
| 145 |
'selectors' => [ |
| 146 |
$image_hover_selectors => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 147 |
], |
| 148 |
] |
| 149 |
); |
| 150 |
|
| 151 |
$this->add_control( |
| 152 |
'image_hover_opacity', |
| 153 |
[ |
| 154 |
'label' => __( 'Opacity', 'elementor' ), |
| 155 |
'type' => Controls_Manager::SLIDER, |
| 156 |
'range' => [ |
| 157 |
'px' => [ |
| 158 |
'max' => 1, |
| 159 |
'min' => 0.10, |
| 160 |
'step' => 0.01, |
| 161 |
], |
| 162 |
], |
| 163 |
'selectors' => [ |
| 164 |
$image_hover_selectors => 'opacity: {{SIZE}};', |
| 165 |
], |
| 166 |
] |
| 167 |
); |
| 168 |
|
| 169 |
$this->add_group_control( |
| 170 |
Group_Control_Box_Shadow::get_type(), |
| 171 |
[ |
| 172 |
'name' => 'image_hover_box_shadow', |
| 173 |
'exclude' => [ |
| 174 |
'box_shadow_position', |
| 175 |
], |
| 176 |
'selector' => $image_hover_selectors, |
| 177 |
] |
| 178 |
); |
| 179 |
|
| 180 |
$this->add_group_control( |
| 181 |
Group_Control_Css_Filter::get_type(), |
| 182 |
[ |
| 183 |
'name' => 'image_hover_css_filters', |
| 184 |
'selector' => $image_hover_selectors, |
| 185 |
] |
| 186 |
); |
| 187 |
|
| 188 |
$this->add_control( |
| 189 |
'image_hover_transition', |
| 190 |
[ |
| 191 |
'label' => __( 'Transition Duration', 'elementor' ) . ' (s)', |
| 192 |
'type' => Controls_Manager::SLIDER, |
| 193 |
'range' => [ |
| 194 |
'px' => [ |
| 195 |
'max' => 3, |
| 196 |
'step' => 0.1, |
| 197 |
], |
| 198 |
], |
| 199 |
'selectors' => [ |
| 200 |
$image_selectors => 'transition-duration: {{SIZE}}s', |
| 201 |
], |
| 202 |
] |
| 203 |
); |
| 204 |
|
| 205 |
$this->end_controls_tab(); |
| 206 |
|
| 207 |
$this->end_controls_tabs(); |
| 208 |
|
| 209 |
$this->end_controls_section(); |
| 210 |
} |
| 211 |
} |
| 212 |
|