Local hook for adding custom sideblocks

Bug #1314465 reported by Gregor Anželj on 2014-04-30
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gregor Anželj

Bug Description

Local hook would be needed (in lib/web.php) to allow for custom plugins to add custom sideblocks to certain parts/pages within Mahara without the need for changing core code.

Below is an example (in local/lib.php) of using such a hook to add custom sideblock to all pages relatd to groups (i.e. Gropus menu and all it's submenu items):

function local_sideblocks_update(&$SIDEBLOCKS) {
  if (defined('MENUITEM') && MENUITEM != '') {
    list($mainmenu, $submenu) = explode('/', MENUITEM);
    if($mainmenu == 'groups') {
      safe_require('artefact', 'myplugin');
      $SIDEBLOCKS[] = array(
       'name' => 'mysideblock',
        'id' => 'sb-mysideblock',
        'weight' => -10,
        'data' => PluginArtefactMyplugin::mysideblock_sideblock()

description: updated
Changed in mahara:
assignee: nobody → Gregor Anželj (gregor-anzelj)
Aaron Wells (u-aaronw) on 2014-04-30
Changed in mahara:
milestone: none → 1.10.0
importance: Undecided → Wishlist
status: New → In Progress
tags: added: local
Aaron Wells (u-aaronw) wrote :

Interesting patch. I've actually been brainstorming turning sideblocks into a full-featured plugin type, which would maybe be a cleaner thing to do if you need a sideblock to support another plugin. The only stumbling block is I haven't been able to think of a really good way for a sideblock to tell you which pages it should be displayed on.

Gregor Anželj (gregor-anzelj) wrote :

Maybe we could share ideas/suggestion on the next Mahara dev meeting...

Reviewed: https://reviews.mahara.org/3303
Committed: http://gitorious.org/mahara/mahara/commit/47cbcac65802dd5b06b92cad90dccf18da440717
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit 47cbcac65802dd5b06b92cad90dccf18da440717
Author: Gregor Anzelj <email address hidden>
Date: Wed Apr 30 06:30:41 2014 +0200

Local hook for adding custom sideblocks (Bug #1314465)

Change-Id: I4f461e72074fb937baeb8a5abd35667d2e3cb407
Signed-off-by: Gregor Anzelj <email address hidden>

Aaron Wells (u-aaronw) on 2014-05-02
Changed in mahara:
status: In Progress → Fix Committed
Aaron Wells (u-aaronw) wrote :

We discussed this topic at the 32nd dev meeting. The consensus was to proceed with Gregor's patch because it's an easy, harmless way to at least make custom sideblocks possible. And in the longer term, we'll consider making them into a full-featured plugin type.

So, I've spun off a separate Launchpad bug for that: https://bugs.launchpad.net/mahara/+bug/1315205

tags: added: nominatedfeature
Aaron Wells (u-aaronw) on 2014-10-21
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers