From e83a5b40058a52d456372ff82df4fec83b570242 Mon Sep 17 00:00:00 2001 From: Vedmaka Date: Thu, 12 Dec 2019 12:18:07 +0300 Subject: [PATCH] Adds parameter support --- src/SemanticFormsSelectInput.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/SemanticFormsSelectInput.php b/src/SemanticFormsSelectInput.php index f873781..2e95f18 100644 --- a/src/SemanticFormsSelectInput.php +++ b/src/SemanticFormsSelectInput.php @@ -75,7 +75,7 @@ public function getHtmlText() { * @return string */ public function getHTML( $cur_value = "", $input_name = "", $is_mandatory, $is_disabled, Array $other_args ) { - global $sfgFieldNum, $wgUser; + global $sfgFieldNum, $wgUser, $wgPageFormsShowOnSelect, $wgPageFormsFieldNum; // shortcut to the SelectField object $selectField = $this->mSelectField; @@ -131,6 +131,18 @@ public function getHTML( $cur_value = "", $input_name = "", $is_mandatory, $is_d if ( array_key_exists( "class", $other_args ) ) { $classes[] = $other_args['class']; } + $sfgFieldNum = $sfgFieldNum ? $sfgFieldNum : $wgPageFormsFieldNum; + $input_id = "input_$sfgFieldNum"; + if ( array_key_exists( 'show on select', $other_args ) ) { + $classes[] = 'pfShowIfSelected'; + foreach ( $other_args['show on select'] as $div_id => $options ) { + if ( array_key_exists( $input_id, $wgPageFormsShowOnSelect ) ) { + $wgPageFormsShowOnSelect[$input_id][] = array( $options, $div_id ); + } else { + $wgPageFormsShowOnSelect[$input_id] = array( array( $options, $div_id ) ); + } + } + } if ( $classes ) { $cstr = implode( " ", $classes ); $extraatt .= " class=\"$cstr\"";