Skip to content

Commit

Permalink
Add term data and callback to select in sample config. Add 'global_va…
Browse files Browse the repository at this point in the history
…riable' entry.

Signed-off-by: Kevin Provance <kevin.provance@gmail.com>
  • Loading branch information
kprovance committed Jul 28, 2021
1 parent 6fa7168 commit d889866
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sample/sample-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
'admin_bar_priority' => 50,

// Sets a different name for your global variable other than the opt_name.
'global_variable' => '',
'global_variable' => $opt_name,

// Show the time the page took to load, etc. (forced on while on localhost or when WP_DEBUG is enabled).
'dev_mode' => true,
Expand Down
42 changes: 42 additions & 0 deletions sample/sections/select-fields/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,23 @@
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
),
array(
'id' => 'opt-select-terms',
'type' => 'select',
'data' => 'terms',
'title' => esc_html__( 'Terms Select Option', 'your-textdomain-here' ),
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
),
array(
'id' => 'opt-multi-select-terms',
'type' => 'select',
'data' => 'terms',
'multi' => true,
'title' => esc_html__( 'Terms Multi Select Option', 'your-textdomain-here' ),
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
),
array(
'id' => 'opt-select-menus',
'type' => 'select',
Expand Down Expand Up @@ -237,6 +254,31 @@
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
),
array(
'id' => 'opt-select-callback',
'type' => 'select',
'data' => 'callback',
'args' => 'redux_select_callback',
'title' => esc_html__( 'Select Option using a Callback', 'your-textdomain-here' ),
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
'desc' => esc_html__( 'The items in this selcect were added via a callback function.', 'your-textdomain-here' ),
),
),
)
);

/**
* Select callback function.
*
* @return array
*/
function redux_select_callback(): array {
$options = array();

$options[0] = esc_html__( 'Zero', 'your-textdomain-here' );
$options[1] = esc_html__( 'One', 'your-textdomain-here' );
$options[2] = esc_html__( 'Two', 'your-textdomain-here' );
$options[3] = esc_html__( 'Three', 'your-textdomain-here' );

return $options;
}

0 comments on commit d889866

Please sign in to comment.