balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

theme-style-images.php (4558B)


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