Wrap comment replies in a collapsible fieldset

I found an article about wrapping all comments (http://scito.ch/content/wrap-comments-collapsible-fieldset), but I just want to wrap comment replies in a collapsible fieldset.

How do I achieve this?

Solutions Collecting From Web of "Wrap comment replies in a collapsible fieldset"

Implement hook_form_alter() or hook_form_FORM_ID_alter() and add the collapsible fieldset to the form field. For example:

function MODULE_form_comment_form_alter(&$form, &$form_state, $form_id) {
    //Create the fieldset
    $form['custom_fieldset'] = array(
        '#type' => 'fieldset',
        '#title' => t('My Collapsible Fieldset'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,

    //Move the field into the fieldset
    $form['custom_fieldset']['comment_body'] = $form['comment_body'];

    //Unset the original field

You can set '#collapsed' => TRUE if you want the fieldset to be closed by default.

If you’re looking for a Module based approach, you may want to look into the Field group project.

I’m not sure how well this module will get along with the Comment module though. You may need to implement hook_form_alter() in a custom module or in your theme.