I am working with a module. I have a node id. That node id is a page and it has 2 or more view blocks on it. The results of views are lists of nodes with file attachments.

I need to get all the files attached to the nodes outputted by the view on this particular page.

I work in a module file and I can supply the nid of type page where these views sit.

I could not find much help so I decided to ask for what would be the best way to approach this.

I am new to Drupal so I will appreciate a great explanation on how to approach this.

2 Answers 2


I thought I'd come back and explain my solution. It involves a series of loops through the following: getting regions available for current nid, then the blocks displayed on that nid, then loading each view that has blocks on that nid to obtain access to the fields. I can't provide any code but in theory that's what it involves.

  • Thanks for coming back to let people know how you solved your problem :)
    – Chapabu
    Oct 29, 2012 at 9:24

I had some fields for related documents, and so I added those in a custom field (HTML format to link to my already uploaded documents), and created a view block in the sidebar to grab these fields from the current node. I went here and did what this guy said:

That worked for me.

  • Hello, and welcome to Drupal Answers. May you expand your answer with a summary of what said in the linked page?
    – apaderno
    Oct 20, 2012 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.