General plugins (Local): Metadata

local_metadata
Maintained by Picture of Mike Churchward Mike Churchward
The “local metadata” plugin has been created to allow extra, “metadata” to be defined and assigned to various context level elements in Moodle. It is an abstraction of the current “user profile field” functionality in Moodle and contains much of the same code. This was written for the MUA as a proof of concept for a project to add extra profile data to courses, to see whether one metadata function could be used for multiple Moodle contexts. It is currently in Beta, and is open for participation and discussion.
26 sites
55 downloads
5 fans

Build CI status

The “local metadata” plugin has been created to allow extra, “metadata” to be defined and
assigned to various context level elements in Moodle. It is an abstraction of the current “user
profile field” functionality in Moodle and contains much of the same code.

The data model includes context level identifiers to allow the same data tables and API’s to be
used for all of the different context levels. The plugin has been designed with the ability to be
adopted into core, and completely replace the current user profile field feature if desired.

In its current concept state, the plugin provides metadata functionality for users, courses,
activity modules, groups, cohorts and course caregories. Other context levels can be added through
the context subplugin. NOTE, that the user metadata provided by the plugin is “in addition to” the
current profile data rather than replacing it. For now, it is really intended to show/prove that
this could replace the user profile data feature.

The plugin provides two subplugin types:
- Data contexts - These subplugins provide a Moodle context to apply metadata to.
- Data field types - These subplugins are the same as the user profile data types plugins.

Since it is a plugin, it can only provide interfaces that are available to plugins. For example,
adding specific data to defined course metadata elements must be done through a different
interface form than the main course settings form. The plugin takes advantages of Moodle
hooks and callbacks that allow screens and menus to be added to, where they exist. If brought
into core, these would be able to be more tightly integrated (this could also be better integrated
if/when the proposed “hook” system provides more hooking points).

The plugin can be retrieved from https://github.com/PoetOS/moodle-local_metadata. It
should be installed into the Moodle “/local/metadata/” directory (the “metadata” subdirectory
needs to be created). Make sure that the “/local/metadata/” directory contains the root of the
plugin.

Goto https://github.com/PoetOS/moodle-local_metadata/blob/master/walkthrough.pdf for a walkthrough
of the plugin in its current state.

Screenshots

Screenshot #0

Contributors

Picture of Mike Churchward
Mike Churchward (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Plugins bot
    Wed, 12 Jul 2017, 10:40 PM
    Approval issue created: CONTRIB-6975
  • Picture of Jon Bolton
    Tue, 8 Aug 2017, 8:20 PM
    Great plugin Mike - I can see lots of use cases for this and it would be a great addition to core. A question though - where does the course (or module) metadata appear after it’s been entered? I can see user metadata appear in the user profile, but can’t see the metadata I entered for a course, or a module. Also, is it integrated with global search?
  • Picture of Mike Churchward
    Tue, 8 Aug 2017, 11:01 PM
    Hi Jon. The only place those appear currently are on the pages you add them to the contexts. There is no other page I can add them to that I can see (at least not without changing core). But, this project is intended to be a collaborative one, so I am open to any and all suggestions. smile
  • Picture of Elizabeth Dalton
    Wed, 9 Aug 2017, 2:49 AM
    Is it possible to implement metadata as a filter for inclusion in labels, blocks, etc.?
  • Picture of Mike Churchward
    Wed, 9 Aug 2017, 2:55 AM
    Hi Elizabeth. Can you expand on that a bit? Not sure I understand what you mean. And, by all means add it as a new issue proposing a feature addition to the repo.
  • Picture of Elizabeth Dalton
    Wed, 9 Aug 2017, 3:13 AM
    We discussed this elsewhere... the idea would be to create filters, e.g. [course:subject] to include the data from a field named "subject" attached to the context "course".
  • Picture of Elizabeth Dalton
    Wed, 9 Aug 2017, 3:31 AM
    I have submitted two issues at GitHub, one for filters, the other for metadata schema.
  • Picture of Mike Churchward
    Wed, 9 Aug 2017, 3:59 AM
  • Picture of tim st.clair
    Wed, 16 Aug 2017, 7:57 PM
    Nice plugin. I had a similar one (latest branch: https://github.com/frumbert/moodle-course_meta/tree/Moodle2.8.7-MultiSelect-MetaFilter) - I never got around to posting it up here. This plugin mimics the user profile fields (and adds a couple of new field types). I used $CFG->customscripts as the over-ride since it was in the moodle 2.7-ish, so core was a different place then smile

    My plugin was written intending to be used as a FILTER to draw a catalogue from various properties on the course profile fields, and had a somewhat dodgy templating system in it for doing custom rendering - iterating over properties, that sort of thing - there is code in the plugin showing how that worked. This sounded like what Elizabeth might have wanted - values appearing where you tell them, using effectively a shortcode.

    Totara has a similar custom attribute system where you can assign fields to various objects, core integrated. I always felt Moodle needed to have that in core.
  • Picture of Mike Churchward
    Wed, 16 Aug 2017, 11:14 PM
    Hi Tim. I'll take a look at your code and see what might be usable in mine. I based this plugin on the custom user fields code, and then refactored it. It allows for metadata to be applied to defined Moodle objects (contexts) through subplugins, using one standard set of data structures. I welcome any collaboration. I am creating a companion filter - https://github.com/PoetOS/moodle-filter_metadata - as well. This would fit nicely with an editor plugin to make it easy to add metadata placeholders.

    I looked at the Totara code, after talking with Simon Coggins. It required a lot of core mods, and had specific code and data tables for each object that the metadata applied to. I felt it made more sense to use one set of tables with a context identifying field.

    mike
Please login to post comments