Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
block_myprofile_edit_form Class Reference
Inheritance diagram for block_myprofile_edit_form:
block_edit_form core_form\dynamic_form moodleform

Public Member Functions

 __get (string $name)
 Magic getter for backward compatibility.
 
 _process_submission ($method)
 Internal method.
 
 _validate_files (&$files)
 Internal method.
 
 add_action_buttons ($cancel=true, $submitlabel=null)
 Use this method to a cancel and submit button to the end of your form.
 
 add_checkbox_controller ($groupid, $text=null, $attributes=null, $originalValue=0)
 Adds a link/button that controls the checked state of a group of checkboxes.
 
 add_sticky_action_buttons (bool $cancel=true, ?string $submitlabel=null)
 Use this method to make a sticky submit/cancel button at the end of your form.
 
 definition ()
 Form definition.
 
 definition_after_data ()
 Dummy stub method - override if you need to setup the form depending on current values.
 
 display ()
 Print html form.
 
 filter_shown_headers (array $shownonly)
 Use this method to indicate that the fieldsets should be shown as expanded and all other fieldsets should be hidden.
 
 focus ($name=NULL)
 To autofocus on first form element or first element with error.
 
 get_data ()
 Return submitted data if properly submitted or returns NULL if validation fails or if there is no submitted data.
 
 get_file_content ($elname)
 Get content of uploaded file.
 
 get_new_filename ($elname=null)
 Returns name of uploaded file.
 
 get_submitted_data ()
 Return submitted data without validation or NULL if there is no submitted data.
 
 init_javascript_enhancement ($element, $enhancement, array $options=array(), array $strings=null)
 Adds an initialisation call for a standard JavaScript enhancement.
 
 is_cancelled ()
 Return true if a cancel button has been pressed resulting in the form being submitted.
 
 is_editing_the_frontpage ()
 Returns true if the user is editing a frontpage.
 
 is_submitted ()
 Check that form was submitted.
 
 is_validated ()
 Check that form data is valid.
 
 moodleform ($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true)
 Old syntax of class constructor.
 
 no_submit_button_pressed ()
 Checks if button pressed is not for submitting the form.
 
 optional_param ($name, $default, $type)
 Checks if a parameter was passed in the previous form submission.
 
 process_dynamic_submission ()
 Process the form submission, used if form was submitted via AJAX.
 
 render ()
 Renders the html form (same as display, but returns the result).
 
 repeat_elements ($elementobjs, $repeats, $options, $repeathiddenname, $addfieldsname, $addfieldsno=5, $addstring=null, $addbuttoninside=false, $deletebuttonname='')
 Method to add a repeating group of elements to a form.
 
 repeat_elements_fix_clone ($i, $elementclone, &$namecloned)
 Helper used by repeat_elements().
 
 save_file ($elname, $pathname, $override=false)
 Save file to standard filesystem.
 
 save_files ($destination)
 Save verified uploaded files into directory.
 
 save_stored_file ($elname, $newcontextid, $newcomponent, $newfilearea, $newitemid, $newfilepath='/', $newfilename=null, $overwrite=false, $newuserid=null)
 Save file to local filesystem pool.
 
 save_temp_file ($elname)
 Returns a temporary file, do not forget to delete after not needed any more.
 
 set_data ($defaults)
 Load in existing data as form defaults.
 
 set_data_for_dynamic_submission ()
 Load in existing data as form defaults.
 
 set_display_vertical ()
 Set display mode for the form when labels take full width of the form and above the elements even on big screens.
 
 set_initial_dirty_state ($state=false)
 Set the initial 'dirty' state of the form.
 
 validate_defined_fields ($validateonnosubmit=false)
 Validate the form.
 
 validation ($data, $files)
 Dummy stub method - override if you needed to perform some extra validation.
 

Static Public Member Functions

static display_form_when_adding ()
 Display the configuration form when block is being added to the page.
 
static get_js_module ()
 Returns a JS module definition for the mforms JS.
 
static mock_ajax_submit ($simulatedsubmitteddata, $simulatedsubmittedfiles=array(), $method='post', $formidentifier=null)
 Used by tests to simulate submitted form data submission via AJAX.
 
static mock_generate_submit_keys ($data=[])
 Used by tests to generate valid submit keys for moodle forms that are submitted with ajax data.
 
static mock_submit ($simulatedsubmitteddata, $simulatedsubmittedfiles=array(), $method='post', $formidentifier=null)
 Used by tests to simulate submitted form data submission from the user.
 

