Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,9 @@ class scbRadiosField extends scbSelectField {
* @return string
*/
protected function _render_specific( $args ) {
$args = wp_parse_args( $args, array(
'extra' => array(),
) );

if ( array( 'foo' ) === $args['selected'] ) {
// radio buttons should always have one option selected
Expand All @@ -857,6 +860,7 @@ protected function _render_specific( $args ) {
'type' => 'radio',
'value' => $value,
'checked' => ( $value == $args['selected'] ),
'extra' => $args['extra'],
'desc' => $title,
'desc_pos' => 'after',
) );
Expand Down Expand Up @@ -895,6 +899,7 @@ protected function _render( $args ) {
$args = wp_parse_args( $args, array(
'numeric' => false, // use numeric array instead of associative
'checked' => null,
'extra' => array(),
) );

if ( ! is_array( $args['checked'] ) ) {
Expand All @@ -908,6 +913,7 @@ protected function _render( $args ) {
'type' => 'checkbox',
'value' => $value,
'checked' => in_array( $value, $args['checked'] ),
'extra' => $args['extra'],
'desc' => $title,
'desc_pos' => 'after',
) );
Expand Down