Hi all,

This is driving me a bit mad, as I can't see why this isn't working - it's a form function called in the usual way in a preprocess function using drupal_get_form(); ... it renders the fieldset no problem, but ignores the #collapsible item. Form code is:

function image_title_menu_router_form() {
  $item = menu_get_item();
  
  //load any existing file data
  $image_title = db_fetch_array(db_query('SELECT image FROM {image_title_menu} WHERE path = "%s"', $item['path']));   
  $picture = theme('image_title', $image_title['image']);
  
  $collapsed = TRUE;
  if ($picture) {
    $collapsed = FALSE;
  }

  $form = array();
  $form['menu_router_item'] = array(
    '#type' => 'value',
    '#value' => $item,
  );
  $form['#attributes']['enctype'] = 'multipart/form-data';
  
  $form['image_title_upload'] = array(
    '#type' => 'fieldset',
    '#title' => t('Title image'),
    '#collapsible' => TRUE,
    //'#collapsed' => $collapsed,
  );
  $form['image_title_upload']['image_title_upload'] = array(
    '#type' => 'file',
    '#title' => t('Attach title image'),
	'#size' => 40,
  );

  if ($picture) {
    //show the image
    $form['image_title_upload']['current_title_image'] = array('#value' => $picture);
    //set the delete flag
    $form['image_title_upload']['image_title_delete'] = array(
      '#type' => 'checkbox',
      '#default_value'=> 0,
      '#title' => t('Delete title image.'),
    ); 
  }
  
  $form['image_title_upload']['submit'] = array(
    '#value' => t('Save title image settings'),
    '#type' => 'submit',
  );
  
  return $form;
}

Comments

ainigma32’s picture

Status: Active » Postponed (maintainer needs more info)

I'm not sure but maybe it only works if you add both #collapsed and #collapsible

Please post back your findings.

- Arie

greg.harvey’s picture

Hmm, I'd forgotten all about this and it's working now - will take a look what changed.

ainigma32’s picture

Status: Postponed (maintainer needs more info) » Fixed

Looks like greg.harvey won't be posting any feedback so I'm setting this to fixed.

Feel free to reopen if you you think that is wrong.

- Arie

greg.harvey’s picture

Sure - sorry ... I'm away now and I really can't figure out what "fixed" it, but it is fixed. Apologies I can't provide more info. =(

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.