Commit 6c0d6a84 authored by Robert Lyon's avatar Robert Lyon

Bug 1805517: Allow special profile/dashboard blocks in edit for templates

Currently when setting up a dashboard/profile template we can't
add/re-add certain blocks if they have been deleted

behatnotneeded

Change-Id: I2bd95b1fb67357994b2ff43356387b18b0644d97
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 5cab2815
...@@ -138,7 +138,7 @@ class PluginBlocktypeInbox extends MaharaCoreBlocktype { ...@@ -138,7 +138,7 @@ class PluginBlocktypeInbox extends MaharaCoreBlocktype {
* Inbox only makes sense for personal views * Inbox only makes sense for personal views
*/ */
public static function allowed_in_view(View $view) { public static function allowed_in_view(View $view) {
return $view->get('owner') != null; return in_array($view->get('type'), self::get_viewtypes());
} }
/** /**
......
...@@ -148,7 +148,7 @@ class PluginBlocktypeMyfriends extends MaharaCoreBlocktype { ...@@ -148,7 +148,7 @@ class PluginBlocktypeMyfriends extends MaharaCoreBlocktype {
* Myfriends only makes sense for personal views * Myfriends only makes sense for personal views
*/ */
public static function allowed_in_view(View $view) { public static function allowed_in_view(View $view) {
return $view->get('owner') != null; return in_array($view->get('type'), self::get_viewtypes());
} }
public static function override_instance_title(BlockInstance $instance) { public static function override_instance_title(BlockInstance $instance) {
......
...@@ -155,7 +155,7 @@ class PluginBlocktypeMyGroups extends MaharaCoreBlocktype { ...@@ -155,7 +155,7 @@ class PluginBlocktypeMyGroups extends MaharaCoreBlocktype {
* Mygroups only makes sense for personal views * Mygroups only makes sense for personal views
*/ */
public static function allowed_in_view(View $view) { public static function allowed_in_view(View $view) {
return $view->get('owner') != null; return in_array($view->get('type'), self::get_viewtypes());
} }
public static function override_instance_title(BlockInstance $instance) { public static function override_instance_title(BlockInstance $instance) {
......
...@@ -123,7 +123,7 @@ class PluginBlocktypeMyviews extends MaharaCoreBlocktype { ...@@ -123,7 +123,7 @@ class PluginBlocktypeMyviews extends MaharaCoreBlocktype {
* Myviews only makes sense for personal views * Myviews only makes sense for personal views
*/ */
public static function allowed_in_view(View $view) { public static function allowed_in_view(View $view) {
return $view->get('owner') != null; return in_array($view->get('type'), self::get_viewtypes());
} }
public static function override_instance_title(BlockInstance $instance) { public static function override_instance_title(BlockInstance $instance) {
......
...@@ -307,7 +307,7 @@ EOF; ...@@ -307,7 +307,7 @@ EOF;
* Wall only makes sense on profile viewtypes * Wall only makes sense on profile viewtypes
*/ */
public static function allowed_in_view(View $view) { public static function allowed_in_view(View $view) {
return $view->get('type') == 'profile'; return in_array($view->get('type'), self::get_viewtypes());
} }
public static function override_instance_title(BlockInstance $instance) { public static function override_instance_title(BlockInstance $instance) {
......
...@@ -272,7 +272,7 @@ class PluginBlocktypeWatchlist extends MaharaCoreBlocktype { ...@@ -272,7 +272,7 @@ class PluginBlocktypeWatchlist extends MaharaCoreBlocktype {
* Watchlist only makes sense for personal views * Watchlist only makes sense for personal views
*/ */
public static function allowed_in_view(View $view) { public static function allowed_in_view(View $view) {
return $view->get('owner') != null; return in_array($view->get('type'), self::get_viewtypes());
} }
public static function should_ajaxify() { public static function should_ajaxify() {
......
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