Commits

Doug Stewart committed f082a10

imageradio -- go!

Comments (0)

Files changed (1)

includes/functions/admin.php

 		 
 			lblg_option_wrapper_footer( $value );
 			break;
-		
+			
+			// Prints a series of radio <input> buttons using images instead of HTML radio checks
+			case "imageradio":
+			add_settings_field( $key, $value['name'], '', $lblg_options_group, $section );			
+			lblg_option_wrapper_header( $value );
+			if( $value['options'] === array_values($value['options'])){
+		 		foreach ( $value['options'] as $option ) {
+						$radio_setting = $lblg_options[$key];
+						$tmp_name = $lblg_options_group . '['. $key . ']';
+						$input_name = $option['input'];
+						$input_img = $option['image'];
+						echo sprintf( '<label class="lbimageradio"><input type="radio" name="%s" value="%s" %s /><img src="%s" /></label>', $tmp_name, $input_name, checked( $option, $options[$key], false ), $input_img) . "\n";
+			    		//echo "<label class=\"lbimageradio\"><input type=\"radio\" name=\"$tmp_name\" value=\"$option\"" . checked( $option, $options[$key], false ) . " />$option</label>\n";
+				}
+			} else {
+		 		foreach ( $value['options'] as $opt_key => $opt_value ) {
+						$radio_setting = $lblg_options[$key];
+						$tmp_name = $lblg_options_group . '['. $key . ']';
+						echo "Oops";
+			    		echo "<input type=\"radio\" name=\"$tmp_name\" value=\"$opt_key\"" . checked( $opt_key, $options[$key], false ) . " />$opt_value<br />\n";
+				}
+			}
+		 
+			lblg_option_wrapper_footer( $value );
+			
+			break;
 			// Prints a checbox <input> element
 			case "checkbox":
 			add_settings_field( $key, $value['name'], '', $lblg_options_group, $section );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.