Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
profile_field_menu Class Reference

Class profile_field_menu. More...

Inheritance diagram for profile_field_menu:

Public Member Functions

 __construct ($fieldid=0, $userid=0, $fielddata=null)
 Constructor method.
 
 convert_external_data ($value)
 Convert external data (csv file) from value to key for processing later by edit_save_data_preprocess.
 
 edit_field_add ($mform)
 Create the code snippet for this field instance Overwrites the base class method.
 
 edit_field_set_default ($mform)
 Set the default value for this field instance Overwrites the base class method.
 
 edit_field_set_locked ($mform)
 HardFreeze the field if locked.
 
 edit_load_user_data ($user)
 When passing the user object to the form class for the edit profile page we should load the key for the saved data.
 
 edit_save_data_preprocess ($data, $datarecord)
 The data from the form returns the key.
 
 get_field_config_for_external ()
 Return the field settings suitable to be exported via an external function.
 
 get_field_properties ()
 Return the field type and null properties.
 

Public Attributes

int $datakey
 $datakey
 
array $options
 $options
 

Detailed Description

Class profile_field_menu.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

profile_field_menu::__construct ( $fieldid = 0,
$userid = 0,
$fielddata = null )

Constructor method.

Pulls out the options for the menu from the database and sets the the corresponding key for the data if it exists.

Parameters
int$fieldid
int$userid
object$fielddata

Member Function Documentation

◆ convert_external_data()

profile_field_menu::convert_external_data ( $value)

Convert external data (csv file) from value to key for processing later by edit_save_data_preprocess.

Parameters
string$valueone of the values in menu options.
Return values
intoptions key for the menu

◆ edit_field_add()

profile_field_menu::edit_field_add ( $mform)

Create the code snippet for this field instance Overwrites the base class method.

Parameters
moodleform$mformMoodle form instance

◆ edit_field_set_default()

profile_field_menu::edit_field_set_default ( $mform)

Set the default value for this field instance Overwrites the base class method.

Parameters
moodleform$mformMoodle form instance

◆ edit_field_set_locked()

profile_field_menu::edit_field_set_locked ( $mform)

HardFreeze the field if locked.

Parameters
moodleform$mforminstance of the moodleform class

◆ edit_load_user_data()

profile_field_menu::edit_load_user_data ( $user)

When passing the user object to the form class for the edit profile page we should load the key for the saved data.

Overwrites the base class method.

Parameters
stdClass$userUser object.

◆ edit_save_data_preprocess()

profile_field_menu::edit_save_data_preprocess ( $data,
$datarecord )

The data from the form returns the key.

This should be converted to the respective option string to be saved in database Overwrites base class accessor method.

Parameters
mixed$dataThe key returned from the select input in the form
stdClass$datarecordThe object that will be used to save the record
Return values
mixedData or null

◆ get_field_config_for_external()

profile_field_menu::get_field_config_for_external ( )

Return the field settings suitable to be exported via an external function.

Return values
arrayall the settings

◆ get_field_properties()

profile_field_menu::get_field_properties ( )

Return the field type and null properties.

This will be used for validating the data submitted by a user.

Return values
arraythe param type and null property
Since
Moodle 3.2

The documentation for this class was generated from the following file: