groups
4 years ago
animation.php
4 years ago
base-data.php
4 years ago
base-icon-font.php
6 years ago
base-multiple.php
7 years ago
base-ui.php
8 years ago
base-units.php
5 years ago
base.php
4 years ago
box-shadow.php
4 years ago
button.php
8 years ago
choose.php
4 years ago
code.php
4 years ago
color.php
5 years ago
date-time.php
4 years ago
deprecated-notice.php
4 years ago
dimensions.php
4 years ago
divider.php
7 years ago
exit-animation.php
4 years ago
font.php
4 years ago
gallery.php
4 years ago
heading.php
4 years ago
hidden.php
8 years ago
hover-animation.php
4 years ago
icon.php
4 years ago
icons.php
4 years ago
image-dimensions.php
4 years ago
media.php
4 years ago
number.php
4 years ago
popover-toggle.php
4 years ago
raw-html.php
6 years ago
repeater.php
4 years ago
section.php
6 years ago
select.php
4 years ago
select2.php
4 years ago
slider.php
4 years ago
structure.php
4 years ago
switcher.php
4 years ago
tab.php
8 years ago
tabs.php
8 years ago
text-shadow.php
4 years ago
text.php
4 years ago
textarea.php
4 years ago
url.php
4 years ago
wp-widget.php
8 years ago
wysiwyg.php
6 years ago
text-shadow.php
119 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | exit; // Exit if accessed directly. |
| 6 | } |
| 7 | |
| 8 | /** |
| 9 | * Elementor text shadow control. |
| 10 | * |
| 11 | * A base control for creating text shadows control. Displays input fields for |
| 12 | * horizontal shadow, vertical shadow, shadow blur and shadow color. |
| 13 | * |
| 14 | * @since 1.6.0 |
| 15 | */ |
| 16 | class Control_Text_Shadow extends Control_Base_Multiple { |
| 17 | |
| 18 | /** |
| 19 | * Get text shadow control type. |
| 20 | * |
| 21 | * Retrieve the control type, in this case `text_shadow`. |
| 22 | * |
| 23 | * @since 1.6.0 |
| 24 | * @access public |
| 25 | * |
| 26 | * @return string Control type. |
| 27 | */ |
| 28 | public function get_type() { |
| 29 | return 'text_shadow'; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Get text shadow control default values. |
| 34 | * |
| 35 | * Retrieve the default value of the text shadow control. Used to return the |
| 36 | * default values while initializing the text shadow control. |
| 37 | * |
| 38 | * @since 1.6.0 |
| 39 | * @access public |
| 40 | * |
| 41 | * @return array Control default value. |
| 42 | */ |
| 43 | public function get_default_value() { |
| 44 | return [ |
| 45 | 'horizontal' => 0, |
| 46 | 'vertical' => 0, |
| 47 | 'blur' => 10, |
| 48 | 'color' => 'rgba(0,0,0,0.3)', |
| 49 | ]; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Get text shadow control sliders. |
| 54 | * |
| 55 | * Retrieve the sliders of the text shadow control. Sliders are used while |
| 56 | * rendering the control output in the editor. |
| 57 | * |
| 58 | * @since 1.6.0 |
| 59 | * @access public |
| 60 | * |
| 61 | * @return array Control sliders. |
| 62 | */ |
| 63 | public function get_sliders() { |
| 64 | return [ |
| 65 | 'blur' => [ |
| 66 | 'label' => esc_html__( 'Blur', 'elementor' ), |
| 67 | 'min' => 0, |
| 68 | 'max' => 100, |
| 69 | ], |
| 70 | 'horizontal' => [ |
| 71 | 'label' => esc_html__( 'Horizontal', 'elementor' ), |
| 72 | 'min' => -100, |
| 73 | 'max' => 100, |
| 74 | ], |
| 75 | 'vertical' => [ |
| 76 | 'label' => esc_html__( 'Vertical', 'elementor' ), |
| 77 | 'min' => -100, |
| 78 | 'max' => 100, |
| 79 | ], |
| 80 | ]; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Render text shadow control output in the editor. |
| 85 | * |
| 86 | * Used to generate the control HTML in the editor using Underscore JS |
| 87 | * template. The variables for the class are available using `data` JS |
| 88 | * object. |
| 89 | * |
| 90 | * @since 1.6.0 |
| 91 | * @access public |
| 92 | */ |
| 93 | public function content_template() { |
| 94 | ?> |
| 95 | <div class="elementor-shadow-box"> |
| 96 | <div class="elementor-control-field elementor-color-picker-wrapper"> |
| 97 | <label class="elementor-control-title"><?php echo esc_html__( 'Color', 'elementor' ); ?></label> |
| 98 | <div class="elementor-control-input-wrapper elementor-control-unit-1"> |
| 99 | <div class="elementor-color-picker-placeholder"></div> |
| 100 | </div> |
| 101 | </div> |
| 102 | <?php |
| 103 | foreach ( $this->get_sliders() as $slider_name => $slider ) : |
| 104 | ?> |
| 105 | <div class="elementor-shadow-slider elementor-control-type-slider"> |
| 106 | <label for="<?php $this->print_control_uid( $slider_name ); ?>" class="elementor-control-title"><?php echo esc_html( $slider['label'] ); ?></label> |
| 107 | <div class="elementor-control-input-wrapper"> |
| 108 | <div class="elementor-slider" data-input="<?php echo esc_attr( $slider_name ); ?>"></div> |
| 109 | <div class="elementor-slider-input elementor-control-unit-2"> |
| 110 | <input id="<?php $this->print_control_uid( $slider_name ); ?>" type="number" min="<?php echo esc_attr( $slider['min'] ); ?>" max="<?php echo esc_attr( $slider['max'] ); ?>" data-setting="<?php echo esc_attr( $slider_name ); ?>"/> |
| 111 | </div> |
| 112 | </div> |
| 113 | </div> |
| 114 | <?php endforeach; ?> |
| 115 | </div> |
| 116 | <?php |
| 117 | } |
| 118 | } |
| 119 |