Protected Member Functions

 _get_post_params ()
 Internal method - should not be used anywhere.
 
 after_definition ()
 After definition hook.
 
 check_access_for_dynamic_submission ()
 Checks if current user has access to this form, otherwise throws exception.
 
 get_array_value_by_keys (array $array, array $keys)
 Returns an element of multi-dimensional array given the list of keys.
 
 get_block ()
 Instance of the block that is being added or edited.
 
 get_context_for_dynamic_submission ()
 Returns context where this form is used.
 
 get_draft_files ($elname)
 Get draft files of a form element This is a protected method which will be used only inside moodleforms.
 
 get_form_identifier ()
 It should returns unique identifier for the form.
 
 get_page ()
 Page where we are adding or editing the block.
 
 get_page_url_for_dynamic_submission ()
 Returns url to set in $PAGE->set_url() when form is being rendered or submitted via AJAX.
 
 prepare_defaults (stdClass $defaults)
 Prepare block configuration data and add default values when needed.
 
 specific_definition ($mform)
 Override this to create any form fields specific to this type of block.
 
 validate_draft_files ()
 Internal method.
 

Protected Attributes

array $_ajaxformdata
 submitted form data when using mforms with ajax
 
mixed $_customdata
 globals workaround
 
object $_definition_finalized = false
 definition_after_data executed flag
 
MoodleQuickForm $_form
 quickform object definition
 
string $_formname
 name of the form
 
bool null $_validated = null
 stores the validation result of this form or null if not yet validated
 
array $defaults = []
 Defaults set in set_data() that need to be returned in get_data() if form elements were not created.
 

Static Protected Attributes

static int $uniqueid = 0
 Unique identifier to be used for action buttons.
 

Member Function Documentation

◆ __get()

block_edit_form::__get ( string $name)
inherited

Magic getter for backward compatibility.

Parameters
string$name
Return values
block_base|moodle_page

◆ check_access_for_dynamic_submission()

block_edit_form::check_access_for_dynamic_submission ( )
protectedinherited

Checks if current user has access to this form, otherwise throws exception.

Reimplemented from core_form\dynamic_form.

◆ definition()

block_edit_form::definition ( )
inherited

Form definition.

Reimplemented from moodleform.

◆ display_form_when_adding()

static block_edit_form::display_form_when_adding ( )
staticinherited

Display the configuration form when block is being added to the page.

By default when block is added to the page it is added with the default configuration. Some block may require configuration, for example, "glossary random entry" block needs a glossary to be selected, "RSS feed" block needs an RSS feed to be selected, etc.

Such blocks can override this function and return true. These blocks must ensure that the function specific_definition() will work if there is no current block id.

Return values
bool

Reimplemented in block_activity_results_edit_form, block_glossary_random_edit_form, block_html_edit_form, and block_rss_client_edit_form.

◆ get_block()

block_edit_form::get_block ( )
protectedinherited

Instance of the block that is being added or edited.

To access you can also use magic property $this->block

If {{

See also
self\display_form_when_adding()}} returns true and the configuration form is displayed when adding block, the $this->block->id will be null.
Return values
block_base
Exceptions
block_not_on_page_exception
moodle_exception

◆ get_context_for_dynamic_submission()

block_edit_form::get_context_for_dynamic_submission ( )
protectedinherited

Returns context where this form is used.

Return values
context

Reimplemented from core_form\dynamic_form.

◆ get_data()

block_edit_form::get_data ( )
inherited

Return submitted data if properly submitted or returns NULL if validation fails or if there is no submitted data.

Return values
stdClasssubmitted data; NULL if not valid or not submitted or cancelled

Reimplemented from moodleform.

◆ get_page()

block_edit_form::get_page ( )
protectedinherited

Page where we are adding or editing the block.

To access you can also use magic property $this->page

Return values
moodle_page
Exceptions
moodle_exception

◆ get_page_url_for_dynamic_submission()

block_edit_form::get_page_url_for_dynamic_submission ( )
protectedinherited

Returns url to set in $PAGE->set_url() when form is being rendered or submitted via AJAX.

Return values
moodle_url

Reimplemented from core_form\dynamic_form.

◆ is_editing_the_frontpage()

block_edit_form::is_editing_the_frontpage ( )
inherited

Returns true if the user is editing a frontpage.

Return values
bool

◆ prepare_defaults()

block_edit_form::prepare_defaults ( stdClass $defaults)
protectedinherited

Prepare block configuration data and add default values when needed.

Parameters
stdClass$defaults
Return values
stdClass

◆ process_dynamic_submission()

block_edit_form::process_dynamic_submission ( )
inherited

Process the form submission, used if form was submitted via AJAX.

Reimplemented from core_form\dynamic_form.

◆ set_data()

block_edit_form::set_data ( $defaults)
inherited

Load in existing data as form defaults.

Parameters
stdClass$defaults
Return values
void

Reimplemented from moodleform.

Reimplemented in block_html_edit_form.

◆ set_data_for_dynamic_submission()

block_edit_form::set_data_for_dynamic_submission ( )
inherited

Load in existing data as form defaults.

Reimplemented from core_form\dynamic_form.

◆ specific_definition()

block_myprofile_edit_form::specific_definition ( $mform)
protected

Override this to create any form fields specific to this type of block.

Parameters
MoodleQuickForm$mformthe form being built.

Reimplemented from block_edit_form.


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