Un-hijacked from #367498: Introduce 'display' as a way to group and reuse instance and formatter settings..

Per context-weight raises the question of the explosion of settings in the UI. #367498: Introduce 'display' as a way to group and reuse instance and formatter settings. has a proposal to make this more manageable, but it might very well no see the light in time.
Field API should at least support per-context weights. At worst, the UI just sets the same weight everywhere.

- The form weight should be a widget setting, since it's only for the form.

- We could have a top-level instance weight, as we do now, and instead of explicitly setting a weight for the form and each context, instead assume they will all be the same unless they are overridden, so we would add a 'weight_override' setting to the widget and each context instead of a 'weight' for each. If there is no override, we use the default weight.

- We should change the way that 'weight' works now and have the Field module use the weight from the correct context when it displays the field and creates the form. That way context-sensitive weights could be implemented immediately by modules using the API. And CCK can start out by using the same weight for everything, as it does now, and allow users to set different weights later when the UI is improved.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yched’s picture

Patch.

I found that a "global" $instance['weight'] + additional $instance['widget']['weight_override'], $instance['display'][$build_mode]['weight_override'] were in fact a little confusing, so I went for no global weight, only per-context weights.

yched’s picture

Status: Active » Needs review
FileSize
8.87 KB

Copy/paste error in field.test

bjaspan’s picture

Status: Needs review » Reviewed & tested by the community

This patch *looks* fine to me but as you say there is no real way to test it. I say we commit it, which will force some updates to the CCK UI patch, then we can test it visually.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Ok, let's do it. Committed to HEAD.

Status: Fixed » Closed (fixed)

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