JoeSz / Exopite-Simple-Options-Framework

Fast, easy and lightweight admin options/metabox form generator for WordPress Plugins and metaboxes.
GNU General Public License v3.0
78 stars 24 forks source link

The 'button' element is not overwriting the default options #16

Closed justinpicard closed 5 years ago

justinpicard commented 5 years ago

I added a 'button' element type to my website options page. The button shows in the options page, but the defaults are not being overwritten, so I cant give the button an own URL, value etc.

I noticed this field was also not present in the Plugin Boilerplate example.

array(
    'type'      => 'button',
    'title'     => __( 'Launch', 'textdomain' ),
    'href'      => admin_url( "/index.php?page=setup-wizard" ),
    'value'     => __( 'Unleash the magic!', 'textdomain' ),
),
JoeSz commented 5 years ago

You have to add the href to the options array.

array(
    'id'            => 'some_button',
    'type'          => 'button',
    'title'         => esc_html__( 'Some button', 'something' ),
    'options'       => array(
        'value'         => esc_html__( 'Button', 'something' ),
        'href'          => '/your-url',
        'target'        => '_blank', //optional
    ),
    // below all are optional
    'info'          => ' some info',
    'after'         => ' some after',
    'before'        => ' some before',
    'help'          => ' some help',
    'description'   => 'Some description',
),