Commit 89875fa9 authored by Lisa Seeto's avatar Lisa Seeto Committed by Gerrit Code Review
Browse files

Merge "Bug 1904352: Save navigation block correctly"

parents 3e55def7 bf1139f1
......@@ -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(
$bidata = 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'],
),
)
);
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