YelpReviews_Settings::number( array $args )
Callback function to display setting number field.
Contents
Parameters Parameters
- $args
-
(array) (Required) array of setting arguments
Source Source
File: mortgage-yelp-review/inc/YelpReviews_Settings.php
public function number( array $args ) {
$name = $args['label_for'];
$option_name = $args['option_name'];
$input = get_option( $option_name );
$placeholder = $args['placeholder'];
$default = $args['default'];
$description = $args['description'];
$value = ! empty( $input[ $name ] ) ? $input[ $name ] : $default;
$api_key = isset(get_option('mortgage_yelp_widget')['api_key']) && !empty(get_option('mortgage_yelp_widget')['api_key']) ? true : false;
$value = $api_key ? 3 : $value;
$min = $api_key ? 3 : 0;
$max = $api_key ? 3 : 10;
echo '<input style="width: 100%; padding: 5px 10px" type="number" class="regular-text" min="'.$min.'" max="'.$max.'" step="1" id="' . esc_attr($name) . '" name="' . esc_attr($option_name) . '[' . esc_attr($name) . ']" value="' . esc_attr($value) . '" placeholder="' . esc_attr($placeholder) . '" >';
echo '<p>' . esc_html( $description ) . '</p>';
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |