Search moodle.org's
Developer Documentation

See Release Notes

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

(no description)

File Size: 156 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

login_form:: (8 methods):
  __construct()
  definition()
  definition_after_data()
  validation()
  get_element_error()
  set_element_error()
  freeze()
  element_exists()


Class: login_form  - X-Ref

MFA login form

__construct($action = null, $customdata = null, $method = 'post', $target = '',$attributes = null, $editable = true, $ajaxformdata = null)   X-Ref
Create an instance of this class.

param: mixed $action the action attribute for the form. If empty defaults to auto detect the
param: mixed $customdata if your form defintion method needs access to data such as $course
param: string $method if you set this to anything other than 'post' then _GET and _POST will
param: string $target target frame for form submission. You will rarely use this. Don't use
param: mixed $attributes you can pass a string of html attributes here or an array.
param: bool $editable
param: array $ajaxformdata Forms submitted via ajax, must pass their data here, instead of relying on _GET and _POST.

definition()   X-Ref
{@inheritDoc}


definition_after_data()   X-Ref
Invokes factor login_form_definition_after_data() method after form data has been set.

return: void

validation($data, $files)   X-Ref
Validates the login form with given factor validation method.

param: array $data
param: array $files
return: array

get_element_error(string $elementname)   X-Ref
Returns error corresponding to validated element.

param: string $elementname Name of form element to check.
return: string|null Error message corresponding to the validated element.

set_element_error(string $elementname, string $error)   X-Ref
Set an error message for a form element.

param: string $elementname Name of form element to set error for.
param: string $error Error message, if empty then removes the current error message.
return: void

freeze(string $elementname)   X-Ref
Freeze a form element.

param: string $elementname Name of form element to freeze.
return: void

element_exists(string $elementname)   X-Ref
Returns true if the form element exists.

param: string $elementname Name of form element to check.
return: bool