PluginProbe
Slider Ultimate / 2.2.10
Slider Ultimate v2.2.10
2.2.10 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 All 54 releases
ultimate-slider / lib / simple-admin-pages / classes / AdminPageSetting.Select.class.php
AdminPageSetting.Select.class.php
66 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Register, display and save a selection option with a drop-down menu.
5 *
6 * This setting accepts the following arguments in its constructor function.
7 *
8 * $args = array(
9 * 'id' => 'setting_id', // Unique id
10 * 'title' => 'My Setting', // Title or label for the setting
11 * 'description' => 'Description', // Help text description
12 * 'blank_option' => true, // Whether or not to show a blank option
13 * 'options' => array( // An array of key/value pairs which
14 * 'option1' => 'Option 1', // define the options.
15 * 'option2' => 'Option 2',
16 * ...
17 * );
18 * );
19 *
20 * @since 1.0
21 * @package Simple Admin Pages
22 */
23
24 class sapAdminPageSettingSelect_2_6_19 extends sapAdminPageSetting_2_6_19 {
25
26 public $sanitize_callback = 'sanitize_text_field';
27
28 // Whether or not to display a blank option
29 public $blank_option = true;
30
31 // An array of options for this select field, accepted as a key/value pair.
32 public $options = array();
33
34 /**
35 * Display this setting
36 * @since 1.0
37 */
38 public function display_setting() {
39
40 ?>
41
42 <fieldset <?php $this->print_conditional_data(); ?>>
43
44 <select name="<?php echo esc_attr( $this->get_input_name() ); ?>" id="<?php echo esc_attr( $this->id ); ?>" <?php echo ( $this->disabled ? 'disabled' : ''); ?>>
45
46 <?php if ( $this->blank_option === true ) : ?>
47 <option></option>
48 <?php endif; ?>
49
50 <?php foreach ( $this->options as $id => $title ) : ?>
51 <option value="<?php echo esc_attr( $id ); ?>"<?php if( $this->value == $id ) : ?> selected="selected"<?php endif; ?>><?php echo esc_html( $title ); ?></option>
52 <?php endforeach; ?>
53
54 </select>
55 <?php $this->display_disabled(); ?>
56
57 </fieldset>
58
59 <?php
60
61 $this->display_description();
62
63 }
64
65 }
66