This small patch modifies the interface to place the excerpt in a fieldset at the bottom of the form. A lot of our clients gave feedback that the teaser textarea was invasive and confusing at the top, so we came up with this solution. A possible upgrade for this patch would be settings options for weight and whether to use a fieldset, but I was unsure if the module maintainer wanted to add that complexity.

CommentFileSizeAuthor
excerpt_fieldset.patch1.16 KBseanbfuller

Comments

davemybes’s picture

Nice idea! Another solution that would reduce work if Excerpt is upgraded, is to put the code in a module - I use zitemod (the z makes the module load last thereby enabling it to override all other modules). The code I used is very similar to yours, except that I want the Excerpt to appear just above the Body area.

/**
 * Modify the Excerpt form, remember to change 'zitemod' to the name of your module
 */

function zitemod_form_alter($form_id, &$form) {
  if ($form_id == "page_node_form") {
    $form['excerptfs'] = array(
      '#type' => 'fieldset',
      '#title' => t('Excerpt'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => -1, // change this number to have Excerpt appear elsewhere in the form; the Body area is weight = 0
    );

    $form['excerptfs']['teaser'] = $form['teaser'];
    unset($form['teaser']);
  }
}
davemybes’s picture

Actually the above code only applies to page nodes. Change the entire "if" line to this:

if ($form_id == $form['type']['#value'] .'_node_form') {

to have it work on all node types.

To exclude certain node types e.g. flexinodes, use this line of code instead:

if ($form_id == $form['type']['#value'] .'_node_form' && !strstr($form_id,'flexinode-')) {

You can change the text 'flexinode-' to anything that you want to exclude e.g. page_ or image_, etc.

hayesr’s picture

Status: Needs review » Fixed

Committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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