Commit 467adec1 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow blockinstances to keep persistent non-artefact data around


Useful for blocks that need to get at the same db record multiple times

Change-Id: I273458035d3156c136c264a1fc3c7639392827d6
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent d339bc11
......@@ -433,6 +433,7 @@ class BlockInstance {
private $canmovedown;
private $maxorderincolumn;
private $artefacts = array();
private $temp = array();
public function __construct($id=0, $data=null) {
if (!empty($id)) {
......@@ -1204,7 +1205,14 @@ class BlockInstance {
return true;
}
public function get_data($key, $id) {
if (!isset($this->temp[$key][$id])) {
$blocktypeclass = generate_class_name('blocktype', $this->get('blocktype'));
if (!isset($this->temp[$key])) {
$this->temp[$key] = array();
}
$this->temp[$key][$id] = call_static_method($blocktypeclass, 'get_instance_' . $key, $id);
}
return $this->temp[$key][$id];
}
}
?>
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