AdminPage.Menu.class.php
4 years ago
AdminPage.Submenu.class.php
4 years ago
AdminPage.Themes.class.php
4 years ago
AdminPage.class.php
4 years ago
AdminPageSection.class.php
4 years ago
AdminPageSetting.Address.class.php
4 years ago
AdminPageSetting.Checkbox.class.php
4 years ago
AdminPageSetting.ColorPicker.class.php
4 years ago
AdminPageSetting.Count.class.php
4 years ago
AdminPageSetting.Editor.class.php
4 years ago
AdminPageSetting.FileUpload.class.php
4 years ago
AdminPageSetting.HTML.class.php
4 years ago
AdminPageSetting.Image.class.php
4 years ago
AdminPageSetting.InfiniteTable.class.php
4 years ago
AdminPageSetting.McApiKey.class.php
4 years ago
AdminPageSetting.McListMerge.class.php
4 years ago
AdminPageSetting.Number.class.php
4 years ago
AdminPageSetting.OpeningHours.class.php
4 years ago
AdminPageSetting.Ordering.class.php
4 years ago
AdminPageSetting.Radio.class.php
4 years ago
AdminPageSetting.Scheduler.class.php
4 years ago
AdminPageSetting.Select.class.php
4 years ago
AdminPageSetting.SelectMenu.class.php
4 years ago
AdminPageSetting.SelectPost.class.php
4 years ago
AdminPageSetting.SelectTaxonomy.class.php
4 years ago
AdminPageSetting.Text.class.php
4 years ago
AdminPageSetting.Textarea.class.php
4 years ago
AdminPageSetting.Time.class.php
4 years ago
AdminPageSetting.Toggle.class.php
4 years ago
AdminPageSetting.WarningTip.class.php
4 years ago
AdminPageSetting.class.php
4 years ago
Library.class.php
4 years ago
AdminPageSetting.Radio.class.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Register, display and save an option with radio buttons. |
| 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 | * 'options' => array( |
| 13 | * 'value' => 'Name' |
| 14 | * ), // The radio buttons values and text |
| 15 | * ); |
| 16 | * ); |
| 17 | * |
| 18 | * @since 2.0 |
| 19 | * @package Simple Admin Pages |
| 20 | */ |
| 21 | |
| 22 | class sapAdminPageSettingRadio_2_6_1 extends sapAdminPageSetting_2_6_1 { |
| 23 | |
| 24 | public $sanitize_callback = 'sanitize_text_field'; |
| 25 | |
| 26 | /** |
| 27 | * Display this setting |
| 28 | * @since 2.0 |
| 29 | */ |
| 30 | public function display_setting() { |
| 31 | |
| 32 | $input_name = $this->get_input_name(); |
| 33 | |
| 34 | if ( empty( $this->value ) ) { $this->value = $this->get_default_setting(); } |
| 35 | |
| 36 | ?> |
| 37 | <fieldset <?php echo ( isset( $this->columns ) ? 'class="sap-setting-columns-' . $this->columns . '"' : '' ); ?> <?php $this->print_conditional_data(); ?>> |
| 38 | <?php foreach ( $this->options as $id => $title ) : ?> |
| 39 | <label title="<?php echo ( strpos( $title, '<' ) === false ? $title : ''); ?>" class="sap-admin-input-container"> |
| 40 | <input type="radio" name="<?php echo $input_name; ?>" id="<?php echo $input_name . "-" . $id; ?>" value="<?php echo $id; ?>" <?php echo ( $id == $this->value ? 'checked="checked"' : '' ) ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?> /> |
| 41 | <span class='sap-admin-radio-button'></span> <span><?php echo $title; ?></span> |
| 42 | </label> |
| 43 | <?php endforeach; ?> |
| 44 | |
| 45 | <?php $this->display_disabled(); ?> |
| 46 | </fieldset> |
| 47 | <?php |
| 48 | |
| 49 | $this->display_description(); |
| 50 | |
| 51 | } |
| 52 | |
| 53 | } |
| 54 |