groups
9 months ago
alert.php
2 years ago
animation.php
1 year ago
base-data.php
1 year ago
base-icon-font.php
1 year ago
base-multiple.php
1 year ago
base-ui.php
3 years ago
base-units.php
2 years ago
base.php
3 years ago
box-shadow.php
3 years ago
button.php
3 years ago
choose.php
11 months ago
code.php
3 years ago
color.php
3 years ago
date-time.php
3 years ago
deprecated-notice.php
3 years ago
dimensions.php
1 year ago
divider.php
2 years ago
exit-animation.php
1 year ago
font.php
3 years ago
gallery.php
4 months ago
gaps.php
1 year ago
heading.php
3 years ago
hidden.php
3 years ago
hover-animation.php
1 year ago
icon.php
2 years ago
icons.php
11 months ago
image-dimensions.php
3 years ago
media.php
4 months ago
notice.php
1 year ago
number.php
6 months ago
popover-toggle.php
3 years ago
raw-html.php
3 years ago
repeater.php
11 months ago
section.php
9 months ago
select.php
3 years ago
select2.php
2 years ago
slider.php
3 years ago
structure.php
2 years ago
switcher.php
3 years ago
tab.php
2 years ago
tabs.php
2 years ago
text-shadow.php
3 years ago
text.php
11 months ago
textarea.php
3 years ago
url.php
11 months ago
visual-choice.php
11 months ago
wp-widget.php
3 years ago
wysiwyg.php
3 years ago
base-multiple.php
90 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | exit; // Exit if accessed directly. |
| 6 | } |
| 7 | |
| 8 | /** |
| 9 | * Elementor control base multiple. |
| 10 | * |
| 11 | * An abstract class for creating new controls in the panel that return |
| 12 | * more than a single value. Each value of the multi-value control will |
| 13 | * be returned as an item in a `key => value` array. |
| 14 | * |
| 15 | * @since 1.0.0 |
| 16 | * @abstract |
| 17 | */ |
| 18 | abstract class Control_Base_Multiple extends Base_Data_Control { |
| 19 | |
| 20 | /** |
| 21 | * Get multiple control default value. |
| 22 | * |
| 23 | * Retrieve the default value of the multiple control. Used to return the default |
| 24 | * values while initializing the multiple control. |
| 25 | * |
| 26 | * @since 1.0.0 |
| 27 | * @access public |
| 28 | * |
| 29 | * @return array Control default value. |
| 30 | */ |
| 31 | public function get_default_value() { |
| 32 | return []; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Get multiple control value. |
| 37 | * |
| 38 | * Retrieve the value of the multiple control from a specific Controls_Stack settings. |
| 39 | * |
| 40 | * @since 1.0.0 |
| 41 | * @access public |
| 42 | * |
| 43 | * @param array $control Control. |
| 44 | * @param array $settings Settings. |
| 45 | * |
| 46 | * @return mixed Control values. |
| 47 | */ |
| 48 | public function get_value( $control, $settings ) { |
| 49 | $value = parent::get_value( $control, $settings ); |
| 50 | |
| 51 | if ( empty( $control['default'] ) ) { |
| 52 | $control['default'] = []; |
| 53 | } |
| 54 | |
| 55 | if ( ! is_array( $value ) ) { |
| 56 | $value = []; |
| 57 | } |
| 58 | |
| 59 | $control['default'] = array_merge( |
| 60 | $this->get_default_value(), |
| 61 | $control['default'] |
| 62 | ); |
| 63 | |
| 64 | return array_merge( |
| 65 | $control['default'], |
| 66 | $value |
| 67 | ); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Get multiple control style value. |
| 72 | * |
| 73 | * Retrieve the style of the control. Used when adding CSS rules to the control |
| 74 | * while extracting CSS from the `selectors` data argument. |
| 75 | * |
| 76 | * @since 1.0.5 |
| 77 | * @since 2.3.3 New `$control_data` parameter added. |
| 78 | * @access public |
| 79 | * |
| 80 | * @param string $css_property CSS property. |
| 81 | * @param array $control_value Control value. |
| 82 | * @param array $control_data Control Data. |
| 83 | * |
| 84 | * @return array Control style value. |
| 85 | */ |
| 86 | public function get_style_value( $css_property, $control_value, array $control_data ) { |
| 87 | return $control_value[ strtolower( $css_property ) ]; |
| 88 | } |
| 89 | } |
| 90 |