Commit 690edccd authored by Gold's avatar Gold
Browse files

Bug 1916833 - Annotation can be updated on a page

Config gear icon removed from the Annotation blocks.
In order to still initially create these when added we needed to check
if the Block was a new instance or not. To achieve that we are now
passing the block instance into the has_instance_config() method.

BlockInstance has been extended and will set a 'new' parameter if the ID
in the constructor is 0.

AuthPlugin* classes also have the has_instance_config(). These do not
need the BlockInstance passed in.

Change-Id: Ifac69fc1d48b45c079b6f66e610776cead3dee63
parent 34b3b2e1
......@@ -69,7 +69,7 @@ class PluginBlocktypeWall extends MaharaCoreBlocktype {
return $returnstr . $smarty->fetch('blocktype:wall:inlineposts.tpl');
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return false;
}
......
......@@ -182,7 +182,7 @@ class PluginBlocktypeWatchlist extends MaharaCoreBlocktype {
return $views;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -2421,7 +2421,7 @@ class View {
$result = array(
'display' => $display,
);
if (call_static_method(generate_class_name('blocktype', $values['blocktype']), 'has_instance_config')) {
if (call_static_method(generate_class_name('blocktype', $values['blocktype']), 'has_instance_config', $bi)) {
$result['configure'] = $bi->render_editing(true, true);
}
return $result;
......@@ -2549,7 +2549,7 @@ class View {
// Return new block rendered in both configure mode and (editing) display mode
$isnew = (bool)$values['new'];
$result['display'] = $bi->render_editing(false, $isnew);
if (call_static_method(generate_class_name('blocktype', $values['blocktype']), 'has_instance_config')) {
if (call_static_method(generate_class_name('blocktype', $values['blocktype']), 'has_instance_config', $bi)) {
$result['configure'] = $bi->render_editing(true, $isnew);
}
else {
......
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