CCK Field UI support for term fields

bangpound - June 14, 2009 - 08:17
Project:Content Construction Kit (CCK)
Version:7.x-2.x-dev
Component:General
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

This patch lets CCK support term.module fields in nodes. See #491190: Provide a taxonomy term field type for that patch.

(I don't expect this to be committed necessarily, but I do want to make the patch available for others to test with.)

AttachmentSize
cck-term-field-support.patch1.8 KB

#1

bangpound - June 14, 2009 - 08:40

#2

bangpound - June 15, 2009 - 09:08
Title:CCK Field UI support for term.module fields» CCK Field UI support for vocabularies as lists

DO NOT USE THIS PATCH. Use the original one attached to this issue.

AttachmentSize
cck-term-field-support.patch 2.13 KB

#3

bangpound - July 6, 2009 - 06:56
Status:needs work» needs review

This patch adds support to CCK Field UI for taxonomy term fields. A field's allowed values can be the terms in a single vocabulary or the combination of multiple vocabularies.

AttachmentSize
cck-term-field-support.patch 1.82 KB

#4

yched - July 6, 2009 - 12:57

Thanks bangpound.
To all, note that we need #488542: Tie Field UI pages to any fieldable entity in to make CCK HEAD UI available on taxo terms.

+  $widget_type = $instance['widget']['type'];
+  $field_type = $field['type'];
+  $label = $instance['label'];

Those variables don't seem to be used anywhere ?

+  // Get the right values for allowed_values_function, which is a core setting.
+  $defaults = field_info_field_settings($field['type']);
+  $settings = array_merge($defaults, $field['settings']);

Shouldn't be needed when #509736: Make sure all settings are present at run time gets in. I think it's safe to remove now, we don't want field-type modules code to be littered with "if(!isset($settings['foo']))" or "merge in default settings"...

That's more a question for #491190: Provide a taxonomy term field type, but I'm not sure having a taxo field span over several vocabs is a good idea. [edit: besides, this patch mentions $settings['vid'] (singular)]

#5

bangpound - July 6, 2009 - 13:14

Eek! Thanks for checking this out yched. I thought I had caught all the $settings['vid'] strings that hadn't been changed to arrays. I'll chase these down today.

#6

bangpound - July 11, 2009 - 00:20
Title:CCK Field UI support for vocabularies as lists» CCK Field UI support for term fields

Here's a new patch.

The 'parent' setting is forced to 0 for now. That's the essential functionality but not the full range of possibility.

AttachmentSize
cck-term-field-support.patch 1.78 KB

#7

yched - July 11, 2009 - 00:35
Status:needs review» active

Committed so that people can more easily test #491190: Provide a taxonomy term field type. Thanks bangpound !

Note: this form lets you change existing entries in $field['settings']['allowed_values'], but not remove them or or add a new one...
Might be a little tricky :-(

Thus, leaving 'active' for now.

#8

bangpound - July 11, 2009 - 13:23

Thanks yched. I'll post a new patch after #491190: Provide a taxonomy term field type lands. The goal of this patch was to let users configure a field for one vocabulary without destroying settings that may have been created otherwise... though I'll admit, it has not been rigorously tested for those stranger cases yet.

 
 

Drupal is a registered trademark of Dries Buytaert.