I'm trying to modify my Drupal 4.6 in order to use an existing XML-format as input for nodes. I've successfully managed to impement a working filter.
In the XML there is allready a tag used to specify a teaser. To be able to extract the teaser from the XML I'v implemented hook_nodeapi to manipulate the $node->teaser as done in excerpt module.
It seems that all I need to do is to set $node->teaser ="Whatever I exctract from the XML..." in the switch ($op) ... case 'validate':
I've tried to track down what happens and here is what I can find out:
For node preview:
a) First hook_nodeapi $op == 'load' is called (if node already exist)
b) Next hook_nodeapi $op == 'validate' is called and $node->teaser is set.
c) Next hook_filter case 'prepare' is called with $text == my teaser as expected.
d) Now hook_nodeapi $op == 'view' is called. I guess this is a hook for the preview of the teaser.
e) Ok, so far so good. But next hook_filter is called again, but this time $text is empty!
I would expect $text to be set to the body of the node.
Any suggestion to what I'm doing wrong?
Currently I don't use the teaser features that comes with drupal, I'v done my own node-list generating functions. As a workarround, I could probably generate the teaser on-the-fly when needed. So as long as the teaser can be generated from the body, there should be no need (unless for speed) to store the teaser separately in the DB. On the other hand, if you do something similar to what is done in module exceprt (a separate input-field for the teaser) the node.teaser field is very handy. Is there any other reasons to have a seprate teaser field?