Commit e006bdf9 authored by Eugene Venter's avatar Eugene Venter Committed by Richard Mansfield
Browse files

Implement default artefact render_self method & allow blocktypes to disable...

Implement default artefact render_self method & allow blocktypes to disable title links (bug #617159)
parent 29fc9513
......@@ -674,6 +674,21 @@ abstract class ArtefactType {
}
/**
* A dummy method, giving graceful output, if this method is not implemented in the relevant child class
*/
public function render_self($options) {
$smarty = smarty();
$smarty->assign('viewtitle', $this->get('title'));
$smarty->assign('viewdescription', $this->get('description'));
return array(
'html' => $smarty->fetch('view/viewcontent.tpl'),
'javascript'=>''
);
}
/**
* Returns a URL for an icon for the appropriate artefact
*
......
......@@ -363,6 +363,19 @@ abstract class PluginBlocktype extends Plugin {
return false;
}
/**
* Defines if the title should be linked to an artefact view (if possible)
* when viewing the block
*
* This method should be overridden in the child class, if a title link
* is not desired.
*
* @return boolean whether to link the title or not
*/
public static function has_title_link() {
return true;
}
}
abstract class SystemBlockType extends PluginBlockType {
......@@ -653,8 +666,10 @@ class BlockInstance {
// block to be a link to view more information about that artefact
$configdata = $this->get('configdata');
if (!empty($configdata['artefactid'])) {
$smarty->assign('viewartefacturl', get_config('wwwroot') . 'view/artefact.php?artefact='
. $configdata['artefactid'] . '&view=' . $this->get('view'));
if (call_static_method($classname, 'has_title_link')) {
$smarty->assign('viewartefacturl', get_config('wwwroot') . 'view/artefact.php?artefact='
. $configdata['artefactid'] . '&view=' . $this->get('view'));
}
}
if (method_exists($classname, 'feed_url')) {
......
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