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
color.php
87 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | use Elementor\Modules\DynamicTags\Module as TagsModule; |
| 5 | |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | exit; // Exit if accessed directly. |
| 8 | } |
| 9 | |
| 10 | /** |
| 11 | * Elementor color control. |
| 12 | * |
| 13 | * A base control for creating color control. Displays a color picker field with |
| 14 | * an alpha slider. Includes a customizable color palette that can be preset by |
| 15 | * the user. Accepts a `scheme` argument that allows you to set a value from the |
| 16 | * active color scheme as the default value returned by the control. |
| 17 | * |
| 18 | * @since 1.0.0 |
| 19 | */ |
| 20 | class Control_Color extends Base_Data_Control { |
| 21 | |
| 22 | /** |
| 23 | * Get color control type. |
| 24 | * |
| 25 | * Retrieve the control type, in this case `color`. |
| 26 | * |
| 27 | * @since 1.0.0 |
| 28 | * @access public |
| 29 | * |
| 30 | * @return string Control type. |
| 31 | */ |
| 32 | public function get_type() { |
| 33 | return 'color'; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Render color control output in the editor. |
| 38 | * |
| 39 | * Used to generate the control HTML in the editor using Underscore JS |
| 40 | * template. The variables for the class are available using `data` JS |
| 41 | * object. |
| 42 | * |
| 43 | * @since 1.0.0 |
| 44 | * @access public |
| 45 | */ |
| 46 | public function content_template() { |
| 47 | ?> |
| 48 | <div class="elementor-control-field"> |
| 49 | <label class="elementor-control-title">{{{ data.label || '' }}}</label> |
| 50 | <div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper elementor-control-unit-5"> |
| 51 | <div class="elementor-color-picker-placeholder"></div> |
| 52 | </div> |
| 53 | </div> |
| 54 | <# if ( data.description ) { #> |
| 55 | <div class="elementor-control-field-description">{{{ data.description }}}</div> |
| 56 | <# } #> |
| 57 | <?php |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Get color control default settings. |
| 62 | * |
| 63 | * Retrieve the default settings of the color control. Used to return the default |
| 64 | * settings while initializing the color control. |
| 65 | * |
| 66 | * @since 1.0.0 |
| 67 | * @access protected |
| 68 | * |
| 69 | * @return array Control default settings. |
| 70 | */ |
| 71 | protected function get_default_settings() { |
| 72 | return [ |
| 73 | 'alpha' => true, |
| 74 | 'scheme' => '', |
| 75 | 'dynamic' => [ |
| 76 | 'categories' => [ |
| 77 | TagsModule::COLOR_CATEGORY, |
| 78 | ], |
| 79 | 'active' => true, |
| 80 | ], |
| 81 | 'global' => [ |
| 82 | 'active' => true, |
| 83 | ], |
| 84 | ]; |
| 85 | } |
| 86 | } |
| 87 |