Permalink
Browse files

radio list for image sizes

  • Loading branch information...
1 parent f74defe commit eb1050763acd0d3cc5e8833510ea733337dfc158 @piffpaffpuff committed May 10, 2012
Showing with 8 additions and 9 deletions.
  1. +8 −9 class-projects-writepanel.php
@@ -84,8 +84,9 @@ public function edit_media_options($form_fields, $post) {
}
// build the selection
- $html .= '<select class="image-size-select" name="' . $form_name . '">';
- $html .= '<option class="image-size-item" value="" ' . selected($meta_size, null, false) . '>' . __('None', 'projects') . '</option>';
+ $html .= '<div class="image-size-item"><input type="radio" name="' . $form_name . '" id="projects-default-image-size-none" value="" ' . checked($meta_size, null, false) . ' />';
+ $html .= '<label for="projects-default-image-size-none">' . __('None', 'projects') . '</label>';
+ $html .= '</div>';
// go through all sizes and generate the fields
foreach($image_sizes as $image_size) {
@@ -100,18 +101,17 @@ public function edit_media_options($form_fields, $post) {
}
// add the item to the list
- $html .= '<option class="image-size-item" name="' . $form_name . '" value="' . $image_size . '" ' . selected($meta_size, $image_size, false) . ' ' . disabled($enabled, false, false) . '>' . ucfirst($image_size);
+ $html .= '<div class="image-size-item"><input type="radio" name="' . $form_name . '" id="' . $css_id . '" value="' . $image_size . '" ' . checked($meta_size, $image_size, false) . ' ' . disabled($enabled, false, false) . ' />';
+ $html .= '<label for="' . $css_id . '">' . ucfirst($image_size) . '</label>';
// only show the dimensions if that choice is available
if($enabled) {
- $html .= ' ' . sprintf('(%d &times; %d)', $downsize[1], $downsize[2]);
+ $html .= '<label for="' . $css_id . '" class="help">'.sprintf('(%d &times; %d)', $downsize[1], $downsize[2]).'</label>';
}
- $html .= '</option>';
+ $html .= '</div>';
}
-
- $html .= '</select>';
-
+
$form_fields['projects_default_image_size']['label'] = __('Default Size', 'projects');
$form_fields['projects_default_image_size']['input'] = 'html';
$form_fields['projects_default_image_size']['html'] = $html;
@@ -127,7 +127,6 @@ public function save_media_options($post, $attachment) {
// $attachment part of the form $_POST ($_POST[attachments][postID])
// $post attachments wp post array - will be saved after returned
// $post['post_type'] == 'attachment'
- print_r($attachment);
if(empty($attachment['projects_default_image_size'])) {
delete_post_meta($post['ID'], '_projects_default_image_size');
} else {

0 comments on commit eb10507

Please sign in to comment.