Commit 5c8c608a authored by Nigel McNie's avatar Nigel McNie
Browse files

Order the blocktypes for category query, and add keys describing the button...

Order the blocktypes for category query, and add keys describing the button direction for the move buttons.

While ordering does not really make sense for the blocktypes, a database level sorting means that whatever ordering there is will not jump around in the UI between page reloads etc.

The direction has been added for the move buttons so that images can be used for them instead.
parent 040cbf58
......@@ -98,11 +98,11 @@ abstract class PluginBlocktype extends Plugin {
}
public static function get_blocktypes_for_category($category) {
$sql = 'SELECT bti.name,bti.artefactplugin
$sql = 'SELECT bti.name, bti.artefactplugin
FROM {blocktype_installed} bti
JOIN {blocktype_installed_category} btic ON btic.blocktype = bti.name
WHERE btic.category = ?';
WHERE btic.category = ?
ORDER BY bti.name';
if (!$bts = get_records_sql_array($sql, array($category))) {
return false;
}
......@@ -293,13 +293,15 @@ class BlockInstance {
'column' => $this->get('column') - 1,
'order' => $this->get('order'),
'arrow' => '←',
'dir' => 'left',
);
}
if ($this->get('canmovedown')) {
$movecontrols[] = array(
'column' => $this->get('column'),
'order' => $this->get('order') +1,
'arrow' => '↓',
'order' => $this->get('order') +1,
'arrow' => '↓',
'dir' => 'down',
);
}
if ($this->get('canmoveup')) {
......@@ -307,6 +309,7 @@ class BlockInstance {
'column' => $this->get('column'),
'order' => $this->get('order') -1,
'arrow' => '↑',
'dir' => 'up',
);
}
if ($this->get('canmoveright')) {
......@@ -314,6 +317,7 @@ class BlockInstance {
'column' => $this->get('column') + 1,
'order' => $this->get('order'),
'arrow' => '→',
'dir' => 'right',
);
}
}
......
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