Plugin Directory

Changeset 2098726


Ignore:
Timestamp:
05/31/2019 03:53:09 PM (7 years ago)
Author:
fayne
Message:

Default config value fix

Location:
be-lazy/trunk/app
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • be-lazy/trunk/app/Helpers/Config.php

    r2098711 r2098726  
    1313        {
    1414            // Active status
    15             register_setting(BE_LAZY_SLUG, self::get_name('active'), [
    16                 'default' => '1'
    17             ]);
     15            register_setting(BE_LAZY_SLUG, self::get_name('active'));
    1816        }
    1917
  • be-lazy/trunk/app/Helpers/Form.php

    r2098711 r2098726  
    77    class Form
    88    {
    9         public static function radio($base, $key, $value, $label)
     9        public static function radio($base, $key, $value, $default, $label)
    1010        {
    1111            $name = Config::get_name($base . "[$key]");
     
    1313            ob_start();
    1414
    15             checked(Config::get($base)[$key], $value);
     15            $dbvalue = Config::get($base);
     16
     17            if(isset($dbvalue[$key]))
     18            {
     19                checked(Config::get($base)[$key], $value);
     20            }
     21            else
     22            {
     23                checked($default, $value);
     24            }
    1625
    1726            $checked = ob_get_clean();
  • be-lazy/trunk/app/Views/options_page.php

    r2098715 r2098726  
    11<?php
     2
    23    use BeLazy\Helpers\Config;
    34    use BeLazy\Helpers\Form;
     5
    46?>
    57
     
    1719                        <td>
    1820                            <fieldset>
    19                                 <?php Form::radio('active', $post_type->name, '', __('Inactive', 'be-lazy')); ?>
    20                                 <?php Form::radio('active', $post_type->name, '1', __('Automatically', 'be-lazy')); ?>
    21                                 <?php Form::radio('active', $post_type->name, '2', __('Manually', 'be-lazy')); ?>
     21                                <?php Form::radio('active', $post_type->name, '', '1', __('Inactive', 'be-lazy')); ?>
     22                                <?php Form::radio('active', $post_type->name, '1', '1', __('Automatically', 'be-lazy')); ?>
     23                                <?php Form::radio('active', $post_type->name, '2', '1', __('Manually', 'be-lazy')); ?>
    2224                            </fieldset>
    2325                        </td>
Note: See TracChangeset for help on using the changeset viewer.