Needs review
Project:
CCK Date Testsite
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Nov 2008 at 12:05 UTC
Updated:
30 Nov 2008 at 13:19 UTC
Jump to comment: Most recent file
Comments
Comment #1
dwwHrm, I have no idea how signup is going to behave with a multi-valued date field. :( I know this might sound crazy, but I'm tempted to say that we should have another set of 15 node types where the date fields are multi-valued. Or, perhaps a configuration knob (if possible) to select if you want all your types to be single or multi valued?
Makes me think it'd be nice if there was an easier way to programatically setup these node types and field configurations, instead of having to click them all together once and export them to a .inc file. I don't suppose there are any plans for adding a date_create_cck_field($settings); function in the API, where the $settings array lets you select the key properties, e.g.:
You could also specify
'multiple' => '1'in there if you wanted, etc. Looking more closely, I guess that's sort of what content_field_instance_create() does, but there's a ton of other logic in content_copy_import_form_submit() that seems all mixed in...Maybe I could simplify the content_types/*.inc files and rip out all the lines that just represent default values. After that, maybe those files will look more like my $settings array above, and then it'll basically be all I need. Then, it'd be easy with a little shell hacking to quickly generate other content type permutations without manually going through the CCK UI.
Comment #2
karens commentedA multi-value field that currently only has one value should behave the same as what you already have, it just makes it possible to create additional fields.
I'm not sure what signup will do with multi-value fields that have more than one value, but I think we discussed that in the signup patch (or maybe that was just when it has more than one date field). Either way, you do want to be sure signup will work correctly with multi-value fields anyway, and making that change will allow you to test it.
I agree it would be nice to have more flexibility in the way this works. For D5, this is as good as it's going to get. For D6 we have the CCK API and we can create fields with that instead of trying to use Content Copy and it should give us as much flexibility as we need. But of course you'll end up with completely different code in the two versions.
Comment #3
karens commentedI've created a patch to make this totally configurable by using the API in content.crud.inc instead of Content Copy. In cckdatetest_create_content_types() you'll see that it will create every possible combination of date type, widget type, and timezone handling, and it is set up so you can comment out anything you don't want to create in your profile.
It works, but does time out if you try to do everything, so it may need some batching added in.
I also added in some things that make this (IMO) a better test bed. All the date formats are set up to display the timezone as well as date and time to make it more clear what they are. Multiple values are turned on, so if you use devel_generate to create more date nodes you can test multiple value dates. It provides a way to add repeating date fields (by uncommenting the repeating date widgets). And it adds a way to turn the Devel module query logging on.
Comment #4
karens commentedI've done some more work on this and added lines for each configurable date option so you can easily see exactly what values you can alter. It makes it easy to create profiles that will test specific configurations. This patch also includes the bugfix I posted elsewhere to move the setting of the date timezone before creating the fields.
And I added settings for the site format strings along with the site timezone.
Comment #5
karens commentedA couple of the new settings weren't working quite right, here's a re-roll of the previous patch.