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: 244 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

dialog:: (11 methods):
  __construct()
  set_content()
  set_button()
  set_dialog_width()
  set_button_classes()
  set_classes()
  add_extra()
  add_button_id()
  set_position()
  export_for_template()
  get_template_name()


Class: dialog  - X-Ref

Class to render a dropdown dialog element.

A dropdown dialog allows to render any arbitrary HTML into a dropdown elements triggered
by a button.

__construct(string $buttoncontent, string $dialogcontent, array $definition = [])   X-Ref
Constructor.

The definition object could contain the following keys:
- classes: component CSS classes.
- buttonclasses: the button CSS classes.
- dialogwidth: the dropdown width.
- dropdownposition: the dropdown position.
- extras: extra HTML attributes (attribute => value).

param: string $buttoncontent the button content
param: string $dialogcontent the footer content
param: array $definition an optional array of the element definition

set_content(string $dialogcontent)   X-Ref
Set the dialog contents.

param: string $dialogcontent

set_button(string $buttoncontent, ?string $buttonclasses = null)   X-Ref
Set the button contents.

param: string $buttoncontent
param: string|null $buttonclasses the button classes

set_dialog_width(string $width)   X-Ref
Set the dialog width.

param: string $width

set_button_classes(string $buttonclasses)   X-Ref
Add extra classes to trigger butotn.

param: string $buttonclasses the extra classes

set_classes(string $classes)   X-Ref
Add extra classes to the component.

param: string $classes the extra classes

add_extra(string $attribute, string $value)   X-Ref
Add extra extras to the sticky footer element.

param: string $attribute the extra attribute
param: string $value the value

add_button_id(string $value)   X-Ref
Set the button element id.

param: string $value the value

set_position(string $position)   X-Ref
Set the dropdown position.

param: string $position the position

export_for_template(\renderer_base $output)   X-Ref
Export this data so it can be used as the context for a mustache template (core/inplace_editable).

param: \renderer_base $output typically, the renderer that's calling this function
return: array data context for a mustache template

get_template_name(\renderer_base $renderer)   X-Ref
Get the name of the template to use for this templatable.

param: \renderer_base $renderer The renderer requesting the template name
return: string the template name