'setting_id', // Unique id * 'title' => 'My Setting', // Title or label for the setting * 'description' => 'Description', // Help text description * 'blank_option' => true, // Whether or not to show a blank option * 'min_value' => 0, // The lowest value to include * 'max_value' => 10, // The highest value to include * 'increment' => 1, // How many values to increase by each loop * 'units' => array( // An array of key/value pairs which * 'unit_one' => 'Unit 1', // Define the units. * 'unit_two' => 'Unit 2', * ... * ); * ); * * @since 2.0 * @package Simple Admin Pages */ class sapAdminPageSettingCount_2_7_4 extends sapAdminPageSetting_2_7_4 { public $sanitize_callback = 'sanitize_text_field'; /** * Add in the JS requried for rows to be added and the values to be stored * @since 2.0 */ public $scripts = array( 'sap-count' => array( 'path' => 'js/count.js', 'dependencies' => array( 'jquery' ), 'version' => SAP_VERSION, 'footer' => true, ), ); // Whether or not to display a blank option public $blank_option = true; // The default value for the field when none has been set public $default; // The lowest value to include public $min_value = 0; // The lowest value to include public $max_value = 10; // The lowest value to include public $increment = 1; // An array of options for this select field, accepted as a key/value pair. public $units = array(); /** * Display this setting * @since 1.0 */ public function display_setting() { $this->value = $this->value ? $this->value : $this->default; $count = strpos( strval( $this->value ), '_' ) !== false ? substr( $this->value, 0, strpos( $this->value, '_' ) ) : $this->value; $unit = strpos( strval( $this->value ), '_' ) !== false ? substr( $this->value, strpos( $this->value, '_' ) + 1 ) : ''; ?>
display_description(); } }