Drupal 5 zwiekszenie zakresu wag w menu

I used both patches posted above, but to clarify I will repeat the code modifications with a bit more info.

1

Find this code around line 1494 in /includes/form.inc:

function process_weight($element) {
  for ($n = (-1 * $element['#delta']); $n <= $element['#delta']; $n++) {
    $weights[$n] = $n;
  }
  $element['#options'] = $weights;
  $element['#type'] = 'select';
  $element['#is_weight'] = TRUE;
  return $element;
}

and replace/modify to match this:

function process_weight($element) {
  $element['#delta'] = 100; //Change this value to whatever you like
  for ($n = (-1 * $element['#delta']); $n <= $element['#delta']; $n++) {
    $weights[$n] = $n;
  }
  $element['#options'] = $weights;
  $element['#type'] = 'select';
  $element['#is_weight'] = TRUE;
  return $element;
}

2

Find this code around line 440 in /modules/taxonomy/taxonomy.module

  $form['weight'] = array(
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#default_value' => $edit['weight'],
    '#description' => t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.'));

and replace/modify it to match:

  $form['weight'] = array(
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#default_value' => $edit['weight'],
    '#delta' => 100, //Change this number to the value you chose in step 1
    '#description' => t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.'));

3

Find this code around line 175 in /modules/cck/content_admin.inc

  if (is_array($value) && (isset($value['#weight']) || $key == 'body_filter') && $value['#weight'] <= 10) {

and replace/modify to match:

  if (is_array($value) && (isset($value['#weight']) || $key == 'body_filter') && $value['#weight'] <= 100) {

Notice the value at the end,.. I changed from 10 to 100,.. so that all the fields and groups with a weight higher than 10 will be shown when editing them.

4 Final Step

Here comes the tricky part.

You will probably need to change all the default weight values to something higher.

I downloaded my entire web dir and opened it in TextMate (a powerful text editor for the mac, Ultra Edit works well for windows) and did a global search & replace.

I searched for: ‘#weight’ => 25 and replaced with: ‘#weight’ => 65 adding 40 to the initial weight. You must do this for all the default values.

I would suggest starting at the highest weight value: 100 and working your way down so you don’t enter an infinite loop :). I found that 100 was used as the maximum and it seemed to skip the range until 50. You don’t need to search for every incremental value, but the key ones seem to be numbers divisible by 5 (25, 30 etc) and numbers ending in 9.

Be careful modifying weights around and below 10. I’d suggest doing this on a per instance basis.

Oh and of course, always backup your code before changing -anything- :) Login or