Commit bf1139f1 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1904352: Save navigation block correctly



Depending if the other pages in collection are in old or new layout

Change-Id: Ic6a395e391614e285338b8f6e3c900383cec4113
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 7ce0fe80
......@@ -164,21 +164,29 @@ class PluginBlocktypeNavigation extends MaharaCoreBlocktype {
if ($needsblock) {
// need to add new navigation block
$otherview = new View($vid);
$bi = new BlockInstance(0,
array(
'blocktype' => 'navigation',
'title' => $values['title'],
'positionx' => 0,
'positiony' => 0,
'width' => 4,
'height' => 3,
'configdata' => array(
'collection' => $values['collection'],
'retractable' => $values['retractable'],
'retractedonload' => $values['retractedonload'],
),
)
$bidata = array(
'blocktype' => 'navigation',
'title' => $values['title'],
'configdata' => array(
'collection' => $values['collection'],
'retractable' => $values['retractable'],
'retractedonload' => $values['retractedonload'],
),
);
if ($otherview->uses_new_layout()) {
// Save block with dimensions
$bidata['positionx'] = 0;
$bidata['positiony'] = 0;
$bidata['width'] = 4;
$bidata['height'] = 3;
}
else {
// Save block in old layout
$bidata['row'] = 1;
$bidata['column'] = 1;
$bidata['order'] = get_field_sql("SELECT MAX(bi.order) + 1 FROM {block_instance} bi WHERE bi.view = ?", array($vid));
}
$bi = new BlockInstance(0, $bidata);
$otherview->addblockinstance($bi);
}
}
......
Supports Markdown
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