Skip to content

Instantly share code, notes, and snippets.

@ewinslow
Last active December 19, 2015 23:18
Show Gist options
  • Save ewinslow/6033820 to your computer and use it in GitHub Desktop.
Save ewinslow/6033820 to your computer and use it in GitHub Desktop.
Exploration of JSON-based configuration of Elgg
{
"// New idea for routing": "",
"routes": {
"site/activity": {
"// The url (or array of urls) that trigger this route": "",
"paths": "/activity",
"// Calls `get()` on an instance of this class and passes to page shell and body as `$vars`": "",
"controller": "Elgg_Site_ActivityController",
"// View for generating the content area. Is `routes/$route` by default, but configurable": "",
"body": "routes/site/activity",
"// Use this page shell to wrap the output of 'body'": "",
"app": "default"
},
"site/index": {
"paths": "/",
"// filepath is relative to directory containing elgg.json": "",
"file": "pages/site/index.php"
},
"blog/view": {
"paths": [
"/blog/view/:guid",
"/blog/view/:guid-:title"
],
"file": "pages/blog/view.php"
}
},
"actions": {
"admin/plugins/settings/save": {
"// filepath is relative to directory containing this config file": "",
"file": "actions/admin/plugins/settings/save.php",
"// Only allow access from administrators. Default is 'logged_in'.": "",
"// Options: 'logged_in', 'public', 'admin'": "",
"access": "admin"
}
},
"views": {
"page/elements/head": {
"// Register a view with simplecache. Defaults to false": "",
"cache": true,
"// Register a view as ajax-fetchable. Defaults to false": "",
"ajax": true,
"// Extend this view with other views": "",
"extensions": {
"// The key is the view name and the number is the priority": "",
"// This is the equivalent of `elgg_extend_view('page/elements/head', 'example/head', 123);`": "",
"example/head": 123,
"// Pass false as the priority to unextend the view": "",
"// This is the equivalent of `elgg_unextend_view('page/elements/head', 'example/other');`": "",
"example/other": false
}
}
},
"menus": {
"topbar": {
"// Unregister the Elgg logo": "",
"elgg_logo": false,
"// Register a static menu item": "",
"home": {
"// TODO: How to support i18n?", "",
"text": "Home",
"href": "/",
},
"// Register a factory function for dynamic (context-sensitive) menu items": "",
"current_user": ["MyPlugin", "createCurrentUserMenuItem"]
}
},
"scripts": {
"// Simplest. Only recommended for AMD-compatible libs",
"jquery": "//ajax.googleapis.com/jquery.js",
"backbone": {
"src": "//cdnjs.com/backbone.js",
"// AMD shim compatibility": "",
"deps": ["underscore", "jquery"],
"exports": "Backbone"
}
},
"styles": {
"jquery-ui": "//jquery-ui.com/jquery-ui.css"
},
"events": {
"create": {
"object": {
"// Key is priority, value is the callback": "",
"500": "myplugin_create_object_handler"
}
}
},
"hooks": {
"prepare": {
"menu:site": {
"// Key is priority. Value is the callback": "",
"1000": "myplugin_prepare_site_menu_handler"
}
}
},
"widgets": {
"a_users_groups": {
"access": "profile"
}
},
"subtypes": {
"object": {
"photo": "TidypicsPhoto"
}
},
"libraries": {
"disqus": "vendors/disqusapi.php"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment