https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114636
Revision: 114636
Author: yaron
Date: 2012-03-30 22:13:57 +0000 (Fri, 30 Mar 2012)
Log Message:
-----------
Replaced <span> tag around individual options in 'radiobutton' and 'checkboxes'
inputs with a <label> tag, to make HTML more "semantic" - based on a patch by
Andru
Modified Paths:
--------------
trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php
trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php
Modified:
trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php
===================================================================
--- trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php
2012-03-30 21:23:40 UTC (rev 114635)
+++ trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php
2012-03-30 22:13:57 UTC (rev 114636)
@@ -30,10 +30,10 @@
public static function getHTML( $cur_value, $input_name, $is_mandatory,
$is_disabled, $other_args ) {
global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
- $checkbox_class = ( $is_mandatory ) ? 'mandatoryField' :
'createboxInput';
- $span_class = 'checkboxSpan';
+ $checkboxClass = ( $is_mandatory ) ? 'mandatoryField' :
'createboxInput';
+ $labelClass = 'checkboxLabel';
if ( array_key_exists( 'class', $other_args ) ) {
- $span_class .= ' ' . $other_args['class'];
+ $labelClass .= ' ' . $other_args['class'];
}
$input_id = "input_$sfgFieldNum";
// get list delimiter - default is comma
@@ -55,8 +55,7 @@
array_key_exists( 'value_labels', $other_args )
&&
is_array( $other_args['value_labels'] ) &&
array_key_exists( $possible_value,
$other_args['value_labels'] )
- )
- {
+ ) {
$label =
$other_args['value_labels'][$possible_value];
} else {
$label = $possible_value;
@@ -65,7 +64,7 @@
$checkbox_attrs = array(
'id' => $input_id,
'tabindex' => $sfgTabIndex,
- 'class' => $checkbox_class,
+ 'class' => $checkboxClass,
);
if ( in_array( $possible_value, $cur_values ) ) {
$checkbox_attrs['checked'] = 'checked';
@@ -75,9 +74,10 @@
}
$checkbox_input = Html::input( $cur_input_name,
$possible_value, 'checkbox', $checkbox_attrs );
- // Make a span around each checkbox, for CSS purposes.
- $text .= "\t" . Html::rawElement( 'span',
- array( 'class' => $span_class ),
+ // Put a <label> tag around each checkbox, for CSS
+ // purposes as well as to clarify this element.
+ $text .= "\t" . Html::rawElement( 'label',
+ array( 'class' => $labelClass ),
$checkbox_input . ' ' . $label
) . "\n";
$sfgTabIndex++;
Modified:
trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php
===================================================================
--- trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php
2012-03-30 21:23:40 UTC (rev 114635)
+++ trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php
2012-03-30 22:13:57 UTC (rev 114636)
@@ -57,7 +57,7 @@
}
}
- $text = '';
+ $text = "\n";
$itemClass = 'radioButtonItem';
if ( array_key_exists( 'class', $other_args ) ) {
$itemClass .= ' ' . $other_args['class'];
@@ -91,7 +91,7 @@
$label = $possible_value;
}
- $text .= "\t" . Html::rawElement( 'span', $itemAttrs,
+ $text .= "\t" . Html::rawElement( 'label', $itemAttrs,
Html::input( $input_name, $possible_value,
'radio', $radiobutton_attrs ) . " $label" ) . "\n";
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs