css-filter.php000066600000006720152142407030007337 0ustar00 _x( 'Blur', 'Filter Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'required' => 'true', 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, 'step' => 0.1, ], ], 'default' => [ 'size' => 0, ], 'selectors' => [ '{{SELECTOR}}' => 'filter: brightness( {{brightness.SIZE}}% ) contrast( {{contrast.SIZE}}% ) saturate( {{saturate.SIZE}}% ) blur( {{blur.SIZE}}px ) hue-rotate( {{hue.SIZE}}deg )', ], ]; $controls['brightness'] = [ 'label' => _x( 'Brightness', 'Filter Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'render_type' => 'ui', 'required' => 'true', 'default' => [ 'size' => 100, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'separator' => 'none', ]; $controls['contrast'] = [ 'label' => _x( 'Contrast', 'Filter Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'render_type' => 'ui', 'required' => 'true', 'default' => [ 'size' => 100, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'separator' => 'none', ]; $controls['saturate'] = [ 'label' => _x( 'Saturation', 'Filter Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'render_type' => 'ui', 'required' => 'true', 'default' => [ 'size' => 100, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'separator' => 'none', ]; $controls['hue'] = [ 'label' => _x( 'Hue', 'Filter Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'render_type' => 'ui', 'required' => 'true', 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 360, ], ], 'separator' => 'none', ]; return $controls; } /** * Get default options. * * Retrieve the default options of the CSS filter control. Used to return the * default options while initializing the CSS filter control. * * @since 2.1.0 * @access protected * * @return array Default CSS filter control options. */ protected function get_default_options() { return [ 'popover' => [ 'starter_name' => 'css_filter', 'starter_title' => _x( 'CSS Filters', 'Filter Control', 'elementor' ), 'settings' => [ 'render_type' => 'ui', ], ], ]; } } box-shadow.php000066600000004471152142407030007340 0ustar00 _x( 'Box Shadow', 'Box Shadow Control', 'elementor' ), 'type' => Controls_Manager::BOX_SHADOW, 'selectors' => [ '{{SELECTOR}}' => 'box-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{SPREAD}}px {{COLOR}} {{box_shadow_position.VALUE}};', ], ]; $controls['box_shadow_position'] = [ 'label' => _x( 'Position', 'Box Shadow Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ ' ' => _x( 'Outline', 'Box Shadow Control', 'elementor' ), 'inset' => _x( 'Inset', 'Box Shadow Control', 'elementor' ), ], 'default' => ' ', 'render_type' => 'ui', ]; return $controls; } /** * Get default options. * * Retrieve the default options of the box shadow control. Used to return the * default options while initializing the box shadow control. * * @since 1.9.0 * @access protected * * @return array Default box shadow control options. */ protected function get_default_options() { return [ 'popover' => [ 'starter_title' => _x( 'Box Shadow', 'Box Shadow Control', 'elementor' ), 'starter_name' => 'box_shadow_type', 'starter_value' => 'yes', 'settings' => [ 'render_type' => 'ui', ], ], ]; } } background.php000066600000054423152142407030007406 0ustar00 [ 'title' => _x( 'Classic', 'Background Control', 'elementor' ), 'icon' => 'eicon-paint-brush', ], 'gradient' => [ 'title' => _x( 'Gradient', 'Background Control', 'elementor' ), 'icon' => 'eicon-barcode', ], 'video' => [ 'title' => _x( 'Video', 'Background Control', 'elementor' ), 'icon' => 'eicon-video-camera', ], 'slideshow' => [ 'title' => _x( 'Slideshow', 'Background Control', 'elementor' ), 'icon' => 'eicon-slideshow', ], ]; } /** * Init fields. * * Initialize background control fields. * * @since 1.2.2 * @access public * * @return array Control fields. */ public function init_fields() { $fields = []; $fields['background'] = [ 'label' => _x( 'Background Type', 'Background Control', 'elementor' ), 'type' => Controls_Manager::CHOOSE, 'render_type' => 'ui', ]; $fields['color'] = [ 'label' => _x( 'Color', 'Background Control', 'elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'title' => _x( 'Background Color', 'Background Control', 'elementor' ), 'selectors' => [ '{{SELECTOR}}' => 'background-color: {{VALUE}};', ], 'condition' => [ 'background' => [ 'classic', 'gradient' ], ], ]; $fields['color_stop'] = [ 'label' => _x( 'Location', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ '%' ], 'default' => [ 'unit' => '%', 'size' => 0, ], 'render_type' => 'ui', 'condition' => [ 'background' => [ 'gradient' ], ], 'of_type' => 'gradient', ]; $fields['color_b'] = [ 'label' => _x( 'Second Color', 'Background Control', 'elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '#f2295b', 'render_type' => 'ui', 'condition' => [ 'background' => [ 'gradient' ], ], 'of_type' => 'gradient', ]; $fields['color_b_stop'] = [ 'label' => _x( 'Location', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ '%' ], 'default' => [ 'unit' => '%', 'size' => 100, ], 'render_type' => 'ui', 'condition' => [ 'background' => [ 'gradient' ], ], 'of_type' => 'gradient', ]; $fields['gradient_type'] = [ 'label' => _x( 'Type', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'linear' => _x( 'Linear', 'Background Control', 'elementor' ), 'radial' => _x( 'Radial', 'Background Control', 'elementor' ), ], 'default' => 'linear', 'render_type' => 'ui', 'condition' => [ 'background' => [ 'gradient' ], ], 'of_type' => 'gradient', ]; $fields['gradient_angle'] = [ 'label' => _x( 'Angle', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'deg' ], 'default' => [ 'unit' => 'deg', 'size' => 180, ], 'range' => [ 'deg' => [ 'step' => 10, ], ], 'selectors' => [ '{{SELECTOR}}' => 'background-color: transparent; background-image: linear-gradient({{SIZE}}{{UNIT}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})', ], 'condition' => [ 'background' => [ 'gradient' ], 'gradient_type' => 'linear', ], 'of_type' => 'gradient', ]; $fields['gradient_position'] = [ 'label' => _x( 'Position', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'center center' => _x( 'Center Center', 'Background Control', 'elementor' ), 'center left' => _x( 'Center Left', 'Background Control', 'elementor' ), 'center right' => _x( 'Center Right', 'Background Control', 'elementor' ), 'top center' => _x( 'Top Center', 'Background Control', 'elementor' ), 'top left' => _x( 'Top Left', 'Background Control', 'elementor' ), 'top right' => _x( 'Top Right', 'Background Control', 'elementor' ), 'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ), 'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ), 'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ), ], 'default' => 'center center', 'selectors' => [ '{{SELECTOR}}' => 'background-color: transparent; background-image: radial-gradient(at {{VALUE}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})', ], 'condition' => [ 'background' => [ 'gradient' ], 'gradient_type' => 'radial', ], 'of_type' => 'gradient', ]; $fields['image'] = [ 'label' => _x( 'Image', 'Background Control', 'elementor' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, ], 'responsive' => true, 'title' => _x( 'Background Image', 'Background Control', 'elementor' ), 'selectors' => [ '{{SELECTOR}}' => 'background-image: url("{{URL}}");', ], 'render_type' => 'template', 'condition' => [ 'background' => [ 'classic' ], ], ]; $fields['position'] = [ 'label' => _x( 'Position', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'responsive' => true, 'options' => [ '' => _x( 'Default', 'Background Control', 'elementor' ), 'center center' => _x( 'Center Center', 'Background Control', 'elementor' ), 'center left' => _x( 'Center Left', 'Background Control', 'elementor' ), 'center right' => _x( 'Center Right', 'Background Control', 'elementor' ), 'top center' => _x( 'Top Center', 'Background Control', 'elementor' ), 'top left' => _x( 'Top Left', 'Background Control', 'elementor' ), 'top right' => _x( 'Top Right', 'Background Control', 'elementor' ), 'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ), 'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ), 'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ), 'initial' => _x( 'Custom', 'Background Control', 'elementor' ), ], 'selectors' => [ '{{SELECTOR}}' => 'background-position: {{VALUE}};', ], 'condition' => [ 'background' => [ 'classic' ], 'image[url]!' => '', ], ]; $fields['xpos'] = [ 'label' => _x( 'X Position', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'responsive' => true, 'size_units' => [ 'px', 'em', '%', 'vw' ], 'default' => [ 'unit' => 'px', 'size' => 0, ], 'tablet_default' => [ 'unit' => 'px', 'size' => 0, ], 'mobile_default' => [ 'unit' => 'px', 'size' => 0, ], 'range' => [ 'px' => [ 'min' => -800, 'max' => 800, ], 'em' => [ 'min' => -100, 'max' => 100, ], '%' => [ 'min' => -100, 'max' => 100, ], 'vw' => [ 'min' => -100, 'max' => 100, ], ], 'selectors' => [ '{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos.SIZE}}{{ypos.UNIT}}', ], 'condition' => [ 'background' => [ 'classic' ], 'position' => [ 'initial' ], 'image[url]!' => '', ], 'required' => true, 'device_args' => [ Controls_Stack::RESPONSIVE_TABLET => [ 'selectors' => [ '{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos_tablet.SIZE}}{{ypos_tablet.UNIT}}', ], 'condition' => [ 'background' => [ 'classic' ], 'position_tablet' => [ 'initial' ], ], ], Controls_Stack::RESPONSIVE_MOBILE => [ 'selectors' => [ '{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos_mobile.SIZE}}{{ypos_mobile.UNIT}}', ], 'condition' => [ 'background' => [ 'classic' ], 'position_mobile' => [ 'initial' ], ], ], ], ]; $fields['ypos'] = [ 'label' => _x( 'Y Position', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'responsive' => true, 'size_units' => [ 'px', 'em', '%', 'vh' ], 'default' => [ 'unit' => 'px', 'size' => 0, ], 'tablet_default' => [ 'unit' => 'px', 'size' => 0, ], 'mobile_default' => [ 'unit' => 'px', 'size' => 0, ], 'range' => [ 'px' => [ 'min' => -800, 'max' => 800, ], 'em' => [ 'min' => -100, 'max' => 100, ], '%' => [ 'min' => -100, 'max' => 100, ], 'vh' => [ 'min' => -100, 'max' => 100, ], ], 'selectors' => [ '{{SELECTOR}}' => 'background-position: {{xpos.SIZE}}{{xpos.UNIT}} {{SIZE}}{{UNIT}}', ], 'condition' => [ 'background' => [ 'classic' ], 'position' => [ 'initial' ], 'image[url]!' => '', ], 'required' => true, 'device_args' => [ Controls_Stack::RESPONSIVE_TABLET => [ 'selectors' => [ '{{SELECTOR}}' => 'background-position: {{xpos_tablet.SIZE}}{{xpos_tablet.UNIT}} {{SIZE}}{{UNIT}}', ], 'condition' => [ 'background' => [ 'classic' ], 'position_tablet' => [ 'initial' ], ], ], Controls_Stack::RESPONSIVE_MOBILE => [ 'selectors' => [ '{{SELECTOR}}' => 'background-position: {{xpos_mobile.SIZE}}{{xpos_mobile.UNIT}} {{SIZE}}{{UNIT}}', ], 'condition' => [ 'background' => [ 'classic' ], 'position_mobile' => [ 'initial' ], ], ], ], ]; $fields['attachment'] = [ 'label' => _x( 'Attachment', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => _x( 'Default', 'Background Control', 'elementor' ), 'scroll' => _x( 'Scroll', 'Background Control', 'elementor' ), 'fixed' => _x( 'Fixed', 'Background Control', 'elementor' ), ], 'selectors' => [ '(desktop+){{SELECTOR}}' => 'background-attachment: {{VALUE}};', ], 'condition' => [ 'background' => [ 'classic' ], 'image[url]!' => '', ], ]; $fields['attachment_alert'] = [ 'type' => Controls_Manager::RAW_HTML, 'content_classes' => 'elementor-control-field-description', 'raw' => __( 'Note: Attachment Fixed works only on desktop.', 'elementor' ), 'separator' => 'none', 'condition' => [ 'background' => [ 'classic' ], 'image[url]!' => '', 'attachment' => 'fixed', ], ]; $fields['repeat'] = [ 'label' => _x( 'Repeat', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'responsive' => true, 'options' => [ '' => _x( 'Default', 'Background Control', 'elementor' ), 'no-repeat' => _x( 'No-repeat', 'Background Control', 'elementor' ), 'repeat' => _x( 'Repeat', 'Background Control', 'elementor' ), 'repeat-x' => _x( 'Repeat-x', 'Background Control', 'elementor' ), 'repeat-y' => _x( 'Repeat-y', 'Background Control', 'elementor' ), ], 'selectors' => [ '{{SELECTOR}}' => 'background-repeat: {{VALUE}};', ], 'condition' => [ 'background' => [ 'classic' ], 'image[url]!' => '', ], ]; $fields['size'] = [ 'label' => _x( 'Size', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'responsive' => true, 'default' => '', 'options' => [ '' => _x( 'Default', 'Background Control', 'elementor' ), 'auto' => _x( 'Auto', 'Background Control', 'elementor' ), 'cover' => _x( 'Cover', 'Background Control', 'elementor' ), 'contain' => _x( 'Contain', 'Background Control', 'elementor' ), 'initial' => _x( 'Custom', 'Background Control', 'elementor' ), ], 'selectors' => [ '{{SELECTOR}}' => 'background-size: {{VALUE}};', ], 'condition' => [ 'background' => [ 'classic' ], 'image[url]!' => '', ], ]; $fields['bg_width'] = [ 'label' => _x( 'Width', 'Background Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'responsive' => true, 'size_units' => [ 'px', 'em', '%', 'vw' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, ], '%' => [ 'min' => 0, 'max' => 100, ], 'vw' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'size' => 100, 'unit' => '%', ], 'required' => true, 'selectors' => [ '{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto', ], 'condition' => [ 'background' => [ 'classic' ], 'size' => [ 'initial' ], 'image[url]!' => '', ], 'device_args' => [ Controls_Stack::RESPONSIVE_TABLET => [ 'selectors' => [ '{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto', ], 'condition' => [ 'background' => [ 'classic' ], 'size_tablet' => [ 'initial' ], ], ], Controls_Stack::RESPONSIVE_MOBILE => [ 'selectors' => [ '{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto', ], 'condition' => [ 'background' => [ 'classic' ], 'size_mobile' => [ 'initial' ], ], ], ], ]; $fields['video_link'] = [ 'label' => _x( 'Video Link', 'Background Control', 'elementor' ), 'type' => Controls_Manager::TEXT, 'placeholder' => 'https://www.youtube.com/watch?v=XHOmBV4js_E', 'description' => __( 'YouTube/Vimeo link, or link to video file (mp4 is recommended).', 'elementor' ), 'label_block' => true, 'default' => '', 'condition' => [ 'background' => [ 'video' ], ], 'of_type' => 'video', 'frontend_available' => true, ]; $fields['video_start'] = [ 'label' => __( 'Start Time', 'elementor' ), 'type' => Controls_Manager::NUMBER, 'description' => __( 'Specify a start time (in seconds)', 'elementor' ), 'placeholder' => 10, 'condition' => [ 'background' => [ 'video' ], ], 'of_type' => 'video', 'frontend_available' => true, ]; $fields['video_end'] = [ 'label' => __( 'End Time', 'elementor' ), 'type' => Controls_Manager::NUMBER, 'description' => __( 'Specify an end time (in seconds)', 'elementor' ), 'placeholder' => 70, 'condition' => [ 'background' => [ 'video' ], ], 'of_type' => 'video', 'frontend_available' => true, ]; $fields['play_once'] = [ 'label' => __( 'Play Once', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'condition' => [ 'background' => [ 'video' ], ], 'of_type' => 'video', 'frontend_available' => true, ]; $fields['play_on_mobile'] = [ 'label' => __( 'Play On Mobile', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'condition' => [ 'background' => [ 'video' ], ], 'of_type' => 'video', 'frontend_available' => true, ]; $fields['video_fallback'] = [ 'label' => _x( 'Background Fallback', 'Background Control', 'elementor' ), 'description' => __( 'This cover image will replace the background video in case that the video could not be loaded.', 'elementor' ), 'type' => Controls_Manager::MEDIA, 'condition' => [ 'background' => [ 'video' ], ], 'selectors' => [ '{{SELECTOR}}' => 'background: url("{{URL}}") 50% 50%; background-size: cover;', ], 'of_type' => 'video', ]; $fields['slideshow_gallery'] = [ 'label' => _x( 'Images', 'Background Control', 'elementor' ), 'type' => Controls_Manager::GALLERY, 'condition' => [ 'background' => [ 'slideshow' ], ], 'show_label' => false, 'of_type' => 'slideshow', 'frontend_available' => true, ]; $fields['slideshow_loop'] = [ 'label' => __( 'Infinite Loop', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'background' => [ 'slideshow' ], ], 'of_type' => 'slideshow', 'frontend_available' => true, ]; $fields['slideshow_slide_duration'] = [ 'label' => __( 'Duration', 'elementor' ) . ' (ms)', 'type' => Controls_Manager::NUMBER, 'default' => 5000, 'condition' => [ 'background' => [ 'slideshow' ], ], 'frontend_available' => true, ]; $fields['slideshow_slide_transition'] = [ 'label' => __( 'Transition', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'fade', 'options' => [ 'fade' => 'Fade', 'slide_right' => 'Slide Right', 'slide_left' => 'Slide Left', 'slide_up' => 'Slide Up', 'slide_down' => 'Slide Down', ], 'condition' => [ 'background' => [ 'slideshow' ], ], 'of_type' => 'slideshow', 'frontend_available' => true, ]; $fields['slideshow_transition_duration'] = [ 'label' => __( 'Transition Duration', 'elementor' ) . ' (ms)', 'type' => Controls_Manager::NUMBER, 'default' => 500, 'condition' => [ 'background' => [ 'slideshow' ], ], 'frontend_available' => true, ]; $fields['slideshow_background_size'] = [ 'label' => __( 'Background Size', 'elementor' ), 'type' => Controls_Manager::SELECT, 'responsive' => true, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor' ), 'auto' => __( 'Auto', 'elementor' ), 'cover' => __( 'Cover', 'elementor' ), 'contain' => __( 'Contain', 'elementor' ), ], 'selectors' => [ '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-size: {{VALUE}};', ], 'condition' => [ 'background' => [ 'slideshow' ], ], ]; $fields['slideshow_background_position'] = [ 'label' => __( 'Background Position', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'responsive' => true, 'options' => [ '' => __( 'Default', 'elementor' ), 'center center' => _x( 'Center Center', 'Background Control', 'elementor' ), 'center left' => _x( 'Center Left', 'Background Control', 'elementor' ), 'center right' => _x( 'Center Right', 'Background Control', 'elementor' ), 'top center' => _x( 'Top Center', 'Background Control', 'elementor' ), 'top left' => _x( 'Top Left', 'Background Control', 'elementor' ), 'top right' => _x( 'Top Right', 'Background Control', 'elementor' ), 'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ), 'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ), 'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ), ], 'selectors' => [ '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-position: {{VALUE}};', ], 'condition' => [ 'background' => [ 'slideshow' ], ], ]; $fields['slideshow_ken_burns'] = [ 'label' => __( 'Ken Burns Effect', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'separator' => 'before', 'condition' => [ 'background' => [ 'slideshow' ], ], 'of_type' => 'slideshow', 'frontend_available' => true, ]; $fields['slideshow_ken_burns_zoom_direction'] = [ 'label' => __( 'Direction', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'in', 'options' => [ 'in' => __( 'In', 'elementor' ), 'out' => __( 'Out', 'elementor' ), ], 'condition' => [ 'background' => [ 'slideshow' ], 'slideshow_ken_burns!' => '', ], 'of_type' => 'slideshow', 'frontend_available' => true, ]; return $fields; } /** * Get child default args. * * Retrieve the default arguments for all the child controls for a specific group * control. * * @since 1.2.2 * @access protected * * @return array Default arguments for all the child controls. */ protected function get_child_default_args() { return [ 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}}:not(.elementor-motion-effects-element-type-background), {{WRAPPER}} > .elementor-motion-effects-container > .elementor-motion-effects-layer', ]; } /** * Filter fields. * * Filter which controls to display, using `include`, `exclude`, `condition` * and `of_type` arguments. * * @since 1.2.2 * @access protected * * @return array Control fields. */ protected function filter_fields() { $fields = parent::filter_fields(); $args = $this->get_args(); foreach ( $fields as &$field ) { if ( isset( $field['of_type'] ) && ! in_array( $field['of_type'], $args['types'] ) ) { unset( $field ); } } return $fields; } /** * Prepare fields. * * Process background control fields before adding them to `add_control()`. * * @since 1.2.2 * @access protected * * @param array $fields Background control fields. * * @return array Processed fields. */ protected function prepare_fields( $fields ) { $args = $this->get_args(); $background_types = self::get_background_types(); $choose_types = []; foreach ( $args['types'] as $type ) { if ( isset( $background_types[ $type ] ) ) { $choose_types[ $type ] = $background_types[ $type ]; } } $fields['background']['options'] = $choose_types; return parent::prepare_fields( $fields ); } /** * Get default options. * * Retrieve the default options of the background control. Used to return the * default options while initializing the background control. * * @since 1.9.0 * @access protected * * @return array Default background control options. */ protected function get_default_options() { return [ 'popover' => false, ]; } } border.php000066600000004776152142407030006552 0ustar00 _x( 'Border Type', 'Border Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'None', 'elementor' ), 'solid' => _x( 'Solid', 'Border Control', 'elementor' ), 'double' => _x( 'Double', 'Border Control', 'elementor' ), 'dotted' => _x( 'Dotted', 'Border Control', 'elementor' ), 'dashed' => _x( 'Dashed', 'Border Control', 'elementor' ), 'groove' => _x( 'Groove', 'Border Control', 'elementor' ), ], 'selectors' => [ '{{SELECTOR}}' => 'border-style: {{VALUE}};', ], ]; $fields['width'] = [ 'label' => _x( 'Width', 'Border Control', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{SELECTOR}}' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'border!' => '', ], 'responsive' => true, ]; $fields['color'] = [ 'label' => _x( 'Color', 'Border Control', 'elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{SELECTOR}}' => 'border-color: {{VALUE}};', ], 'condition' => [ 'border!' => '', ], ]; return $fields; } /** * Get default options. * * Retrieve the default options of the border control. Used to return the * default options while initializing the border control. * * @since 1.9.0 * @access protected * * @return array Default border control options. */ protected function get_default_options() { return [ 'popover' => false, ]; } } typography.php000066600000016330152142407030007470 0ustar00get_model()->get_settings( 'elementor_default_generic_fonts' ); if ( $default_fonts ) { $default_fonts = ', ' . $default_fonts; } $fields['font_family'] = [ 'label' => _x( 'Family', 'Typography Control', 'elementor' ), 'type' => Controls_Manager::FONT, 'default' => '', 'selector_value' => 'font-family: "{{VALUE}}"' . $default_fonts . ';', ]; $fields['font_size'] = [ 'label' => _x( 'Size', 'Typography Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 200, ], 'vw' => [ 'min' => 0.1, 'max' => 10, 'step' => 0.1, ], ], 'responsive' => true, 'selector_value' => 'font-size: {{SIZE}}{{UNIT}}', ]; $typo_weight_options = [ '' => __( 'Default', 'elementor' ), ]; foreach ( array_merge( [ 'normal', 'bold' ], range( 100, 900, 100 ) ) as $weight ) { $typo_weight_options[ $weight ] = ucfirst( $weight ); } $fields['font_weight'] = [ 'label' => _x( 'Weight', 'Typography Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => $typo_weight_options, ]; $fields['text_transform'] = [ 'label' => _x( 'Transform', 'Typography Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor' ), 'uppercase' => _x( 'Uppercase', 'Typography Control', 'elementor' ), 'lowercase' => _x( 'Lowercase', 'Typography Control', 'elementor' ), 'capitalize' => _x( 'Capitalize', 'Typography Control', 'elementor' ), 'none' => _x( 'Normal', 'Typography Control', 'elementor' ), ], ]; $fields['font_style'] = [ 'label' => _x( 'Style', 'Typography Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor' ), 'normal' => _x( 'Normal', 'Typography Control', 'elementor' ), 'italic' => _x( 'Italic', 'Typography Control', 'elementor' ), 'oblique' => _x( 'Oblique', 'Typography Control', 'elementor' ), ], ]; $fields['text_decoration'] = [ 'label' => _x( 'Decoration', 'Typography Control', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor' ), 'underline' => _x( 'Underline', 'Typography Control', 'elementor' ), 'overline' => _x( 'Overline', 'Typography Control', 'elementor' ), 'line-through' => _x( 'Line Through', 'Typography Control', 'elementor' ), 'none' => _x( 'None', 'Typography Control', 'elementor' ), ], ]; $fields['line_height'] = [ 'label' => _x( 'Line-Height', 'Typography Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'desktop_default' => [ 'unit' => 'em', ], 'tablet_default' => [ 'unit' => 'em', ], 'mobile_default' => [ 'unit' => 'em', ], 'range' => [ 'px' => [ 'min' => 1, ], ], 'responsive' => true, 'size_units' => [ 'px', 'em' ], 'selector_value' => 'line-height: {{SIZE}}{{UNIT}}', ]; $fields['letter_spacing'] = [ 'label' => _x( 'Letter Spacing', 'Typography Control', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => -5, 'max' => 10, 'step' => 0.1, ], ], 'responsive' => true, 'selector_value' => 'letter-spacing: {{SIZE}}{{UNIT}}', ]; return $fields; } /** * Prepare fields. * * Process typography control fields before adding them to `add_control()`. * * @since 1.2.3 * @access protected * * @param array $fields Typography control fields. * * @return array Processed fields. */ protected function prepare_fields( $fields ) { array_walk( $fields, function( &$field, $field_name ) { if ( in_array( $field_name, [ 'typography', 'popover_toggle' ] ) ) { return; } $selector_value = ! empty( $field['selector_value'] ) ? $field['selector_value'] : str_replace( '_', '-', $field_name ) . ': {{VALUE}};'; $field['selectors'] = [ '{{SELECTOR}}' => $selector_value, ]; } ); return parent::prepare_fields( $fields ); } /** * Add group arguments to field. * * Register field arguments to typography control. * * @since 1.2.2 * @access protected * * @param string $control_id Typography control id. * @param array $field_args Typography control field arguments. * * @return array Field arguments. */ protected function add_group_args_to_field( $control_id, $field_args ) { $field_args = parent::add_group_args_to_field( $control_id, $field_args ); $args = $this->get_args(); if ( in_array( $control_id, self::get_scheme_fields_keys() ) && ! empty( $args['scheme'] ) ) { $field_args['scheme'] = [ 'type' => self::get_type(), 'value' => $args['scheme'], 'key' => $control_id, ]; } return $field_args; } /** * Get default options. * * Retrieve the default options of the typography control. Used to return the * default options while initializing the typography control. * * @since 1.9.0 * @access protected * * @return array Default typography control options. */ protected function get_default_options() { return [ 'popover' => [ 'starter_name' => 'typography', 'starter_title' => _x( 'Typography', 'Typography Control', 'elementor' ), 'settings' => [ 'render_type' => 'ui', ], ], ]; } } base.php000066600000032143152142407030006174 0ustar00options ) { $this->init_options(); } if ( $option ) { if ( isset( $this->options[ $option ] ) ) { return $this->options[ $option ]; } return null; } return $this->options; } /** * Add new controls to stack. * * Register multiple controls to allow the user to set/update data. * * @since 1.0.0 * @access public * * @param Controls_Stack $element The element stack. * @param array $user_args The control arguments defined by the user. * @param array $options Optional. The element options. Default is * an empty array. */ final public function add_controls( Controls_Stack $element, array $user_args, array $options = [] ) { $this->init_args( $user_args ); // Filter which controls to display $filtered_fields = $this->filter_fields(); $filtered_fields = $this->prepare_fields( $filtered_fields ); // For php < 7 reset( $filtered_fields ); if ( isset( $this->args['separator'] ) ) { $filtered_fields[ key( $filtered_fields ) ]['separator'] = $this->args['separator']; } $has_injection = false; if ( ! empty( $options['position'] ) ) { $has_injection = true; $element->start_injection( $options['position'] ); unset( $options['position'] ); } if ( $this->get_options( 'popover' ) ) { $this->start_popover( $element ); } foreach ( $filtered_fields as $field_id => $field_args ) { // Add the global group args to the control $field_args = $this->add_group_args_to_field( $field_id, $field_args ); // Register the control $id = $this->get_controls_prefix() . $field_id; if ( ! empty( $field_args['responsive'] ) ) { unset( $field_args['responsive'] ); $element->add_responsive_control( $id, $field_args, $options ); } else { $element->add_control( $id, $field_args, $options ); } } if ( $this->get_options( 'popover' ) ) { $element->end_popover(); } if ( $has_injection ) { $element->end_injection(); } } /** * Get arguments. * * Retrieve group control arguments. * * @since 1.0.0 * @access public * * @return array Group control arguments. */ final public function get_args() { return $this->args; } /** * Get fields. * * Retrieve group control fields. * * @since 1.2.2 * @access public * * @return array Control fields. */ final public function get_fields() { if ( null === static::$fields ) { static::$fields = $this->init_fields(); } return static::$fields; } /** * Get controls prefix. * * Retrieve the prefix of the group control, which is `{{ControlName}}_`. * * @since 1.0.0 * @access public * * @return string Control prefix. */ public function get_controls_prefix() { return $this->args['name'] . '_'; } /** * Get group control classes. * * Retrieve the classes of the group control. * * @since 1.0.0 * @access public * * @return string Group control classes. */ public function get_base_group_classes() { return 'elementor-group-control-' . static::get_type() . ' elementor-group-control'; } /** * Init fields. * * Initialize group control fields. * * @abstract * @since 1.2.2 * @access protected */ abstract protected function init_fields(); /** * Get default options. * * Retrieve the default options of the group control. Used to return the * default options while initializing the group control. * * @since 1.9.0 * @access protected * * @return array Default group control options. */ protected function get_default_options() { return []; } /** * Get child default arguments. * * Retrieve the default arguments for all the child controls for a specific group * control. * * @since 1.2.2 * @access protected * * @return array Default arguments for all the child controls. */ protected function get_child_default_args() { return []; } /** * Filter fields. * * Filter which controls to display, using `include`, `exclude` and the * `condition` arguments. * * @since 1.2.2 * @access protected * * @return array Control fields. */ protected function filter_fields() { $args = $this->get_args(); $fields = $this->get_fields(); if ( ! empty( $args['include'] ) ) { $fields = array_intersect_key( $fields, array_flip( $args['include'] ) ); } if ( ! empty( $args['exclude'] ) ) { $fields = array_diff_key( $fields, array_flip( $args['exclude'] ) ); } return $fields; } /** * Add group arguments to field. * * Register field arguments to group control. * * @since 1.2.2 * @access protected * * @param string $control_id Group control id. * @param array $field_args Group control field arguments. * * @return array */ protected function add_group_args_to_field( $control_id, $field_args ) { $args = $this->get_args(); if ( ! empty( $args['tab'] ) ) { $field_args['tab'] = $args['tab']; } if ( ! empty( $args['section'] ) ) { $field_args['section'] = $args['section']; } $field_args['classes'] = $this->get_base_group_classes() . ' elementor-group-control-' . $control_id; foreach ( [ 'condition', 'conditions' ] as $condition_type ) { if ( ! empty( $args[ $condition_type ] ) ) { if ( empty( $field_args[ $condition_type ] ) ) { $field_args[ $condition_type ] = []; } $field_args[ $condition_type ] += $args[ $condition_type ]; } } return $field_args; } /** * Prepare fields. * * Process group control fields before adding them to `add_control()`. * * @since 1.2.2 * @access protected * * @param array $fields Group control fields. * * @return array Processed fields. */ protected function prepare_fields( $fields ) { $popover_options = $this->get_options( 'popover' ); $popover_name = ! $popover_options ? null : $popover_options['starter_name']; foreach ( $fields as $field_key => &$field ) { if ( $popover_name ) { $field['condition'][ $popover_name . '!' ] = ''; } if ( isset( $this->args['fields_options']['__all'] ) ) { $field = array_merge( $field, $this->args['fields_options']['__all'] ); } if ( isset( $this->args['fields_options'][ $field_key ] ) ) { $field = array_merge( $field, $this->args['fields_options'][ $field_key ] ); } if ( ! empty( $field['condition'] ) ) { $field = $this->add_condition_prefix( $field ); } if ( ! empty( $field['conditions'] ) ) { $field['conditions'] = $this->add_conditions_prefix( $field['conditions'] ); } if ( ! empty( $field['selectors'] ) ) { $field['selectors'] = $this->handle_selectors( $field['selectors'] ); } if ( ! empty( $field['device_args'] ) ) { foreach ( $field['device_args'] as $device => $device_arg ) { if ( ! empty( $field['device_args'][ $device ]['condition'] ) ) { $field['device_args'][ $device ] = $this->add_condition_prefix( $field['device_args'][ $device ] ); } if ( ! empty( $field['device_args'][ $device ]['conditions'] ) ) { $field['device_args'][ $device ]['conditions'] = $this->add_conditions_prefix( $field['device_args'][ $device ]['conditions'] ); } if ( ! empty( $device_arg['selectors'] ) ) { $field['device_args'][ $device ]['selectors'] = $this->handle_selectors( $device_arg['selectors'] ); } } } } return $fields; } /** * Init options. * * Initializing group control options. * * @since 1.9.0 * @access private */ private function init_options() { $default_options = [ 'popover' => [ 'starter_name' => 'popover_toggle', 'starter_value' => 'custom', 'starter_title' => '', ], ]; $this->options = array_replace_recursive( $default_options, $this->get_default_options() ); } /** * Init arguments. * * Initializing group control base class. * * @since 1.2.2 * @access protected * * @param array $args Group control settings value. */ protected function init_args( $args ) { $this->args = array_merge( $this->get_default_args(), $this->get_child_default_args(), $args ); } /** * Get default arguments. * * Retrieve the default arguments of the group control. Used to return the * default arguments while initializing the group control. * * @since 1.2.2 * @access private * * @return array Control default arguments. */ private function get_default_args() { return [ 'default' => '', 'selector' => '{{WRAPPER}}', 'fields_options' => [], ]; } /** * Add condition prefix. * * Used to add the group prefix to controls with conditions, to * distinguish them from other controls with the same name. * * This way Elementor can apply condition logic to a specific control in a * group control. * * @since 1.2.0 * @access private * * @param array $field Group control field. * * @return array Group control field. */ private function add_condition_prefix( $field ) { $controls_prefix = $this->get_controls_prefix(); $prefixed_condition_keys = array_map( function( $key ) use ( $controls_prefix ) { return $controls_prefix . $key; }, array_keys( $field['condition'] ) ); $field['condition'] = array_combine( $prefixed_condition_keys, $field['condition'] ); return $field; } private function add_conditions_prefix( $conditions ) { $controls_prefix = $this->get_controls_prefix(); foreach ( $conditions['terms'] as & $condition ) { if ( isset( $condition['terms'] ) ) { $condition = $this->add_conditions_prefix( $condition ); continue; } $condition['name'] = $controls_prefix . $condition['name']; } return $conditions; } /** * Handle selectors. * * Used to process the CSS selector of group control fields. When using * group control, Elementor needs to apply the selector to different fields. * This method handles the process. * * In addition, it handles selector values from other fields and process the * css. * * @since 1.2.2 * @access private * * @param array $selectors An array of selectors to process. * * @return array Processed selectors. */ private function handle_selectors( $selectors ) { $args = $this->get_args(); $selectors = array_combine( array_map( function( $key ) use ( $args ) { return str_replace( '{{SELECTOR}}', $args['selector'], $key ); }, array_keys( $selectors ) ), $selectors ); if ( ! $selectors ) { return $selectors; } $controls_prefix = $this->get_controls_prefix(); foreach ( $selectors as &$selector ) { $selector = preg_replace_callback( '/\{\{\K(.*?)(?=}})/', function( $matches ) use ( $controls_prefix ) { return preg_replace_callback( '/[^ ]+(?=\.)/', function( $sub_matches ) use ( $controls_prefix ) { return $controls_prefix . $sub_matches[0]; }, $matches[1] ); }, $selector ); } return $selectors; } /** * Start popover. * * Starts a group controls popover. * * @since 1.9.1 * @access private * @param Controls_Stack $element Element. */ private function start_popover( Controls_Stack $element ) { $popover_options = $this->get_options( 'popover' ); $settings = $this->get_args(); if ( ! empty( $settings['label'] ) ) { $label = $settings['label']; } else { $label = $popover_options['starter_title']; } $control_params = [ 'type' => Controls_Manager::POPOVER_TOGGLE, 'label' => $label, 'return_value' => $popover_options['starter_value'], ]; if ( ! empty( $popover_options['settings'] ) ) { $control_params = array_replace_recursive( $control_params, $popover_options['settings'] ); } foreach ( [ 'condition', 'conditions' ] as $key ) { if ( ! empty( $settings[ $key ] ) ) { $control_params[ $key ] = $settings[ $key ]; } } $starter_name = $popover_options['starter_name']; if ( isset( $this->args['fields_options'][ $starter_name ] ) ) { $control_params = array_merge( $control_params, $this->args['fields_options'][ $starter_name ] ); } $element->add_control( $this->get_controls_prefix() . $starter_name, $control_params ); $element->start_popover(); } } text-shadow.php000066600000003650152142407030007532 0ustar00 _x( 'Text Shadow', 'Text Shadow Control', 'elementor' ), 'type' => Controls_Manager::TEXT_SHADOW, 'selectors' => [ '{{SELECTOR}}' => 'text-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{COLOR}};', ], ]; return $controls; } /** * Get default options. * * Retrieve the default options of the text shadow control. Used to return the * default options while initializing the text shadow control. * * @since 1.9.0 * @access protected * * @return array Default text shadow control options. */ protected function get_default_options() { return [ 'popover' => [ 'starter_title' => _x( 'Text Shadow', 'Text Shadow Control', 'elementor' ), 'starter_name' => 'text_shadow_type', 'starter_value' => 'yes', 'settings' => [ 'render_type' => 'ui', ], ], ]; } } image-size.php000066600000024126152142407030007316 0ustar00 trim( $image_class ), ]; $html .= wp_get_attachment_image( $image['id'], $size, false, $image_attr ); } else { $image_src = self::get_attachment_image_src( $image['id'], $image_size_key, $settings ); if ( ! $image_src && isset( $image['url'] ) ) { $image_src = $image['url']; } if ( ! empty( $image_src ) ) { $image_class_html = ! empty( $image_class ) ? ' class="' . $image_class . '"' : ''; $html .= sprintf( '%s', esc_attr( $image_src ), Control_Media::get_image_title( $image ), Control_Media::get_image_alt( $image ), $image_class_html ); } } /** * Get Attachment Image HTML * * Filters the Attachment Image HTML * * @since 2.4.0 * @param string $html the attachment image HTML string * @param array $settings Control settings. * @param string $image_size_key Optional. Settings key for image size. * Default is `image`. * @param string $image_key Optional. Settings key for image. Default * is null. If not defined uses image size key * as the image key. */ return apply_filters( 'elementor/image_size/get_attachment_image_html', $html, $settings, $image_size_key, $image_key ); } /** * Get all image sizes. * * Retrieve available image sizes with data like `width`, `height` and `crop`. * * @since 1.0.0 * @access public * @static * * @return array An array of available image sizes. */ public static function get_all_image_sizes() { global $_wp_additional_image_sizes; $default_image_sizes = [ 'thumbnail', 'medium', 'medium_large', 'large' ]; $image_sizes = []; foreach ( $default_image_sizes as $size ) { $image_sizes[ $size ] = [ 'width' => (int) get_option( $size . '_size_w' ), 'height' => (int) get_option( $size . '_size_h' ), 'crop' => (bool) get_option( $size . '_crop' ), ]; } if ( $_wp_additional_image_sizes ) { $image_sizes = array_merge( $image_sizes, $_wp_additional_image_sizes ); } /** This filter is documented in wp-admin/includes/media.php */ return apply_filters( 'image_size_names_choose', $image_sizes ); } /** * Get attachment image src. * * Retrieve the attachment image source URL. * * @since 1.0.0 * @access public * @static * * @param string $attachment_id The attachment ID. * @param string $image_size_key Settings key for image size. * @param array $settings Control settings. * * @return string Attachment image source URL. */ public static function get_attachment_image_src( $attachment_id, $image_size_key, array $settings ) { if ( empty( $attachment_id ) ) { return false; } $size = $settings[ $image_size_key . '_size' ]; if ( 'custom' !== $size ) { $attachment_size = $size; } else { // Use BFI_Thumb script // TODO: Please rewrite this code. require_once( ELEMENTOR_PATH . 'includes/libraries/bfi-thumb/bfi-thumb.php' ); $custom_dimension = $settings[ $image_size_key . '_custom_dimension' ]; $attachment_size = [ // Defaults sizes 0 => null, // Width. 1 => null, // Height. 'bfi_thumb' => true, 'crop' => true, ]; $has_custom_size = false; if ( ! empty( $custom_dimension['width'] ) ) { $has_custom_size = true; $attachment_size[0] = $custom_dimension['width']; } if ( ! empty( $custom_dimension['height'] ) ) { $has_custom_size = true; $attachment_size[1] = $custom_dimension['height']; } if ( ! $has_custom_size ) { $attachment_size = 'full'; } } $image_src = wp_get_attachment_image_src( $attachment_id, $attachment_size ); if ( empty( $image_src[0] ) && 'thumbnail' !== $attachment_size ) { $image_src = wp_get_attachment_image_src( $attachment_id ); } return ! empty( $image_src[0] ) ? $image_src[0] : ''; } /** * Get child default arguments. * * Retrieve the default arguments for all the child controls for a specific group * control. * * @since 1.2.2 * @access protected * * @return array Default arguments for all the child controls. */ protected function get_child_default_args() { return [ 'include' => [], 'exclude' => [], ]; } /** * Init fields. * * Initialize image size control fields. * * @since 1.2.2 * @access protected * * @return array Control fields. */ protected function init_fields() { $fields = []; $fields['size'] = [ 'label' => _x( 'Image Size', 'Image Size Control', 'elementor' ), 'type' => Controls_Manager::SELECT, ]; $fields['custom_dimension'] = [ 'label' => _x( 'Image Dimension', 'Image Size Control', 'elementor' ), 'type' => Controls_Manager::IMAGE_DIMENSIONS, 'description' => __( 'You can crop the original image size to any custom size. You can also set a single value for height or width in order to keep the original size ratio.', 'elementor' ), 'condition' => [ 'size' => 'custom', ], 'separator' => 'none', ]; return $fields; } /** * Prepare fields. * * Process image size control fields before adding them to `add_control()`. * * @since 1.2.2 * @access protected * * @param array $fields Image size control fields. * * @return array Processed fields. */ protected function prepare_fields( $fields ) { $image_sizes = $this->get_image_sizes(); $args = $this->get_args(); if ( ! empty( $args['default'] ) && isset( $image_sizes[ $args['default'] ] ) ) { $default_value = $args['default']; } else { // Get the first item for default value. $default_value = array_keys( $image_sizes ); $default_value = array_shift( $default_value ); } $fields['size']['options'] = $image_sizes; $fields['size']['default'] = $default_value; if ( ! isset( $image_sizes['custom'] ) ) { unset( $fields['custom_dimension'] ); } return parent::prepare_fields( $fields ); } /** * Get image sizes. * * Retrieve available image sizes after filtering `include` and `exclude` arguments. * * @since 2.0.0 * @access private * * @return array Filtered image sizes. */ private function get_image_sizes() { $wp_image_sizes = self::get_all_image_sizes(); $args = $this->get_args(); if ( $args['include'] ) { $wp_image_sizes = array_intersect_key( $wp_image_sizes, array_flip( $args['include'] ) ); } elseif ( $args['exclude'] ) { $wp_image_sizes = array_diff_key( $wp_image_sizes, array_flip( $args['exclude'] ) ); } $image_sizes = []; foreach ( $wp_image_sizes as $size_key => $size_attributes ) { $control_title = ucwords( str_replace( '_', ' ', $size_key ) ); if ( is_array( $size_attributes ) ) { $control_title .= sprintf( ' - %d x %d', $size_attributes['width'], $size_attributes['height'] ); } $image_sizes[ $size_key ] = $control_title; } $image_sizes['full'] = _x( 'Full', 'Image Size Control', 'elementor' ); if ( ! empty( $args['include']['custom'] ) || ! in_array( 'custom', $args['exclude'] ) ) { $image_sizes['custom'] = _x( 'Custom', 'Image Size Control', 'elementor' ); } return $image_sizes; } /** * Get default options. * * Retrieve the default options of the image size control. Used to return the * default options while initializing the image size control. * * @since 1.9.0 * @access protected * * @return array Default image size control options. */ protected function get_default_options() { return [ 'popover' => false, ]; } }