Hi there,

I really love Node Hierarchy and I also love the idea of displaying the Children as a separate tab in the parent's node.

Although the default Children list may be sufficient in some cases, in my case I see a major limitation. I have picture-type of nodes as children and I want to show them in a gallery-style page instead of the default list style.

I can easily configure a view that shows thumbnails for the child pictures along with the default operations (kindly provided by you as a separate field) but here come the troubles:

1) I don't see how can I replace the existing Children list (hard-coded as an extension to the theme as far as I understand Drupal internals) with the new view

2) Even if I succeed doing that, the new view would not have the link(s) at the bottom prompting for creation of new children

So my suggestion for a feature is to:
- make the children list entirely views-based and let the admin users configure the view to suit their needs
- Add some options to the Node Hierarchy configuration that control which view will be used for which parent node type
- Add an option that controls whether to place a tab-link for the children list in the parent node or not
- Add an option whether to show a "Add new child"-type of link at the bottom of the list

Comments

ronan’s picture

Thanks for the feedback, these are some great ideas.

I did originally use a view for the children list, but later decided to reproduce the functionality by hand in order to eliminate the requirement of the views module. I should perhaps bring it back as an option in the way you describe.

Until I get around to doing so, I wonder if there is a workaround you could use. I'm no views expert, but it may be possible to produce most of what you're looking for without writing any code. As you say creating the view is simple enough, it's putting a tab on the node page which could be tricky. There may be a way using the menu feature of views and a clever use of the url settings for your view to make the tabs appear on your nodes.

Thanks again for the suggestions

Ronan

kirilius’s picture

Thanks a lot! In the meantime I played more with this module and came up with the following setup:

1) Removed the Children tab from your implementation of hook menu
2) Created a view that shows my children-pictures as thumbnails and added the actions field to it
3) Used Panels 2 to show that view in a panel and added another small sub-panel below it that shows the "Add a new children" link in it. For this I had to make a call to the function you provided.
4) Gave that panel a URL "node/%/pictures" and wrote my own implementation of hook menu to add that as a tab for a specific type of nodes only
5) Modified the code that displays the node hierarchy actions so that they are not displayed at all if the user doesn't have the rights to use them. In my opinion these actions shouldn't get in the way if a non-privileged user looks at the children page.

Some up sides and some down sides:
- For (1) I had to mess with your code and do my changes directly in it. Not good if I have to upgrade later - I will be forced to make my changes again in your code.
- For (2) - views are really powerful and I really liked that you provided views-integration ;-)
- For (3) - I could have used a simple view instead with the "node/%/pictures"-type of URL but for some reason the breadcrumbs get broken (if I try to make the view an integral part of a node). Panels 2 obviously have better support for breadcrumbs and it works for me. Also it gives me better control on the layout.
- For (4) - I wrote a simple module to create a children tab but for now that's as far as my Drupal-coding skills go. I would prefer to have a configuration page where I will be able to say: "Show view XXX as a tab under nodes of type YYY and label the tab ZZZ"
- For (5) - finding what piece of your code to modify was hard. And again - an option or two that control the display of these things would be very helpful.

I hope that will give you some ideas and help you make Node Hierarchy better. I am new to Drupal development and don't actually know PHP but I have a wealth of experience in IT, web applications, etc. so if you need some help, let me know. I'll try to do my best.

ronan’s picture

Wow, sounds like you've gone a long way to solving this.

A couple of thoughts occurred to me that may help you avoid modifying node hierarchy.

If you use 'node/%/children' instead of 'node/%/pictures', the views module might be able to coopt that address and thereby getting rid of the nh tab. I believe this will depend on the order the modules are loaded though.

You can also control the display of the actions by implementing theme_nodehierarchy_actions in your theme. If you put your access check in there, you may be able to avoid that edit. No actions should show up if the user does not have access to that action, so let me know if that's not happening.

Thanks for sharing your solution.
Ronan

dgorton’s picture

Status: Active » Closed (fixed)

Closing as is very old issue about very old code. Please re-open if still relevant!