I'd like to create a view of top-level nodes in a node-hierarchy. for example, say my hierarchical structure is:

Top1
-Mid1
--Bott1
Top2
-Mid2

Then I'd like to show only Top1 and Top2 in the view. I can't find any solution to this in the filters/arguments that nodehierarchy.module adds to the views-building interface, is there something I'm missing? If not, consider it a feature request for more filters/argument-handling code for nodehierachy.module. I'd be happy to create a patch to add the filters I'm needing currently, but i'm a bit of a views_api newb so if you could point me to the hook i should be working with...

Comments

ronan’s picture

Status: Active » Fixed

Top level items should have a parent id of 0, so if you add the argument 'nodehirarchy parent id' to your view and in the argument php section add the following code:

return array(0);

You should have the effect you're looking for. Should be a fairly easy argument or filter to write though, so if you do create a patch I'll certainly consider adding it to the module. For examples of the hooks needed to implement a view argument, check out the nodehierarchy_views.module source code from this module.

All the best
Ronan

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

mosesdog’s picture

Component: User interface » Drupal/PHP Code
Issue summary: View changes

Is there a way to do this in D7? I'm looking to display only Parent Nodes by content type in a view and for the life of me can't find a filter that works...