Hi list, are there any docs describing the data flow for creating/editing/previewing nodes (hook_nodeapi)? Thanks, Eric
Maybe you are looking for something like http://drupal.org/node/112180 ? ----- Original Message ----- From: "Eric-Alexander Schaefer" <eric.schaefer@eas-consulting.de> To: <development@drupal.org> Sent: Sunday, September 07, 2008 8:19 PM Subject: [development] nodeapi data flow Hi list, are there any docs describing the data flow for creating/editing/previewing nodes (hook_nodeapi)? Thanks, Eric
FGM schrieb:
Maybe you are looking for something like http://drupal.org/node/112180 ?
No. I want to know with which $op's hook_nodeapi() is called and the state of the node data during the call. E.g.: When the user clicks "preview", hook_nodeapi() is called with $op='validate'. $node contains all the fields from the form in unprocessed state. I am trying to fix a bug in scheduler.module. The user enters a time and date for a node to be published automatically (like "2008-09-10 10:00:00). On $op=='validate' the entered string is converted to a timestamp if $node->publish_on is nonnumeric (eg a string). The same is done on $op=='presave'. Works like a charm, except if the user clicks "preview" a second time. I don't know why. The form processing should be the same as for the first preview. Maybe I need to dig into node.module and find out which functions are called and which how the node data is processed. Sleep is overrated anyway. ;-) Thanks, Eric
On Sun, Sep 7, 2008 at 1:06 PM, Eric-Alexander Schaefer <eric.schaefer@eas-consulting.de> wrote:
FGM schrieb:
Maybe you are looking for something like http://drupal.org/node/112180 ?
No. I want to know with which $op's hook_nodeapi() is called and the state of the node data during the call.
At least for me http://www.google.com/search?q=hook_nodeapi finds the best resource on the topic: http://api.drupal.org/api/function/hook_nodeapi The resources at http://api.drupal.org are great for things like this. Regards, Gre -- Greg Knaddison Denver, CO | http://knaddison.com | 303-800-5623 Growing Venture Solutions, LLC | http://growingventuresolutions.com
Greg Knaddison - GVS schrieb:
But it only tells you _what_, not _when_ or _how_. Thanks, Eric
You may want to try the trace module http://drupal.org/project/trace It will show you what hooks are being called, but perhaps not the arguments to the hooks. For that, you can get xdebug installed, and use an IDE that supports PHP and xdebug tracing. -- Khalid M. Baheyeldin 2bits.com, Inc. http://2bits.com Drupal optimization, development, customization and consulting.
Using xdebug or trace seems like a little overkill for many things. I think this highlights that we are missing some nice flow diagrams for when hooks and actions are taking place when a drupal page is created. On Sep 7, 2008, at 6:50 PM, Khalid Baheyeldin wrote:
You may want to try the trace module http://drupal.org/project/trace
It will show you what hooks are being called, but perhaps not the arguments to the hooks.
For that, you can get xdebug installed, and use an IDE that supports PHP and xdebug tracing. -- Khalid M. Baheyeldin 2bits.com, Inc. http://2bits.com Drupal optimization, development, customization and consulting.
There's one for node access on page 104 of the first Pro Drupal Development, and 157 and 162 on the second edition. Steve Matthew Farina wrote:
Using xdebug or trace seems like a little overkill for many things.
I think this highlights that we are missing some nice flow diagrams for when hooks and actions are taking place when a drupal page is created.
On Sep 7, 2008, at 6:50 PM, Khalid Baheyeldin wrote:
You may want to try the trace module http://drupal.org/project/trace
It will show you what hooks are being called, but perhaps not the arguments to the hooks.
For that, you can get xdebug installed, and use an IDE that supports PHP and xdebug tracing. -- Khalid M. Baheyeldin 2bits.com <http://2bits.com>, Inc. http://2bits.com Drupal optimization, development, customization and consulting.
Quoting Eric-Alexander Schaefer <eric.schaefer@eas-consulting.de>:
FGM schrieb:
Maybe you are looking for something like http://drupal.org/node/112180 ?
No. I want to know with which $op's hook_nodeapi() is called and the state of the node data during the call. E.g.: When the user clicks "preview", hook_nodeapi() is called with $op='validate'. $node contains all the fields from the form in unprocessed state.
I am trying to fix a bug in scheduler.module. The user enters a time and date for a node to be published automatically (like "2008-09-10 10:00:00). On $op=='validate' the entered string is converted to a timestamp if $node->publish_on is nonnumeric (eg a string). The same is done on $op=='presave'. Works like a charm, except if the user clicks "preview" a second time. I don't know why. The form processing should be the same as for the first preview. Maybe I need to dig into node.module and find out which functions are called and which how the node data is processed. Sleep is overrated anyway. ;-)
Is it possible that the FAPI #validated is set to TRUE so that validate is no longer executed? Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Earnie Boyd schrieb:
I am trying to fix a bug in scheduler.module. The user enters a time and date for a node to be published automatically (like "2008-09-10 10:00:00). On $op=='validate' the entered string is converted to a timestamp if $node->publish_on is nonnumeric (eg a string). The same is done on $op=='presave'. Works like a charm, except if the user clicks "preview" a second time. I don't know why. The form processing should be the same as for the first preview. Maybe I need to dig into node.module and find out which functions are called and which how the node data is processed. Sleep is overrated anyway. ;-)
Is it possible that the FAPI #validated is set to TRUE so that validate is no longer executed?
I dug a bit deeper now. I got it all confused. The second preview works, but if the node was already posted and is then edited again the preview looses the data: ($op==validate) gets called and does what it is supposed to do. At the end of ($op=='view') $node->publish_on has the right content, but it does not show in the form. It always shows the value that was posted. Any ideas? Thanks, Eric
participants (7)
-
Earnie Boyd -
Eric-Alexander Schaefer -
FGM -
Greg Knaddison - GVS -
Khalid Baheyeldin -
Matthew Farina -
Steve Edwards