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
......@@ -149,8 +149,17 @@ class PluginBlocktypeAnnotation extends MaharaCoreBlocktype {
return $html;
}
public static function has_instance_config() {
return true;
/**
* Once created annotations should not be editable.
*
* @param BlockInstance $instance
* With this being a static we need to pass this in.
*
* @return boolean
* Return true/false based on if this is a new block.
*/
public static function has_instance_config(BlockInstance $instance) {
return $instance->is_new();
}
public static function instance_config_form(BlockInstance $instance) {
......
......@@ -124,7 +124,7 @@ class PluginBlocktypeBlog extends MaharaCoreBlocktype {
return $result;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -96,7 +96,7 @@ class PluginBlocktypeBlogpost extends MaharaCoreBlocktype {
return $artefacts;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -168,7 +168,7 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype {
return $result;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -363,7 +363,7 @@ class PluginBlocktypeTaggedposts extends MaharaCoreBlocktype {
", array($USER->id));
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -113,7 +113,7 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype {
return $html;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return false;
}
......
......@@ -102,7 +102,7 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype {
return $files;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -148,7 +148,7 @@ class PluginBlocktypeFolder extends MaharaCoreBlocktype {
}
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -598,7 +598,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
}
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -60,7 +60,7 @@ class PluginBlocktypeHtml extends MaharaCoreBlocktype {
return $smarty->fetch('blocktype:html:html.tpl');
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -78,7 +78,7 @@ class PluginBlocktypeImage extends MaharaCoreBlocktype {
return $smarty->fetch('blocktype:image:image.tpl');
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -80,7 +80,7 @@ class PluginBlocktypeInternalmedia extends MaharaCoreBlocktype {
return $smarty->fetch('blocktype:internalmedia:internalmedia.tpl');
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -134,7 +134,7 @@ class PluginBlocktypePdf extends MaharaCoreBlocktype {
return $smarty->fetch('blocktype:pdf:pdfrender.tpl');
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -168,7 +168,7 @@ class PluginBlocktypeProfileinfo extends MaharaCoreBlocktype {
return $return ? $return : false;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -80,7 +80,7 @@ class PluginBlocktypeSocialprofile extends MaharaCoreBlocktype {
return $smarty->fetch('blocktype:socialprofile:content.tpl');
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -318,7 +318,7 @@ jQuery(function() {
EOF;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -97,7 +97,7 @@ class PluginBlocktypePeerassessment extends MaharaCoreBlocktype {
return $html;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -90,7 +90,7 @@ class PluginBlocktypeSignoff extends MaharaCoreBlocktype {
return $html;
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -158,7 +158,7 @@ class PluginBlocktypePlans extends MaharaCoreBlocktype {
}
// My Plans blocktype only has 'title' option so next two functions return as normal
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
return true;
}
......
......@@ -60,7 +60,7 @@ class PluginBlocktypeEntireresume extends MaharaCoreBlocktype {
return $smarty->fetch('blocktype:entireresume:content.tpl');
}
public static function has_instance_config() {
public static function has_instance_config(BlockInstance $instance) {
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