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.Toggle.class.php
55 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Register, display and save an option with a single checkbox. |
| 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 | * 'label' => 'Label', // Checkbox label text |
| 13 | * ); |
| 14 | * ); |
| 15 | * |
| 16 | * @since 1.0 |
| 17 | * @package Simple Admin Pages |
| 18 | */ |
| 19 | |
| 20 | class sapAdminPageSettingToggle_2_6_1 extends sapAdminPageSetting_2_6_1 { |
| 21 | |
| 22 | public $sanitize_callback = 'sanitize_text_field'; |
| 23 | |
| 24 | /** |
| 25 | * Display this setting |
| 26 | * @since 1.0 |
| 27 | */ |
| 28 | public function display_setting() { |
| 29 | |
| 30 | $input_name = $this->get_input_name(); |
| 31 | |
| 32 | if ( ! isset( $this->value ) ) { $this->value = $this->get_default_setting(); } |
| 33 | |
| 34 | ?> |
| 35 | |
| 36 | <fieldset <?php $this->print_conditional_data(); ?>> |
| 37 | <div class="sap-admin-hide-radios"> |
| 38 | <input type="checkbox" name="<?php echo $input_name; ?>" id="<?php echo $input_name; ?>" value="1"<?php if( $this->value == '1' ) : ?> checked="checked"<?php endif; ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?> <?php $this->print_conditional_data(); ?>> |
| 39 | <label for="<?php echo $input_name; ?>"><?php echo $this->title; ?></label> |
| 40 | </div> |
| 41 | <label class="sap-admin-switch"> |
| 42 | <input type="checkbox" class="sap-admin-option-toggle" data-inputname="<?php echo $input_name; ?>" <?php if($this->value == '1') {echo "checked='checked'";} ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?>> |
| 43 | <span class="sap-admin-switch-slider round"></span> |
| 44 | </label> |
| 45 | <?php $this->display_disabled(); ?> |
| 46 | </fieldset> |
| 47 | |
| 48 | <?php |
| 49 | |
| 50 | $this->display_description(); |
| 51 | |
| 52 | } |
| 53 | |
| 54 | } |
| 55 |