[development] Set the CCK field value the the node is created

Victor Kane victorkane at gmail.com
Mon Jun 22 17:05:44 UTC 2009


Investigate hook_nodeapi, specifically the insert and update operations,

Victor Kane
http://awebfactory.com.ar
http://projectflowandtracker.com

On Mon, Jun 22, 2009 at 1:50 PM, Brian Vuyk <brian at brianvuyk.com> wrote:

>  Is it something that could be done using a CCK Computed Field? It allows
> the field to be populated using PHP, and had the contents of the other
> fields available to it.
>
> Might be a little simpler than doing something in a module. Unless, of
> course, you don't want it's function accessible from the frontend.
>
> Brian
>
>
> On 06/22/2009 12:44 PM, David Hautbois wrote:
>
> Hi
> I'm developping a custom CCK field for Drupal 6.
> I'm don't want the user set the value himself. So, this field has no
> widget.
>
> I'm looking for how to set the value when the node is saved. (the value is
> set when the node is created et not updated)
> In hook_field, I tried to use 'presave' ou 'validate' for $op, but I've
> some problems to work with it :
> - 'presave' seems to be called when the node is displayed...
> - when the node is created, the field has no value ($items[0]['value'] does
> not exists)
> - ...
>
> I 've look in some others CCK fields, but no one work like this.
>
> I copied the text_field CCK field, renamed all 'text_field' references,
> simplified it and removed the widget.
>
> Can someone help me or point me to a good web page ? (not the CCK dev
> documentation !, I read it many times!)
>
> Thanks.
>
> David
>
>
>
> --
> *Brian Vuyk*
> Web Design & Development
> T: 613-534-2916
> Skype: brianvuyk
> brian at brianvuyk.com | http://www.brianvuyk.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/development/attachments/20090622/6682abf5/attachment.htm>


More information about the development mailing list