From 4e6422c1c13db02bd744625c722096f6ffb1e666 Mon Sep 17 00:00:00 2001 From: Andrzej Piotrowski Date: Mon, 23 Nov 2020 13:07:59 +0100 Subject: [PATCH] fix passing extra data to radio and multi checkbox fields --- Forms.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Forms.php b/Forms.php index 43c4cd1..80637b6 100644 --- a/Forms.php +++ b/Forms.php @@ -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 @@ -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', ) ); @@ -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'] ) ) { @@ -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', ) );