Commit 204bd5b2 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Limit AJAX loading to DB-heavy blocks"

parents 747c74ac e350a077
......@@ -182,4 +182,7 @@ class PluginBlocktypeInbox extends SystemBlocktype {
return get_string('inboxblocktitle');
}
public static function should_ajaxify() {
return true;
}
}
......@@ -123,17 +123,17 @@ abstract class PluginBlocktype extends Plugin implements IPluginBlocktype {
* improves page-load times by allowing blocks to be rendered in parallel instead
* of in serial.
*
* You might want to disable this for:
* You should avoid enabling this for:
* - Blocks with particularly finicky Javascript contents
* - Blocks that need to write to the session (the Ajax loader uses the session in read-only)
* - Blocks that won't take long to render (static content, external content)
* - Blocks that use hide_title_on_empty_content() (since you have to compute the content first
* in order for that to work)
*
* @return boolean
*/
public static function should_ajaxify() {
// If we want to hide the title if there is empty content, then we need to compute
// the content first, and we cant' do that if we're using AJAX.
return !static::hide_title_on_empty_content();
return false;
}
/**
......
......@@ -67,4 +67,8 @@ class PluginBlocktypeNewViews extends SystemBlocktype {
public static function get_instance_title(BlockInstance $instance) {
return get_string('title', 'blocktype.newviews');
}
public static function should_ajaxify() {
return true;
}
}
......@@ -206,4 +206,8 @@ class PluginBlocktypeRecentForumPosts extends SystemBlocktype {
}
return get_string('title', 'blocktype.recentforumposts');
}
public static function should_ajaxify() {
return true;
}
}
......@@ -98,4 +98,7 @@ class PluginBlocktypeWatchlist extends SystemBlocktype {
return $view->get('owner') != null;
}
public static function should_ajaxify() {
return true;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment