Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Favourites API: Difference between revisions

From MoodleDocs
Line 1: Line 1:
==Overview==
==Overview==
The favourites API allows you to favourite items for a given user, a notion akin to adding a web page to favourites (or bookmarks) in your browser, or marking someone in your contacts as a favourite. The API provides a means to create, read, update and delete favourites, allowing any component to favourite arbitrary items as they see fit.
The favourites API allows you to mark items as favourites for a given user. Marking an item as a favourite is akin to adding a web page to your browser favourites (or bookmarks), or marking someone in your contacts as a favourite. The API provides a means to create, read, update and delete favourite items, allowing any component to favourite arbitrary items as they see fit.
 
==Favourites API usage==
==Favourites API usage==
An item can be anything and is identified by a {component, itemtype} pair. The component must be a valid frankenstyle component name and should be the name of the component wishing to store the favourite. The itemtype can be any identifying string, provided it is unique within the respective component.
An item can be anything and is identified by a {component, itemtype} pair. The component must be a valid frankenstyle component name and should be the name of the component wishing to store the favourite. The itemtype can be any identifying string, provided it is unique within the respective component.

Revision as of 03:31, 28 November 2018

Overview

The favourites API allows you to mark items as favourites for a given user. Marking an item as a favourite is akin to adding a web page to your browser favourites (or bookmarks), or marking someone in your contacts as a favourite. The API provides a means to create, read, update and delete favourite items, allowing any component to favourite arbitrary items as they see fit.

Favourites API usage

An item can be anything and is identified by a {component, itemtype} pair. The component must be a valid frankenstyle component name and should be the name of the component wishing to store the favourite. The itemtype can be any identifying string, provided it is unique within the respective component. E.g. {'core_course', 'courses'} is used in core to as a key to identify those courses which have been starred for a given user.

Additionally, the API supports the marking of items as favourites in different contexts, using a 'contextid' parameter.