Commit 5042ee64 authored by Penny Leach's avatar Penny Leach Committed by Nigel McNie
Browse files

blocktype categories now sourced from database

parent 72f1b241
......@@ -75,6 +75,15 @@ abstract class PluginBlocktype extends Plugin {
public static function has_config() {
return false;
}
public static function title_from_name($name) {
$title = get_string('blocktypecategory.'. $name);
if (strpos($title, '[[') !== 0) {
return $title;
}
// else we're an artefact
return get_string('pluginname', 'artefact.' . $name);
}
}
class BlockInstance {
......
......@@ -172,28 +172,18 @@ $COLUMNS = array(
* alone should be output
*/
function view_build_category_list($defaultcategory, $javascript=false) {
// TODO: This data structure needs to be sourced from the database
$categories = array(
array(
'name' => 'aboutme',
'title' => 'About Me',
),
array(
'name' => 'blogs',
'title' => 'Blogs',
),
array(
'name' => 'filesandfolders',
'title' => 'Files and Folders',
),
array(
'name' => 'general',
'title' => 'General',
),
array(
'name' => 'system',
'title' => 'System Blocks',
require_once(get_config('docroot') . '/blocktype/lib.php');
$cats = get_records_array('blocktype_category');
$categories = array_map(
create_function(
'$a',
'$a = $a->name;
return array(
"name" => $a,
"title" => call_static_method("PluginBlockType", "title_from_name", $a),
);'
),
$cats
);
$result = "<ul>\n";
......
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