Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 2.49 KB

README.md

File metadata and controls

35 lines (24 loc) · 2.49 KB

Accessibility Widgets

Accessibility widgets (subplugins) need to be placed in this directory ({path/to/moodle}/local/accessibility/widgets/).

Widget Development Instructions

It is possible to develop a custom accessibility widget as a subplugin. Here is the basic information for developing widget plugins:

  • Plugin type name: accessibility
  • Plugin directory: /local/accessibility/widgets/

There are some examples from default widget plugin can be found on GitHub:

Main Class

Each widget plugin needs to have accessibility_{widgetname}.php class file placed in widget directory. The class extends \local_accessibility\widgets\widgetbase abstract class. The following abstract methods need to be implmented:

  • getcontent() which returns HTML content to display in accessibility panel.

Configuration Value Storage

If the widget is customisable its value by user, it can call setuserconfig and getuserconfig method from parent class. These methods support saving data for both logged-in users and guest users. If the interaction of users is through javascript, to save configuration, it can call local_accessibility_savewidgetconfig API or import saveWidgetConfig javascript function from local/accessibility/common module.

Presets

There are a number of common widget presets that a new widget can also derive from without writing from scratch.