border.php (2566B)
1 <?php 2 namespace Elementor; 3 4 if ( ! defined( 'ABSPATH' ) ) { 5 exit; // Exit if accessed directly. 6 } 7 8 /** 9 * Elementor border control. 10 * 11 * A base control for creating border control. Displays input fields to define 12 * border type, border width and border color. 13 * 14 * @since 1.0.0 15 */ 16 class Group_Control_Border extends Group_Control_Base { 17 18 /** 19 * Fields. 20 * 21 * Holds all the border control fields. 22 * 23 * @since 1.0.0 24 * @access protected 25 * @static 26 * 27 * @var array Border control fields. 28 */ 29 protected static $fields; 30 31 /** 32 * Get border control type. 33 * 34 * Retrieve the control type, in this case `border`. 35 * 36 * @since 1.0.0 37 * @access public 38 * @static 39 * 40 * @return string Control type. 41 */ 42 public static function get_type() { 43 return 'border'; 44 } 45 46 /** 47 * Init fields. 48 * 49 * Initialize border control fields. 50 * 51 * @since 1.2.2 52 * @access protected 53 * 54 * @return array Control fields. 55 */ 56 protected function init_fields() { 57 $fields = []; 58 59 $fields['border'] = [ 60 'label' => _x( 'Border Type', 'Border Control', 'elementor' ), 61 'type' => Controls_Manager::SELECT, 62 'options' => [ 63 '' => esc_html__( 'None', 'elementor' ), 64 'solid' => _x( 'Solid', 'Border Control', 'elementor' ), 65 'double' => _x( 'Double', 'Border Control', 'elementor' ), 66 'dotted' => _x( 'Dotted', 'Border Control', 'elementor' ), 67 'dashed' => _x( 'Dashed', 'Border Control', 'elementor' ), 68 'groove' => _x( 'Groove', 'Border Control', 'elementor' ), 69 ], 70 'selectors' => [ 71 '{{SELECTOR}}' => 'border-style: {{VALUE}};', 72 ], 73 ]; 74 75 $fields['width'] = [ 76 'label' => _x( 'Width', 'Border Control', 'elementor' ), 77 'type' => Controls_Manager::DIMENSIONS, 78 'selectors' => [ 79 '{{SELECTOR}}' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 80 ], 81 'condition' => [ 82 'border!' => '', 83 ], 84 'responsive' => true, 85 ]; 86 87 $fields['color'] = [ 88 'label' => _x( 'Color', 'Border Control', 'elementor' ), 89 'type' => Controls_Manager::COLOR, 90 'default' => '', 91 'selectors' => [ 92 '{{SELECTOR}}' => 'border-color: {{VALUE}};', 93 ], 94 'condition' => [ 95 'border!' => '', 96 ], 97 ]; 98 99 return $fields; 100 } 101 102 /** 103 * Get default options. 104 * 105 * Retrieve the default options of the border control. Used to return the 106 * default options while initializing the border control. 107 * 108 * @since 1.9.0 109 * @access protected 110 * 111 * @return array Default border control options. 112 */ 113 protected function get_default_options() { 114 return [ 115 'popover' => false, 116 ]; 117 } 118 }