1

I am using the HomeBox Module which outputs a page with a "Dashboard" like functionality. However I would like to be able to take this functionality from the page and turn it into a block, so that I could then add this functionality to any node/content type I would need.

What I have tried:

Nodes In Block, Node Blocks, Node As Block modules - these modules would do the trick if the page outputted by HomeBox was actually a proper node. In actual fact it cannot be edited as a node and so the additional options the above modules provide are not available in the page edit form.

Views module - when creating a View, I have tried filtering only by the url/path to show everything from the particular HomeBox page url. However this doesn't seem to be possible in Views. Since the page can't be tagged with taxonomy, isn't a content type, and (as far as I know) doesn't have a node id; by specifying the url and showing the page inside a View I could then make a block display and be done. But there doesn't seem to be general path/url filter in Views.

Does anyone have any suggestions as to what else I should try?

  • The title could be improved, as it's a little misleading, at first I thought you want to output a whole page in a block, then as I read through the question I understand that you want to put the blocks on that page outputted to a region? Have you looked at the "Blocks" admin page to see if those blocks are available? – Beebee Jul 27 '12 at 8:31
  • Hi Baysaa, your first thought was correct - the whole page into a new block. The HomeBox module adds drag and drop (and other) functionality to every block you add to its page regions, it doesn't come with any blocks itself. So as normal I can put my blocks into any node I want, but they won't have the functionality unless they are added to this module's page. Because of that I think it would only work if I can somehow put/embed the entire page (with the functionality) into a new block. This would allow me to use this module in a more flexible manner. Any idea as to how to achieve that? – DrupalDesigner Jul 27 '12 at 9:34
2

If you do something like this...

D6:

$foo=menu_execute_active_handler('path/to/the/homebox/page');

D7:

$foo=menu_execute_active_handler('path/to/the/homebox/page', FALSE);

...$foo should include either all of the html or a renderable array of the path/page content in question so in theory you could then stuff that in a block, either via a custom module or (ick) using the standard block interface and the (double ick) php input filter.

MORE THOUGHTS:

My basic thought above was to try to get to the menu handler for the page/path in question with as little custom code as possible. But, if you look in the HomeBox module, all it is doing for each page/path is calling homebox_build() along with a page argument that is easily crafted up. So, if you are comfortable with coding, you could write a custom module that uses that function within its block hooks to create the content.

Also, not sure about any css/js that would be needed but that could be hand crafted I suppose if necessary.

  • Thanks a lot for your help Jimajamma. As you might've guessed from my user name, yes I'm definitely not a programmer by any stretch of the imagination. I couldn't get the php to work inside the block, I turned on the php filter module, set it in the block, and wrapped <?php?> around your snippet.I had better success using firebug and copying the html of the page into the block. Unfortunately it is using a lot of js and so none of the saving functions are working – DrupalDesigner Jul 27 '12 at 14:15
  • Quite welcome. Are you on D6 or D7? If D6 I might have time to hack at this some more but I am still quite naive on D7. – Jimajamma Jul 27 '12 at 14:18
  • D7, as if I were using D6 I'd be considering the Jquery Drag Drop Block Module which has only a D6 version. But at this stage I'm only considering a module which could handle the javascript for me. Something like this: drupal.org/project/cpn Would you know of any modules which allow for customizable blocks/widgets/gadgets for a user? I've tried the Boxes and UserDashboard modules but they're not as good as HomeBox. – DrupalDesigner Jul 27 '12 at 20:57
  • if everything is loading but the js, I'd imagine you could do a drupal_add_js ( api.drupal.org/api/drupal/includes%21common.inc/function/… ) right around/before your custom code. The only js I see (from a quick look) is homebox.js in the module directory – Jimajamma Jul 27 '12 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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