Active
Project:
Content Construction Kit (CCK)
Version:
6.x-2.x-dev
Component:
CCK in core
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Feb 2007 at 02:27 UTC
Updated:
16 Mar 2009 at 03:58 UTC
Jump to comment: Most recent file
Comments
Comment #1
eaton commentedUh, this time? I include the patch. :-)
Comment #2
yched commentedIt might be a little early for targetting hook_default_fields for the drupal 6 'cck in core', as it will possibly differ a lot from current CCK (see the FAPi3 discussion on devel ML, and the wiki pages Karen set up from that at http://groups.drupal.org/node/2717), but even without seeing this far, the functionality would be very valuable for the present 5 cycle.
I quickly browsed through the patch without applying, and the refactoring looks nice.
The question of when do we trigger the hook seems more problematic.
Ideally, this would be when the declaring module gets enabled.
But all the required field types might not be available at this time, so the user should be able to enable the required field modules, and have the fields added as well.
So the right time might be on module page submission.
But I guess we also want the user to be able to alter these 'default field definitions' (just like he can alter default module-defined views). If he does, what happens the next time he submits his module page so that his modifications are not overwritten ?
Anyway thanks Jeff for another great patch :-)
Comment #3
karens commentedI haven't actually tried the patch, just looked through it. Conceptually this makes sense. One problem, as yched said, is when to trigger it and how to treat subsequent calls to the hook (overwrite? ignore?). There could be times when you want to overwrite to make sure that your new node type is *not* altered from the 'parent' type and other times when you only want it to happen one time and never again.
Do you have some particular use cases in mind? Maybe thinking through a specific use case would help clarify the best way to work this out.
Comment #4
moshe weitzman commentedsubscribing ... would be nice ...
Comment #5
yched commentedhttp://www.drupal.org/node/142521 has been marked duplicate
Comment #6
mikey_p commentedSubscribing
I really like the way this is laid out, however, I would still like to see a see an import API that could be used from, you guessed it, an Install Profile.
I have a patch thats moving in that direction, but I can't make it work nice without losing existing functionality without duplicating some code from content_copy_import_form_submit(). It can probably be done but I lack the ninja skills to do it.
Any thoughts on hook_default_fields in addition to a content_copy_import API type function?
-Mikey P
Comment #7
mikey_p commentedNevermind....I should really read the patches better.
Looks like content_copy_add_fields_to_type($type_name, $fields) is exactly what I want.
I'll give this some testing but it looks like a big +1 to me. Thanks Eaton
(I really need to spend more time in the issue queue)
Comment #8
eaton commentedI will say, for the record, that I think this approach has a number of issues that make it ... less than ideal as CCK's long-term solution. Better separation of the CRUD functions and the form handling logic is what's ultimately needed.
Comment #9
somebodysysop commentedCan someone explain how to use the new patch functionality?
Let's say I'm creating an installation script for a 5.x module that creates a new node type, and I want to add a simple text (checkboxes) field to the node type I just created. How do I do that?
I was looking for CCK API, that let me to an issue that asked the exact same question, and the answer was to look at this thread. I see the patch, and someone mentioned the function content_copy_add_fields_to_type($type_name, $fields), but I can't find any reference on how to actually use any of it.
Thanks for any assistance.
Comment #10
sirkitree commentedYes this would be very nice functionality; being able to define cck fields within the hook_node_info() something like this:
Comment #11
ben_scott commentedHi - great patch, just what I was looking for. I am having one problem though - if I try to specify a default value for a field, I get the error 'The default value is invalid'. Been playing around with this for a while now but getting nowhere - does anyone know a way round this?
@SomebodySysop - as I understand it, you create an array of field definitions (which you can get from exporting a content type), and return this array from hook_default_fields().
Comment #12
magico commentedCrucial! (subscribing)
Comment #13
darren ohSince I need this for a Drupal 5 project I'm working on, and no one has gotten this committed yet, I'm modifying the issue and assigning it to myself.
Comment #14
darren ohStarting by bringing the patch up to date.
Comment #15
karens commentedBefore you spend a lot of time on this, I want to let you know that all of these things work completely differently in 6.x, so this solution will not be anything that can be ported to 6.x.
Comment #16
darren ohNo reason to wait for Drupal 6. The changes are small, and mostly need better documentation.
Comment #17
joachim commentedSubscribing. This would be a huge addition to CCK and open up tons of possibilities.
What do you mean by better documentation?
If you mean documentation for programmers to use this new feature, I can help. Give me rough notes & bullet points and I can work them up into handbook pages.
Comment #18
Bobuido commentedThis sounds like a great idea - A CCK gallery profile - That would be nice
Until then looks like I have to work it out myself - Which could take some time...
Will be watching this effort closely
Comment #19
juanjo_vlc commentedHI,
I think this feature is a "must have" for content type developers.
For example, I'm developing a large data structure build over smaller ones, and I want to use node references to the small pieces, so it would be great than I can add on the form a node reference like I do with a textfield or button, a simply
or
For the website I'm developing is not a problem, because I can login and add a field using "the mouse way", but it will be harder to distribute the module.
Thanks for your time, and congratulations for your work.
Comment #20
bomarmonk commentedAny update on this functionality for Drupal 6: I would like to have a certain field copy over content automatically from a previous node (of the same type) with the same field.
Comment #21
jlevy commentedI too would like to see this feature in Drupal 6. Could someone please provide a status update on this?
Comment #22
mitchell commentedI reference this issue here: #72509: Expose a "Save content type" action.
Comment #23
jlevy commentedI'm not hearing anything from Darren Oh, so I'm changing the values based on #15.
@Darren Oh - are you still working on this?
Comment #24
darren ohNo.