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
14 changes: 13 additions & 1 deletion src/SemanticFormsSelectInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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\"";
Expand Down