Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core\output\inplace_editable Class Reference
Inheritance diagram for core\output\inplace_editable:
templatable renderable core_cohort\output\cohortidnumber core_cohort\output\cohortname core_course\output\course_module_name core_group\output\user_groups_editable core_tag\output\tagareacollection core_tag\output\tagareaenabled core_tag\output\tagareashowstandard core_tag\output\tagcollname core_tag\output\tagcollsearchable core_tag\output\tagflag core_tag\output\tagisstandard core_tag\output\tagname core_user\output\user_roles_editable

Public Member Functions

 __construct ($component, $itemtype, $itemid, $editable, $displayvalue, $value=null, $edithint=null, $editlabel=null)
 Constructor. More...
 
 export_for_template (\renderer_base $output)
 Export this data so it can be used as the context for a mustache template (core/inplace_editable). More...
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template. More...
 
 render (\renderer_base $output)
 Renders this element. More...
 
 set_type_autocomplete ($options, $attributes)
 Sets the element type to be an autocomplete field. More...
 
 set_type_select ($options)
 Sets the element type to be a dropdown. More...
 
 set_type_toggle ($options=null)
 Sets the element type to be a toggle. More...
 

Protected Member Functions

 get_linkeverything ()
 Whether the link should contain all of the content or not.
 

Protected Attributes

string $component = null
 component responsible for diplsying/updating
 
string $displayvalue = null
 value of the editable element as it should be displayed, must be formatted and may contain links or other html tags
 
bool $editable = false
 indicates if the current user is allowed to edit this element - set in constructor after permissions are checked
 
string $edithint = null
 hint for the input element (for screenreaders)
 
string $editlabel = null
 label for the input element (for screenreaders)
 
int $itemid = null
 identifier of the editable element (usually database id)
 
string $itemtype = null
 itemtype inside the component
 
string $options = ''
 options for the element, for example new value for the toggle or json-encoded list of options for select
 
string $type = 'text'
 type of the element - text, toggle or select
 
string $value = null
 value of the editable element as it is present in the database
 

Constructor & Destructor Documentation

◆ __construct()

core\output\inplace_editable::__construct (   $component,
  $itemtype,
  $itemid,
  $editable,
  $displayvalue,
  $value = null,
  $edithint = null,
  $editlabel = null 
)

Constructor.

Parameters
string$componentname of the component or plugin responsible for the updating of the value (must declare callback)
string$itemtypetype of the item inside the component - each component/plugin may implement multiple inplace-editable elements
int$itemididentifier of the item that can be edited in-place
bool$editablewhether this value is editable (check capabilities and editing mode), if false, only "displayvalue" will be displayed without anything else
string$displayvaluewhat needs to be displayed to the user, it must be cleaned, with applied filters (call format_string()). It may be wrapped in an html link, contain icons or other decorations
string$valuewhat needs to be edited - usually raw value from the database, it may contain multilang tags
lang_string | string$edithinthint (title) that will be displayed under the edit link
lang_string | string$editlabellabel for the input element in the editing mode (for screenreaders)

Reimplemented in core_user\output\user_roles_editable.

Member Function Documentation

◆ export_for_template() [1/2]

core\output\inplace_editable::export_for_template ( \renderer_base  $output)

Export this data so it can be used as the context for a mustache template (core/inplace_editable).

Parameters
renderer_base$outputtypically, the renderer that's calling this function
Return values
arraydata context for a mustache template

Reimplemented in core_user\output\user_roles_editable, core_tag\output\tagisstandard, core_tag\output\tagflag, core_tag\output\tagcollsearchable, core_tag\output\tagareaenabled, core_group\output\user_groups_editable, and core_course\output\course_module_name.

◆ export_for_template() [2/2]

