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 { ...@@ -164,21 +164,29 @@ class PluginBlocktypeNavigation extends MaharaCoreBlocktype {
if ($needsblock) { if ($needsblock) {
// need to add new navigation block // need to add new navigation block
$otherview = new View($vid); $otherview = new View($vid);
$bi = new BlockInstance(0, $bidata = array(
array( 'blocktype' => 'navigation',
'blocktype' => 'navigation', 'title' => $values['title'],
'title' => $values['title'], 'configdata' => array(
'positionx' => 0, 'collection' => $values['collection'],
'positiony' => 0, 'retractable' => $values['retractable'],
'width' => 4, 'retractedonload' => $values['retractedonload'],
'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); $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