Download & Extend

Field weight per context

Project:Drupal core
Version:7.x-dev
Component:field system
Category:task
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

Comments

#1

Status:active» needs review

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.

AttachmentSizeStatusTest resultOperations
field_weight_per_context.patch8.85 KBIdlePassed: 12086 passes, 0 fails, 0 exceptionsView details

#2

Copy/paste error in field.test

AttachmentSizeStatusTest resultOperations
field_weight_per_context-529756-2.patch8.87 KBIdlePassed: 12115 passes, 0 fails, 0 exceptionsView details

#3

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.

#4

Status:reviewed & tested by the community» fixed

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

#5

Status:fixed» closed (fixed)

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

nobody click here