Moodle

make supported_formats smarter in the caller

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Portfolio API
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

After a brainstorming session with Nico, who is fast becoming number 2 portfolio api ninja, we thought the following was the best approach:

  • change supported_formats in the caller to always be called statically and accept the caller object optionally. This means it can essentially support static and not static calls, by the implementer testing for empty($caller) rather than having to do isset($this) && $this instanceof whateverclass (which I thought was too hard for implementers to have to worry about)
  • allow an extra argument to portfolio_add_button - so that if the calling code knows better than the static function in the caller class does about what formats are going to be allowed (eg if it knows a file is an image) it can override it.

I'm going to sit on this for a little bit in case I have any further ideas, but that's the current plan.

Activity

Hide
Penny Leach added a comment -

committed to head. example in forum attachments that are images.

Show
Penny Leach added a comment - committed to head. example in forum attachments that are images.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: