a name of the control * way => Тип значения 'slider' - слайдер, 'checkbox-slider' - чекбокс активирует слайдер, по умолчанию input * checkbox => Указывается если, 'way' имеет значение 'checkbox-slider' * Пример: * array( * 'on' => __('Show shadow', 'bizpanda'), * 'off' => __('Hide shadow', 'bizpanda'), * ) * title => Заголовок контрола * slider-title => Заголовок слайдера( Только если 'way' имеет значение 'checkbox-slider' ) * range => Диапазон значений, указывается если 'way' имеет значение 'slider' или 'checkbox-slider' * Пример: array(0,100) * units => Единицы измерения(px,pt,em,%) * isActive => Включение, отключение поля * value => a value to show in the control * default => a default value of the control if the "value" option is not specified * * @package factory-forms * @since 1.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Wbcr_FactoryForms600_IntegerControl' ) ) { class Wbcr_FactoryForms600_IntegerControl extends Wbcr_FactoryForms600_Control { public $type = 'integer'; /** * Converting string to integer. * * @since 1.0.0 * @return integer */ public function html() { $name = $this->getNameOnForm(); $value = esc_attr( $this->getValue() ); $step = 1; $range = $checkbox = []; $is_active = $this->getOption( 'isActive', 1 ); $unit = esc_attr( $this->getOption( 'units' ) ); $way = $this->getOption( 'way' ); if ( empty( $way ) ) { $way = 'text'; } $has_slider = false; if ( in_array( $way, [ 'slider', 'checkbox-slider' ] ) ) { $range = $this->getOption( 'range', [ 0, 99 ] ); $slider_title = $this->getOption( 'slider-title' ); $checkbox = $this->getOption( 'checkbox' ); $step = $this->getOption( 'step', 1 ); $has_slider = true; } $this->addCssClass( 'factory-way-' . $way ); if ( $has_slider ) { $this->addCssClass( 'factory-has-slider' ); } ?>