Commit d339bc11 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't fetch artefact from db unnecessarily when generating a block title



Change-Id: I2809e1042e3c07835d594e58d3922dfd6bb12d10
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 846fdc5a
......@@ -41,9 +41,7 @@ class PluginBlocktypeBlog extends PluginBlocktype {
$configdata = $bi->get('configdata');
if (!empty($configdata['artefactid'])) {
require_once(get_config('docroot') . 'artefact/lib.php');
$blog = artefact_instance_from_id($configdata['artefactid']);
return $blog->get('title');
return $bi->get_artefact_instance($configdata['artefactid'])->get('title');
}
return '';
}
......
......@@ -41,9 +41,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
$configdata = $bi->get('configdata');
if (!empty($configdata['artefactid'])) {
require_once(get_config('docroot') . 'artefact/lib.php');
$blogpost = artefact_instance_from_id($configdata['artefactid']);
return $blogpost->get('title');
return $bi->get_artefact_instance($configdata['artefactid'])->get('title');
}
return '';
}
......
......@@ -41,9 +41,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
$configdata = $bi->get('configdata');
if (!empty($configdata['artefactid'])) {
require_once(get_config('docroot') . 'artefact/lib.php');
$folder = artefact_instance_from_id($configdata['artefactid']);
return $folder->get('title');
return $bi->get_artefact_instance($configdata['artefactid'])->get('title');
}
return '';
}
......
......@@ -49,10 +49,7 @@ class PluginBlocktypePlans extends PluginBlocktype {
$configdata = $bi->get('configdata');
if (!empty($configdata['artefactid'])) {
safe_require('artefact','plans');
$plan = new ArtefactTypePlan($configdata['artefactid']);
$title = $plan->get('title');
return $title;
return $bi->get_artefact_instance($configdata['artefactid'])->get('title');
}
return '';
}
......
......@@ -49,9 +49,7 @@ class PluginBlocktypeResumefield extends PluginBlocktype {
$configdata = $bi->get('configdata');
if (!empty($configdata['artefactid'])) {
require_once(get_config('docroot') . 'artefact/lib.php');
$resumefield = artefact_instance_from_id($configdata['artefactid']);
return $resumefield->get('title');
return $bi->get_artefact_instance($configdata['artefactid'])->get('title');
}
return '';
}
......
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