Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.x-dev
Component:
General
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
6 Sep 2008 at 15:50 UTC
Updated:
20 Sep 2008 at 22:01 UTC
Jump to comment: Most recent file
Comments
Comment #1
yched commentedOops, patch missing, I hit 'Submit' instead of 'attach'.
So, here's the patch, I committed it after checking all forms + content copy work ok, and tests are still green.
Comment #2
karens commentedNot a bad idea, but all the modules using drupal_execute() on the admin form to create fields (I think there may be a lot of them) will be broken, so we should announce this to developers or at least make it more obvious that this has changed.
Comment #3
yched commentedShouldn't they be advised to use CRUD functions instead ?
Comment #4
karens commentedSure, but people love drupal_execute(), both module developers and individuals writing their own custom PHP snippets -- look at all the drupal_execute-related bugs I found in the issue queue, and many of them were in the D6 version.
I continually get drupal_execute bugs in Date and Calendar and when I say "don't use drupal_execute" they point to all kinds of articles that have written all over the place that recommend it as the "most reliable method" for doing things like creating fields and importing data. It's hard to overcome that.
We should write up some documentation on the use of the API, but who has time :(
Comment #5
yched commentedHmm - well, people are going to be even more surprised if/when #234774: Use Webform's UI for field addition lands and removes the old 'add field' / 'add group' forms :-/
Creating fields through drupal_execute() in D6 is sort of an heresy, which I'd happily declare 'unsupported', but it's true that the CRUD api kind of lacks a user doc.
Not only that, but every field module / widget would need to document their own specific properties in the field and widget definition arrays, dos and don'ts...
Can we really say more than 'play with the result of content_field_instance_read(),and start trial-and-error from there' ?
The output of content_field_instance_read() gives an example of a $field definition array to be fed to content_field_instance_create(), problem is it also comes with internal stuff ('db_storage', 'active', 'columns'...), that are confusing, and that content_field_instance_[create|update]() take care of filling anyway.
Maybe we need a wrapper content_field_instance_get() or something, that would remove the internal cruft ?
Well, I'm drifting away, this probably deserves a separate tasK...
Comment #6
yched commentedI added a note in CHANGELOG for now.
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.