first commit
This commit is contained in:
+60
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Range control class.
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
* @subpackage Controls
|
||||
* @see https://github.com/justintadlock/butterbean
|
||||
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
/**
|
||||
* Range control class.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
class OceanWP_ButterBean_Control_Range extends ButterBean_Control {
|
||||
|
||||
/**
|
||||
* The type of control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'range';
|
||||
|
||||
/**
|
||||
* Gets the attributes for the control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function get_attr() {
|
||||
$attr = parent::get_attr();
|
||||
|
||||
$setting = $this->get_setting();
|
||||
|
||||
$attr['data-reset_value'] = $setting ? $setting->default : '';
|
||||
|
||||
return $attr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for the setting.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @param string $setting
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_value( $setting = 'default' ) {
|
||||
|
||||
$value = parent::get_value( $setting );
|
||||
$object = $this->get_setting( $setting );
|
||||
|
||||
return ! $value && $object ? $object->default : $value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user