box-shadow.php (2361B)
1 <?php 2 namespace Elementor; 3 4 if ( ! defined( 'ABSPATH' ) ) { 5 exit; // Exit if accessed directly. 6 } 7 8 /** 9 * Elementor box shadow control. 10 * 11 * A base control for creating box shadow control. Displays input fields to define 12 * the box shadow including the horizontal shadow, vertical shadow, shadow blur, 13 * shadow spread, shadow color and the position. 14 * 15 * @since 1.2.2 16 */ 17 class Group_Control_Box_Shadow extends Group_Control_Base { 18 19 /** 20 * Fields. 21 * 22 * Holds all the box shadow control fields. 23 * 24 * @since 1.2.2 25 * @access protected 26 * @static 27 * 28 * @var array Box shadow control fields. 29 */ 30 protected static $fields; 31 32 /** 33 * Get box shadow control type. 34 * 35 * Retrieve the control type, in this case `box-shadow`. 36 * 37 * @since 1.0.0 38 * @access public 39 * @static 40 * 41 * @return string Control type. 42 */ 43 public static function get_type() { 44 return 'box-shadow'; 45 } 46 47 /** 48 * Init fields. 49 * 50 * Initialize box shadow control fields. 51 * 52 * @since 1.2.2 53 * @access protected 54 * 55 * @return array Control fields. 56 */ 57 protected function init_fields() { 58 $controls = []; 59 60 $controls['box_shadow'] = [ 61 'label' => _x( 'Box Shadow', 'Box Shadow Control', 'elementor' ), 62 'type' => Controls_Manager::BOX_SHADOW, 63 'selectors' => [ 64 '{{SELECTOR}}' => 'box-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{SPREAD}}px {{COLOR}} {{box_shadow_position.VALUE}};', 65 ], 66 ]; 67 68 $controls['box_shadow_position'] = [ 69 'label' => _x( 'Position', 'Box Shadow Control', 'elementor' ), 70 'type' => Controls_Manager::SELECT, 71 'options' => [ 72 ' ' => _x( 'Outline', 'Box Shadow Control', 'elementor' ), 73 'inset' => _x( 'Inset', 'Box Shadow Control', 'elementor' ), 74 ], 75 'default' => ' ', 76 'render_type' => 'ui', 77 ]; 78 79 return $controls; 80 } 81 82 /** 83 * Get default options. 84 * 85 * Retrieve the default options of the box shadow control. Used to return the 86 * default options while initializing the box shadow control. 87 * 88 * @since 1.9.0 89 * @access protected 90 * 91 * @return array Default box shadow control options. 92 */ 93 protected function get_default_options() { 94 return [ 95 'popover' => [ 96 'starter_title' => _x( 'Box Shadow', 'Box Shadow Control', 'elementor' ), 97 'starter_name' => 'box_shadow_type', 98 'starter_value' => 'yes', 99 'settings' => [ 100 'render_type' => 'ui', 101 ], 102 ], 103 ]; 104 } 105 }