Closed (fixed)
Project:
Viewfield
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 Jul 2011 at 20:58 UTC
Updated:
4 Jan 2014 at 01:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sunAlso, much more important would be to validate that there is actually a default value... ;)
Comment #2
sunAdded the missing validation for a default value to #1221440: Bogus default value in field widget
However, I still think the validation on field cardinality is obsolete, since we're replacing the field values upon rendering in the meantime.
Comment #3
sunComment #4
keithm commentedThe problem in removing this is that force_default == TRUE really only makes sense to the user for a single value. If we allow multiple values but allow force_default == TRUE, we're "allowing" something that can never happen; the field edit elements are hidden and the user can't add any more values anyway.
This looks good.
Comment #5
sunwell, this is partially related to #1230534: allowed_views should be an instance setting, not a field setting -- depending on the field storage engine being used, the field cardinality may be set in stone after initial creation of a field, and cannot be re-configured. That is, because an optimized field storage engine like http://drupal.org/project/pbs could rightfully decide to "join" the field values of multiple fields into a single table, as long as they are not multiple (and not translatable) -- basically what CCK was doing by default in D6.
However, the force_default option shouldn't have any impact on the field's schema, nor its values. I think a site admin should be able to enable and disable it at any time -- the only impact is that the field's default value is directly used for rendering.
And since #1207552: Use instance defaults when "Always use default value" is checked, we are no longer really fiddling with the actual field values if force_default is enabled. On view/render, all fields values are simply replaced with the default value of the field widget.
Lastly, note that I learned today that field_ui_default_value_widget() itself does not support multiple default values for a field widget, so as long as core doesn't support it, we can't support it either.
Am I overlooking something?
Comment #6
keithm commentedThere is a patch in the works for #1230534: allowed_views should be an instance setting, not a field setting so that's not an issue any more.
I ran some tests with your patch and everything behaves itself better than I had expected. Turning on force_default nondestructively replaces the field contents with the single default, even when there is a saved multiple-valued field. Turning it off again of course restores the saved values.
Looks good to go.
Comment #7
keithm commentedCommitted: http://drupalcode.org/project/viewfield.git/commit/01cd538.