templatable::export_for_template ( renderer_base  $output)
inherited

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implemented in forumreport_summary\output\filters, core_user\output\unified_filter, core_user\output\status_field, core_tag\output\taglist, core_tag\output\tagindex, core_tag\output\tagfeed, core_tag\output\tagcloud, core_tag\output\tag, report_competency\output\user_course_navigation, report_competency\output\report, core_privacy\output\exported_navigation_page, core_privacy\output\exported_html_page, MoodleQuickForm_wikieditor, mod_lti\output\tool_configure_page, mod_lti\output\external_registration_return_page, mod_forum\output\quick_search_form, mod_forum\output\big_search_form, mod_feedback\output\summary, booktool_print\output\print_book_page, booktool_print\output\print_book_chapter_page, assign_attempt_history_chooser, mod_assign\output\grading_app, login_signup_form, progress_bar, action_menu, tabtree, tabobject, custom_menu_item, initials_bar, paging_bar, url_select, single_select, pix_icon, pix_icon_font, help_icon, component_action, MoodleQuickForm_warning, MoodleQuickForm_url, MoodleQuickForm_textarea, MoodleQuickForm_tags, MoodleQuickForm_submit, MoodleQuickForm_static, MoodleQuickForm_selectwithlink, MoodleQuickForm_selectgroups, MoodleQuickForm_select, MoodleQuickForm_recaptcha, MoodleQuickForm_passwordunmask, MoodleQuickForm_group, MoodleQuickForm_grading, MoodleQuickForm_filepicker, MoodleQuickForm_filemanager, MoodleQuickForm_editor, MoodleQuickForm_date_time_selector, MoodleQuickForm_date_selector, MoodleQuickForm_checkbox, MoodleQuickForm_autocomplete, MoodleQuickForm_advcheckbox, core\output\chooser_section, core\output\chooser_item, core\output\chooser, core\output\checkbox_toggleall, core_group\output\index_page, core_group\output\group_details, enrol_lti\output\registration, core_course\output\modchooser, block_timeline\output\main, block_starredcourses\output\main, block_search_forums\output\search_form, block_recentlyaccesseditems\output\main, block_recentlyaccessedcourses\output\main, block_myprofile\output\myprofile, block_myoverview\output\main, block_lp\output\summary, block_lp\output\plans_to_review_page, block_lp\output\competencies_to_review_page, core_auth\output\verify_age_location_page, core_auth\output\login, core_auth\output\digital_minor_page, tool_templatelibrary\output\list_templates_page, tool_policy\output\page_viewdoc, tool_policy\output\page_viewalldoc, tool_policy\output\page_nopermission, tool_policy\output\page_managedocs_list, tool_policy\output\page_agreedocs, tool_policy\output\guestconsent, tool_policy\output\acceptances, tool_lp\output\user_evidence_list_page, tool_lp\output\user_competency_summary_in_course, tool_lp\output\user_competency_summary, tool_lp\output\user_competency_course_navigation, tool_lp\output\template_competencies_page, tool_lp\output\related_competencies, tool_lp\output\plans_page, tool_lp\output\module_navigation, tool_lp\output\manage_templates_page, tool_lp\output\manage_competency_frameworks_page, tool_lp\output\manage_competencies_page, tool_lp\output\course_competencies_page, tool_lp\output\competency_summary, tool_lp\output\competency_plan_navigation, tool_langimport\output\langimport_page, tool_dataprivacy\output\summary_page, tool_dataprivacy\output\request_filter, tool_dataprivacy\output\purposes, tool_dataprivacy\output\my_data_requests_page, tool_dataprivacy\output\defaults_page, tool_dataprivacy\output\data_requests_page, tool_dataprivacy\output\data_registry_page, tool_dataprivacy\output\data_registry_compliance_page, tool_dataprivacy\output\data_deletion_page, tool_dataprivacy\output\categories, and tool_customlang\output\translator.

◆ render()

core\output\inplace_editable::render ( \renderer_base  $output)

Renders this element.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
Return values
string

◆ set_type_autocomplete()

core\output\inplace_editable::set_type_autocomplete (   $options,
  $attributes 
)

Sets the element type to be an autocomplete field.

Parameters
array$optionsassociative array with dropdown options
array$attributesassociative array with attributes for autoselect field. See AMD module core/form-autocomplete.
Return values
self

◆ set_type_select()

core\output\inplace_editable::set_type_select (   $options)

Sets the element type to be a dropdown.

For select element specifying $displayvalue is optional, if null it will be assumed that $displayvalue = $options[$value]. However displayvalue can still be specified if it needs icons and/or html links.

If only one option specified, the element will not be editable.

Parameters
array$optionsassociative array with dropdown options
Return values
self

◆ set_type_toggle()

core\output\inplace_editable::set_type_toggle (   $options = null)

Sets the element type to be a toggle.

For toggle element $editlabel is not used. $displayvalue must be specified, it can have text or icons but can not contain html links.

Toggle element can have two or more options.

Parameters
array$optionstoggle options as simple, non-associative array; defaults to array(0,1)
Return values
self

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