Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

Class with front-end (editing form) functionality. This is a base class of a class implemented by each component, and also has static methods.

Copyright: 2014 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 209 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: frontend  - X-Ref

Class with front-end (editing form) functionality.

This is a base class of a class implemented by each component, and also has
static methods.

allow_add($course, \cm_info $cm = null,\section_info $section = null)   X-Ref
Decides whether this plugin should be available in a given course. The
plugin can do this depending on course or system settings.

Default returns true.

param: \stdClass $course Course object
param: \cm_info $cm Course-module currently being edited (null if none)
param: \section_info $section Section currently being edited (null if none)

get_javascript_strings()   X-Ref
Gets a list of string identifiers (in the plugin's language file) that
are required in JavaScript for this plugin. The default returns nothing.

You do not need to include the 'title' string (which is used by core) as
this is automatically added.

return: array Array of required string identifiers

get_javascript_init_params($course, \cm_info $cm = null,\section_info $section = null)   X-Ref
Gets additional parameters for the plugin's initInner function.

Default returns no parameters.

param: \stdClass $course Course object
param: \cm_info $cm Course-module currently being edited (null if none)
param: \section_info $section Section currently being edited (null if none)
return: array Array of parameters for the JavaScript function

get_component()   X-Ref
Gets the Frankenstyle component name for this plugin.

return: string The component name for this plugin

include_all_javascript($course, \cm_info $cm = null,\section_info $section = null)   X-Ref
Includes JavaScript for the main system and all plugins.

param: \stdClass $course Course object
param: \cm_info $cm Course-module currently being edited (null if none)
param: \section_info $section Section currently being edited (null if none)

report_validation_errors(array $data, array &$errors)   X-Ref
For use within forms, reports any validation errors from the availability
field.

param: array $data Form data fields
param: array $errors Error array

convert_associative_array_for_js(array $inarray,$keyname, $valuename)   X-Ref
Converts an associative array into an array of objects with two fields.

This is necessary because JavaScript associative arrays/objects are not
ordered (at least officially according to the language specification).

param: array $inarray Associative array key => value
param: string $keyname Name to use for key in resulting array objects
param: string $valuename Name to use for value in resulting array objects
return: array Non-associative (numeric) array