← Back to team overview

mahara-contributors team mailing list archive

[Bug 1510421] A change has been merged

 

Reviewed:  https://reviews.mahara.org/5762
Committed: https://git.mahara.org/mahara/mahara/commit/4f849ed2e47001190d46c3293863ab84f991bd08
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch:    master

commit 4f849ed2e47001190d46c3293863ab84f991bd08
Author: Aaron Wells <aaronw@xxxxxxxxxxxxxxx>
Date:   Mon Nov 23 19:19:22 2015 +1300

Display icons for 3rd-party blocktypes plugins

Bug 1510421

Defines a new static PluginBlocktype method, get_css_icon(), which
fetches the name of the CSS icon to use for this blocktype. It returns
false by default, which tells the theme to "fall back" to the old
thumbnail.png instead. 3rd-party plugins can override this to
specify a particular icon to use.

All the core blocktypes have been refactored to extend
MaharaCoreBlocktype, which uses the blocktype name as the name
of the CSS icon to use. I also deprecated the "SystemBlocktype"
class while I was at it.

PluginBlocktype::get_blocktypes_for_category() now returns both
the results of get_css_icon() and the thumbnail.png path, so that
themes can decide which they want to use. (And of course
thumbnail.png is served via thumbnail.php, so 3rd party themes
can provide their own custom image files if they wish.)

behatnotneeded: Requires installing third-party plugins to test

Change-Id: Idb1ecfc7b21175913708e695788906c11133b0c0

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1510421

Title:
  Better support for 3rd party blocktype icons in Mahara 15.10+

Status in Mahara:
  Fix Committed
Status in Mahara 15.10 series:
  In Progress
Status in Mahara 16.04 series:
  Fix Committed

Bug description:
  As discussed in the Mahara dev meeting. With the new bootstrap themes,
  Mahara core blocktypes now use fontawesome for their icons.
  Consequently the template that displays each block in the block
  picker, is no longer using the old thumb.png or get_icon() mtehods to
  get the block's icon and display it. Instead, it just has a <span>
  with a class "icon-{blocktype.name}":

  https://git.mahara.org/mahara/mahara/blob/master/htdocs/theme/raw/templates/view/blocktypelist.tpl

  These are then mapped to fontawesome classes here:

  https://git.mahara.org/mahara/mahara/blob/master/htdocs/theme/raw/sass/typography/_icons.scss#L21

  It would make sense for us to support the old methods, and we could
  make the system do this automatically, with some logic in
  blocktypelist.tpl and/or in htdocs/blocktype/lib.php

  For now, the workaround is to create a style.css file for the block
  (under the block's own theme directory) and define the class in there,
  like this example from the clippy block: https://github.com/agwells
  /maharacontrib-blocktype-
  clippy/blob/master/theme/raw/static/style/style.css

   .icon-clippy::before {
       content: url(\../images/thumb.png);
   }

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1510421/+subscriptions


References