### Eclipse Workspace Patch 1.0 #P drupal_testing5.3 Index: sites/all/modules/excerpt/excerpt.module =================================================================== RCS file: /cvs/drupal/contributions/modules/excerpt/excerpt.module,v retrieving revision 1.6 diff -u -r1.6 excerpt.module --- sites/all/modules/excerpt/excerpt.module 30 Dec 2005 17:31:10 -0000 1.6 +++ sites/all/modules/excerpt/excerpt.module 16 Nov 2007 21:38:45 -0000 @@ -1,6 +1,34 @@ 'admin/settings/excerpt', + 'title' => t('Excerpt'), + 'description' => t('Set weight option for excerpts on edit pages.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('excerpt_admin_settings'), + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, // optional + ); + } + return $items; +} + + + function excerpt_help($section) { switch ($section) { case 'admin/modules#description': @@ -26,7 +54,7 @@ function excerpt_form_alter($form_id, &$form) { if (isset($form['type'])) { $node = $form['#node']; - + if ($form['type']['#value'] .'_node_settings' == $form_id) { $form['excerpt'] = array('#type' => 'fieldset', '#title' => t('Excerpt')); $form['excerpt']['excerpt_options_'. $form['type']['#value']] = array( @@ -37,7 +65,7 @@ '#description' => t('Choose whether teasers are generated automatically or can be entered manually by the author.') ); } - + if ($form['type']['#value'] .'_node_form' == $form_id && variable_get('excerpt_options_'. $node->type, 1)) { $form['teaser'] = array( '#type' => 'textarea', @@ -45,10 +73,37 @@ '#default_value' => $node->teaser, '#cols' => 60, '#rows' => 5, - '#weight' => -17.5, + '#weight' => variable_get("excerpt_weight", FALSE), + '#required' => variable_get("excerpt_required", FALSE), '#description' => t('Enter an excerpt for this item. It will be shown on listing pages along with a read more link which leads to the full view. Leave empty to auto-generate one from the body.') ); } - + } -} \ No newline at end of file +} + +/** + * Module configuration settings + * @return settings HTML or deny access + */ +function excerpt_admin_settings() { + +//Set the weight of the form fieldset + $form['excerpt_weight'] = array('#type' => 'weight', + '#title' => t('Weight'), + '#default_value' => variable_get("excerpt_weight", FALSE), + '#description' => t('In listings, the heavier items will sink and the lighter ones will be positioner nearer the top.'), + '#required' => FALSE, + ); + + $form['excerpt_required'] = array('#type' => 'checkbox', + '#title' => t('Require excerpt field to be filled in'), + '#default_value' => variable_get("excerpt_required", FALSE), + '#description' => t('Require excerpt?'), + '#required' => FALSE, + '#weight' => 0, + ); + + + return system_settings_form($form); +}