Discussion:
nodeapi data flow
(too old to reply)
Eric-Alexander Schaefer
2008-09-07 18:19:42 UTC
Permalink
Hi list,

are there any docs describing the data flow for
creating/editing/previewing nodes (hook_nodeapi)?

Thanks,
Eric
FGM
2008-09-07 18:29:58 UTC
Permalink
Maybe you are looking for something like http://drupal.org/node/112180 ?


----- Original Message -----
From: "Eric-Alexander Schaefer" <***@eas-consulting.de>
To: <***@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
Eric-Alexander Schaefer
2008-09-07 19:06:06 UTC
Permalink
Post by FGM
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
Greg Knaddison - GVS
2008-09-07 19:36:12 UTC
Permalink
On Sun, Sep 7, 2008 at 1:06 PM, Eric-Alexander Schaefer
Post by FGM
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
Eric-Alexander Schaefer
2008-09-07 21:33:09 UTC
Permalink
Post by Greg Knaddison - GVS
http://api.drupal.org/api/function/hook_nodeapi
But it only tells you _what_, not _when_ or _how_.

Thanks,
Eric
Khalid Baheyeldin
2008-09-07 22:50:47 UTC
Permalink
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.
Matthew Farina
2008-09-07 23:17:22 UTC
Permalink
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.
Post by Khalid Baheyeldin
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.
Steve Edwards
2008-09-07 23:34:28 UTC
Permalink
There's one for node access on page 104 of the first Pro Drupal Development, and 157 and 162 on the second edition.

Steve
Post by Matthew Farina
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.
Post by Khalid Baheyeldin
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.
Earnie Boyd
2008-09-08 11:26:50 UTC
Permalink
Post by Eric-Alexander Schaefer
Post by FGM
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/
Eric-Alexander Schaefer
2008-09-22 17:32:59 UTC
Permalink
Post by Earnie Boyd
Post by Eric-Alexander Schaefer
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

Continue reading on narkive:
Loading...