Hi,
i just want to change the form field #weight in my theme_preprocess_uc_cart_checkout_form();

something like

mytheme_preprocess_uc_cart_checkout_form($form){
$form['form']['panes']['delivery']['delivery_postal_code']['#weight'] = 50;
...

but thats not possible. After checking some code i add a default #weight to function uc_textfield in file uc_store.module

function uc_textfield($title, $default = NULL, $required = TRUE, $description = NULL, $maxlength = 32, $size = 32) {
  if (is_null($title) || empty($title))
    return NULL;

  $textfield = array(
    '#type' => 'textfield',
    '#title' => $title,
    '#description' => $description,
    '#size' => $size,
    '#maxlength' => $maxlength,
    '#required' => $required,
    '#default_value' => $default,
    '#summary' => $default ? t('@title is %default.', array('@title' => $title, '%default' => $default))
                           : t('@title is not set.', array('@title' => $title)),
	'#weight' => 0,
  );

  return $textfield;
}

and now it is possible to change the #weight too in my theme function

Comments

longwave’s picture

Status: Active » Closed (works as designed)

You can still override #weight even if it wasn't set in the original definition.