[development] node_feed vs. node_build_content vs. nodeapi alter op

Jeff Eaton jeff at viapositiva.net
Sat Jan 20 04:35:12 UTC 2007


you're VERY right. in a nutshell, the things you're describing are 
regrettable cruft I didn't have time to roll patches for in version 5. 
In drupal 6, what I'd REALLY like to see is the elimination of nodeapi's 
'view' and 'alter' hooks entirely, mapping them to a separate 
hook_node_alter(). Why? Nodeapi is horribly overloaded (horribly!). When 
we have params like $a3, $a4, and $a5, and they mean different things 
for each op, it's a sign. ;)

As everything moves into #keyed arrays (forms, node bodies, profiles? 
mail? etc), using standard methods of altering, then rendering, the same 
structures in different contexts will bring us huge benefits.

RSS feeds, print-friendly output, and standard node output need to share 
the same rendering path. That's another one of my 6.0 to-dos. So. If 
you're interested... let's talk. Let's patch ;)

--Jeff Eaton

Gabor Hojtsy wrote:
> Hi,
> I in migrating weblabor.hu from Drupal 4.6 to 5.0 and found two
> interesting issues in node building for rss and website view.
> When the website view is generated in node_view(), then 
> node_build_content() prepares the formapi-like array structure, which 
> calls the view nodeapi hook. There is *very similar* code in 
> node_feed(), only except that it does not remove the <!--break--> 
> delimiter for some reason. This might be some leftover cruft, and 
> node_build_content() should be reused there. I would submit a patch if 
> verified.
> More interesting is the usage of the 'alter' nodeapi hook. It is 
> called when a node is disaplyed on the web (from node_view()), but is 
> not called from node_feed(), when a node is displayed in a feed.
> Now I can use this differenece to alter my nodes differently in web 
> mode and rss mode (ie. I would like to have my upload related filters 
> activate on the web, but only remove the special tags when I generate 
> RSS). But seemingly this difference is a bug. Isn't the 'alter' 
> nodeapi hook supposed to be used both in web mode and rss mode?
> Gabor

More information about the development mailing list