Would be nice to load contents of menuparent item using ajax to save page load time. As users will not always expend the menu items so I think loading all blocks on page load could cause performance hit. Some guy here: http://www.pga.com/home/ have added ajax support for menu contents but seems like they are using custom hacks for implementing this.

CommentFileSizeAuthor
#1 ajaxloadcontent-1927772-0.patch4.52 KBinders

Comments

inders’s picture

Issue tags: +block
StatusFileSize
new4.52 KB

Adding patch for above mentioned functionality. Tested on local instance.

@cam8001 , ccan you please review and test it?

cameron tod’s picture

Thanks for the patch! Will review :)

cameron tod’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, ajaxloadcontent-1927772-0.patch, failed testing.

cameron tod’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs work » Needs review
cameron tod’s picture

#1: ajaxloadcontent-1927772-0.patch queued for re-testing.

cameron tod’s picture

Title: Ajax Support for loading menu contents? » Load block content via AJAX
Assigned: inders » Unassigned
Status: Needs review » Fixed

This a great patch, and makes a lot of sense as a feature. I've done a little bit of code cleanup so that it meets Drupal coding standards, and commited it with attribution. So, thanks!

Before it gets rolled into a release, I think we need to work out a way to have a non AJAX fallback. I think we'd need to reload the whole page with the block rendered if JS wasn't available. Then we could maybe set a session variable so on the next time the page is loaded, the block is rendered inline. I want to avoid that if we can, as it breaks caching.

Another thing that is kind of interesting is permissions - I need to refresh my understanding of that.

I will take a look when I get some time.

inders’s picture

Issue tags: +JavaScript, +caching, +$_SESSION

For JS disabled case ... What about displaying the block contents inside a Iframe..? In that case I think we can avoid the mess with $_SESSION variable an Drupal caching..?

For permission thing.. I think we already taking care of it inside "menu_attach_block_load_from_key" function..? As we are using standard module_invoke for loading the block content , the permissions should work normally.

If we are talking about permission based on menu item then I think "menu_per_role" if good module for that.?

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