Local hook for adding custom sideblocks

Bug #1314465 reported by Gregor Anželj
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Wishlist
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)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/3303

Aaron Wells (u-aaronw)
Changed in mahara:
milestone: none → 1.10.0
importance: Undecided → Wishlist
status: New → In Progress
tags: added: local
Revision history for this message
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.

Revision history for this message
Gregor Anželj (gregor-anzelj) wrote :

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

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

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)
Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
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)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.