Permalink
Browse files

If choose in module settings one preset only, not display combobox on…

… "Image details" screen, add hidden element to form. Many setting options for user no good if can't be changed this settings...
  • Loading branch information...
1 parent ea7dfc7 commit d4874ceaaae36d2c52f4d476d3d130b0d82a472e @EliteMonk EliteMonk committed with Eugen Mayer Feb 12, 2011
Showing with 14 additions and 6 deletions.
  1. +14 −6 wysiwyg_imageupload.form.inc
@@ -209,12 +209,20 @@ function _wysiwyg_imageupload_details_form($img, $iid, $defaults = array()) {
'#after_build' => array('drupalwiki_imageselect_element_register'),
);
// Imagecache preset
- $form['image_upload_details']['imagecache'] = array(
- '#type' => 'select',
- '#title' => t('Size'),
- '#default_value' => $defaults['imagecache'],
- '#options' => _wysiwyg_imagegupload_allowed_presets(),
- );
+ $ic_options = _wysiwyg_imagegupload_allowed_presets();
+ if (count($ic_options) == 1) {
+ $form['image_upload_details']['imagecache'] = array(
+ '#type' => 'hidden',
+ '#value' => array_pop($ic_options),
+ );
+ } else {
+ $form['image_upload_details']['imagecache'] = array(
+ '#type' => 'select',
+ '#title' => t('Size'),
+ '#default_value' => $defaults['imagecache'],
+ '#options' => $ic_options,
+ );
+ }
// We group all those extras into this fieldset to hide them from the general UI.
$form['image_upload_details']['extras'] = array(

0 comments on commit d4874ce

Please sign in to comment.