|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Set the CCK field value the the node is createdHi
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 |
|
|
Re: Set the CCK field value the the node is createdMight 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 --
Brian Vuyk Web Design & Development T: 613-534-2916 Skype: brianvuyk brian@... | http://www.brianvuyk.com |
|
|
Re: Set the CCK field value the the node is createdDavid
I did something similar, I made a constant type that uses either a Form API type of value or hidden. Default value can be set from UI (I think, not sure I tried). I can send you a copy if you like. Steve |
|
|
Re: Set the CCK field value the the node is createdI've done this using the CCK Computed Field.
But I would like to learn more about CCK fields development. And my company give some time to do this... Thanks. David Brian Vuyk 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@... | http://www.brianvuyk.com |
|
|
Re: Set the CCK field value the the node is createdInvestigate 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@...> wrote:
|
|
|
Re: Set the CCK field value the the node is createdI've struggled with doing this, too. I updated some of the CCK
developer documentation on drupal.org to Drupal 6 as I went along figuring things out, but obviously only hit minor bits and pieces. You can look at the source for the moodle module (http://drupal.org/project/moodle) in the moodle.cckfield.inc file for the development code I was last working on to do this a few months ago. It is a very hacked up copy of the computed field code, if I remember correctly. Please, please! -- if anyone figures out any pieces of how CCK works in Drupal 6 -- add documentation below the top-level page at http://drupal.org/node/101742 . The only 2 people who know how it really works are the maintainers, and they're busy working on Drupal 7. ..chris On Mon, Jun 22, 2009 at 12:05 PM, David Hautbois<david.hautbois@...> wrote: > I've done this using the CCK Computed Field. > > But I would like to learn more about CCK fields development. > And my company give some time to do this... > > Thanks. > > David > > Brian Vuyk 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@... | http://www.brianvuyk.com > |
|
|
Re: Set the CCK field value the the node is createdOn Mon, Jun 22, 2009 at 10:44 AM, David Hautbois<david.hautbois@...> wrote:
> I 've look in some others CCK fields, but no one work like this. I believe the Nodereference URL widget module is quite like that: http://drupal.org/project/nodereference_url Hopefully it will give some ideas. Regards, Greg -- Greg Knaddison | 303-800-5623 | http://growingventuresolutions.com Cracking Drupal - Learn to protect your Drupal site from hackers Now available from Wiley http://crackingdrupal.com |
|
|
Re: Set the CCK field value the the node is createdFinaly, I decided to use the computed field.
Thanks All ! David Chris Johnson wrote: > I've struggled with doing this, too. I updated some of the CCK > developer documentation on drupal.org to Drupal 6 as I went along > figuring things out, but obviously only hit minor bits and pieces. > > You can look at the source for the moodle module > (http://drupal.org/project/moodle) in the moodle.cckfield.inc file for > the development code I was last working on to do this a few months > ago. It is a very hacked up copy of the computed field code, if I > remember correctly. > > Please, please! -- if anyone figures out any pieces of how CCK works > in Drupal 6 -- add documentation below the top-level page at > http://drupal.org/node/101742 . > > The only 2 people who know how it really works are the maintainers, > and they're busy working on Drupal 7. > > ..chris > > On Mon, Jun 22, 2009 at 12:05 PM, David Hautbois<david.hautbois@...> wrote: > >> I've done this using the CCK Computed Field. >> >> But I would like to learn more about CCK fields development. >> And my company give some time to do this... >> >> Thanks. >> >> David >> >> Brian Vuyk 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@... | http://www.brianvuyk.com >>> > > |
| Free embeddable forum powered by Nabble | Forum Help |