customs
1 year ago
holders
1 year ago
checkbox.php
1 year ago
color-and-opacity.php
1 year ago
color.php
1 year ago
datepicker-range.php
1 year ago
dropdown-and-colors.php
1 year ago
dropdown.php
1 year ago
font.php
1 year ago
google-font.php
1 year ago
gradient.php
1 year ago
hidden.php
1 year ago
index.php
3 years ago
integer.php
1 year ago
list.php
1 year ago
multiple-textbox.php
1 year ago
paddings-editor.php
1 year ago
pattern.php
1 year ago
radio-colors.php
1 year ago
radio.php
1 year ago
textarea.php
1 year ago
textbox.php
1 year ago
url.php
1 year ago
wp-editor.php
1 year ago
paddings-editor.php
82 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Paddings Control |
| 4 | * |
| 5 | * @author Alex Kovalev <alex.kovalevv@gmail.com> |
| 6 | * @copyright (c) 2018, Webcraftic Ltd |
| 7 | * |
| 8 | * @package factory-forms |
| 9 | * @since 1.0.0 |
| 10 | */ |
| 11 | |
| 12 | // Exit if accessed directly |
| 13 | if( !defined('ABSPATH') ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | if( !class_exists('Wbcr_FactoryForms480_PaddingsEditorControl') ) { |
| 18 | |
| 19 | class Wbcr_FactoryForms480_PaddingsEditorControl extends Wbcr_FactoryForms480_Control { |
| 20 | |
| 21 | public $type = 'paddings-editor'; |
| 22 | |
| 23 | /** |
| 24 | * Converting string to integer. |
| 25 | * |
| 26 | * @since 1.0.0 |
| 27 | * @return integer |
| 28 | */ |
| 29 | public function html() |
| 30 | { |
| 31 | |
| 32 | $name = $this->getNameOnForm(); |
| 33 | $raw_value = esc_attr($this->getValue()); |
| 34 | |
| 35 | $units = $this->getOption('units'); |
| 36 | $values_with_units = explode(' ', $raw_value); |
| 37 | |
| 38 | $values = array(); |
| 39 | foreach($values_with_units as $value_with_unit) { |
| 40 | $values[] = intval($value_with_unit); |
| 41 | } |
| 42 | |
| 43 | $unit = $this->getOption('units', 'px'); |
| 44 | $range = $this->getOption('range', array(0, 99)); |
| 45 | $step = $this->getOption('step', 1); |
| 46 | |
| 47 | ?> |
| 48 | <div <?php $this->attrs() ?> |
| 49 | data-units="<?php echo esc_attr($unit); ?>" |
| 50 | data-range-start="<?php echo esc_attr($range[0]); ?>" |
| 51 | data-range-end="<?php echo esc_attr($range[1]); ?>" |
| 52 | data-step="<?php echo esc_attr($step); ?>"> |
| 53 | <div class="factory-rectangle"> |
| 54 | <div class="factory-side factory-side-top" data-value="<?php echo esc_attr($values[0]); ?>"> |
| 55 | <span class="factory-visible-value"><?php echo esc_attr($values[0]); ?><?php echo esc_attr($units); ?></span> |
| 56 | </div> |
| 57 | <div class="factory-side factory-side-bottom" data-value="<?php echo $values[1] ?>"> |
| 58 | <span class="factory-visible-value"><?php echo esc_attr($values[1]); ?><?php echo esc_attr($units); ?></span> |
| 59 | </div> |
| 60 | <div class="factory-side factory-side-left" data-value="<?php echo $values[2] ?>"> |
| 61 | <span class="factory-visible-value"><?php echo esc_attr($values[2]); ?><?php echo esc_attr($units); ?></span> |
| 62 | </div> |
| 63 | <div class="factory-side factory-side-right" data-value="<?php echo $values[3] ?>"> |
| 64 | <span class="factory-visible-value"><?php echo esc_attr($values[3]); ?><?php echo esc_attr($units); ?></span> |
| 65 | </div> |
| 66 | <div class="factory-side factory-side-center" data-value="<?php echo esc_attr($values[0]); ?>"></div> |
| 67 | </div> |
| 68 | <div class="factory-slider-container"> |
| 69 | <label class="factory-title"> |
| 70 | <?php _e('Select a side and move the slider to set up:', 'wbcr_factory_forms_480') ?> |
| 71 | </label> |
| 72 | |
| 73 | <div class="factory-slider"> |
| 74 | <div class="factory-bar"></div> |
| 75 | </div> |
| 76 | </div> |
| 77 | <input type="hidden" class="factory-result" name="<?php echo esc_attr($name); ?>" value="<?php echo esc_attr($raw_value); ?>"/> |
| 78 | </div> |
| 79 | <?php |
| 80 | } |
| 81 | } |
| 82 | } |