update hooks/APIs documentation
Hello, Is there documentation somwhere about the update hooks and APIs. I tried to understand them from reading the code. And write some myself, but found this too hard, to do withou the solid understanding of the actual code. I guess that an example module upgrade script will suffice, for now. Is anything already online? Does such an example exist? Bèr
Hi, Bèr. Assuming nothing's much changed with the interface in the last couple weeks, I made a sample .install file for the Amazon associate tools module here: http://drupal.org/files/issues/amazon_0.install (I assume here you are talking about this issue: http://drupal.org/node/35924) Hope it helps, -Angie Bèr Kessels wrote:
Hello,
Is there documentation somwhere about the update hooks and APIs. I tried to understand them from reading the code. And write some myself, but found this too hard, to do withou the solid understanding of the actual code.
I guess that an example module upgrade script will suffice, for now.
Is anything already online? Does such an example exist?
Bèr
Okay, I think it's time to work the 4.7 update for Amazon Associate Tools (I'm stuck on the node previews, so I'm studying the image module...) The .install file will need work...the field names for a MySQL are being lowercased as well because I'm only supporting one codebase. On 1/2/06, Angie Byron <drupal-devel@webchick.net> wrote:
Hi, Bèr.
Assuming nothing's much changed with the interface in the last couple weeks, I made a sample .install file for the Amazon associate tools module here:
http://drupal.org/files/issues/amazon_0.install
(I assume here you are talking about this issue: http://drupal.org/node/35924)
Hope it helps,
-Angie
Bèr Kessels wrote:
Hello,
Is there documentation somwhere about the update hooks and APIs. I tried to understand them from reading the code. And write some myself, but found this too hard, to do withou the solid understanding of the actual code.
I guess that an example module upgrade script will suffice, for now.
Is anything already online? Does such an example exist?
Bèr
If there's anything I can do to help, it's an itch I'd like to scratch. I'm a bit fuzzy on some of the module's internal workings, but I'd like to help if you need a hand updating. In particular, I'd like to put together a simple 'amazon filter' that would let users insert an amazon item's cover image and a clickable link by entering [asin:1234567890] in a node body. --Jeff -----Original Message----- From: Earl Dunovant [mailto:prometheus6@gmail.com] Sent: Thursday, January 05, 2006 1:18 PM To: development@drupal.org Subject: Re: [development] update hooks/APIs documentation Okay, I think it's time to work the 4.7 update for Amazon Associate Tools (I'm stuck on the node previews, so I'm studying the image module...) The .install file will need work...the field names for a MySQL are being lowercased as well because I'm only supporting one codebase.
My current task is figuring out how to properly do the preview when the form is built BEFORE validation or or submit hooks are invoked and neither hook has access to the node object, nor do the node validation, insert and update hooks have access to the form object. And this is my first look at image.module, which is suggested as an example. It's weird...I had less problems with the bulk import form. On 1/5/06, Jeff Eaton <jeff@viapositiva.net> wrote:
If there's anything I can do to help, it's an itch I'd like to scratch. I'm a bit fuzzy on some of the module's internal workings, but I'd like to help if you need a hand updating. In particular, I'd like to put together a simple 'amazon filter' that would let users insert an amazon item's cover image and a clickable link by entering [asin:1234567890] in a node body.
--Jeff
-----Original Message----- *From:* Earl Dunovant [mailto:prometheus6@gmail.com] *Sent:* Thursday, January 05, 2006 1:18 PM *To:* development@drupal.org *Subject:* Re: [development] update hooks/APIs documentation
Okay, I think it's time to work the 4.7 update for Amazon Associate Tools (I'm stuck on the node previews, so I'm studying the image module...)
The .install file will need work...the field names for a MySQL are being lowercased as well because I'm only supporting one codebase.
I noticed that a lot of the heavy lifting for the moduel is done in validate, including the actual population of the node object with the amazon item information. The only thing I can think of off the top of my head is to: Retrieve the amazon data from scratch whenever a preview is built, based on the known ASIN value. use the 'Validate' hook to establish whether the asin(s) are valid but do NOT save, then retrieve the amazon data again and actually save it on submit. It would entail more round-trips to amazon, but it would work cleanly unless I'm missing something. Anyone? Thoughts? Corrections? Maybe you're already past that point and I'm just echoing. :) Validate did a LOT of heavy lifting in the old forms system, and that's been reduced with the new api. It requires reworking some steps in more complicated modules. --Jeff -----Original Message----- From: Earl Dunovant [mailto:prometheus6@gmail.com] Sent: Friday, January 06, 2006 4:31 PM To: development@drupal.org Subject: Re: [development] update hooks/APIs documentation My current task is figuring out how to properly do the preview when the form is built BEFORE validation or or submit hooks are invoked and neither hook has access to the node object, nor do the node validation, insert and update hooks have access to the form object. And this is my first look at image.module, which is suggested as an example. It's weird...I had less problems with the bulk import form.
It definitely needs reworking. But my problem is, on preview it goes: 1 - execute amazon_form(&$node) 2 - execute amazon_node_form_validate($form_id, &$form_values) with NO access to $node 3 - execute amazon_view($node) with NO access to $form_values 4 - execute amazon_node_form_validate($form_id, &$form_values) AGAIN, with NO access to $node I suppose I could toss a copy of $form_values into a global variable but that's something I actively try to avoid, to make debugging easier. Once I figure this out, I'll work with you on your filter. On 1/6/06, Jeff Eaton <jeff@viapositiva.net> wrote:
I noticed that a lot of the heavy lifting for the moduel is done in validate, including the actual population of the node object with the amazon item information. The only thing I can think of off the top of my head is to:
Retrieve the amazon data from scratch whenever a preview is built, based on the known ASIN value. use the 'Validate' hook to establish whether the asin(s) are valid but do NOT save, then retrieve the amazon data again and actually save it on submit. It would entail more round-trips to amazon, but it would work cleanly unless I'm missing something. Anyone? Thoughts? Corrections? Maybe you're already past that point and I'm just echoing. :)
Validate did a LOT of heavy lifting in the old forms system, and that's been reduced with the new api. It requires reworking some steps in more complicated modules.
--Jeff
-----Original Message----- *From:* Earl Dunovant [mailto:prometheus6@gmail.com] *Sent:* Friday, January 06, 2006 4:31 PM *To:* development@drupal.org *Subject:* Re: [development] update hooks/APIs documentation
My current task is figuring out how to properly do the preview when the form is built BEFORE validation or or submit hooks are invoked and neither hook has access to the node object, nor do the node validation, insert and update hooks have access to the form object. And this is my first look at image.module, which is suggested as an example.
It's weird...I had less problems with the bulk import form.
On Fri, 2006-01-06 at 17:58 -0500, Earl Dunovant wrote:
It definitely needs reworking. But my problem is, on preview it goes:
1 - execute amazon_form(&$node) 2 - execute amazon_node_form_validate($form_id, &$form_values) with NO access to $node 3 - execute amazon_view($node) with NO access to $form_values 4 - execute amazon_node_form_validate($form_id, &$form_values) AGAIN, with NO access to $node
I suppose I could toss a copy of $form_values into a global variable but that's something I actively try to avoid, to make debugging easier.
I think form_values is already in the global scope. I've used global $form_values when I needed it...
You're right...I started looking into form.inc last night. On 1/7/06, Darrel O'Pry <dopry@thing.net> wrote:
On Fri, 2006-01-06 at 17:58 -0500, Earl Dunovant wrote:
I suppose I could toss a copy of $form_values into a global variable but that's something I actively try to avoid, to make debugging easier.
I think form_values is already in the global scope. I've used global $form_values when I needed it...
Bèr Kessels wrote:
Is there documentation somwhere about the update hooks and APIs. I tried to understand them from reading the code. And write some myself, but found this too hard, to do withou the solid understanding of the actual code.
I guess that an example module upgrade script will suffice, for now.
Is anything already online? Does such an example exist?
hook_update_N() is documented in contrib/docs/developer/hooks/update.php. Drupaldocs seems to have troubles picking up changes (among other things). I'd like to use API.module locally to test these things before posting to controb docs; has anyone updated it to HEAD yet? -- Neil Drumm http://delocalizedham.com/
participants (6)
-
Angie Byron -
Bèr Kessels -
Darrel O'Pry -
Earl Dunovant -
Jeff Eaton -
Neil Drumm