Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
core\output\local\collapsable_section Class Reference
Inheritance diagram for core\output\local\collapsable_section:
core\output\named_templatable core\output\renderable core\output\templatable

Public Member Functions

 __construct (protected string string $titlecontent, protected string string $sectioncontent, protected string string $classes='', protected array array $extras=[], protected bool bool $open=false, protected string|null string|null $expandlabel=null, protected string|null string|null $collapselabel=null,)
 Constructor.
 
 add_extra_attributes (array $extras)
 Merges the provided extras array with the existing extras array.
 
 export_for_template (\renderer_base $output)
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 get_template_name (\renderer_base $renderer)
 
 get_template_name (renderer_base $renderer)
 Get the name of the template to use for this templatable.
 
 set_classes (string $classes)
 Sets the CSS classes for the collapsable section.
 
 set_open (bool $open)
 Sets the default open state of the collapsible section.
 
 set_section_content (string $sectioncontent)
 Sets the content for the collapsable section.
 
 set_title_content (string $titlecontent)
 Set the title content.
 

Constructor & Destructor Documentation

◆ __construct()

core\output\local\collapsable_section::__construct ( protected string string $titlecontent,
protected string string $sectioncontent,
protected string string $classes = '',
protected array array $extras = [],
protected bool bool $open = false,
protected string|null string|null $expandlabel = null,
protected string|null string|null $collapselabel = null )

Constructor.

Parameters
string$titlecontentThe content to be displayed inside the button.
string$sectioncontentThe content to be displayed inside the dialog.
string$classesAdditional CSS classes to be applied to the section.
array$extrasAn attribute => value array to be added to the element.
bool$openIf the section is opened by default.
string | null$expandlabelThe label for the expand button.
string | null$collapselabelThe label for the collapse button.
Parameters
$titlecontent$titlecontent The content to be displayed inside the button.
$sectioncontent$sectioncontent The content to be displayed inside the dialog.
$classes$classes Additional CSS classes to be applied to the section.
$extras$extras A attribute => value array to be added to the element.
$open$open if the section is opened by default.
$expandlabel$expandlabel The label for the expand button.
$collapselabel$collapselabel The label for the collapse button.

Member Function Documentation

◆ add_extra_attributes()

core\output\local\collapsable_section::add_extra_attributes ( array $extras)

Merges the provided extras array with the existing extras array.

Parameters
array$extrasThe array of extra attributes => extra value.

◆ export_for_template()

core\output\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 core\output\action_menu, core\output\actions\component_action, core\output\activity_header, core\output\checkbox_toggleall, core\output\choicelist, core\output\chooser, core\output\chooser_item, core\output\chooser_section, core\output\comboboxsearch, core\output\context_header, core\output\custom_menu_item, core\output\dynamic_tabs, core\output\help_icon, core\output\initials_bar, core\output\paging_bar, core\output\pix_icon, core\output\pix_icon_font, core\output\progress_bar, core\output\select_menu, core\output\single_select, core\output\tabobject, core\output\tabtree, core\output\task_indicator, core\output\url_select, core_calendar\output\humandate, core_calendar\output\humantimeperiod, core_course\output\actionbar\group_selector_button, core_course\output\actionbar\group_selector_dropdown_form, core_course\output\actionbar\initials_dropdown_form, core_course\output\actionbar\user_selector_button, core_course\output\activity_completion, core_course\output\activity_dates, core_course\output\activity_icon, core_course\output\activitychooserbutton, core_course\output\completion_action_bar, core_courseformat\output\local\content\basecontrolmenu, core_courseformat\output\local\content\cm\controlmenu, core_courseformat\output\local\content\cm, core_courseformat\output\local\content\section, core_courseformat\output\local\overview\activityname, core_courseformat\output\local\overview\overviewtable, core_grades\output\penalty_indicator, core_reportbuilder\output\custom_report, core_reportbuilder\output\dynamictabs\access, core_reportbuilder\output\dynamictabs\audience, core_reportbuilder\output\dynamictabs\editor, core_reportbuilder\output\dynamictabs\schedules, core_reportbuilder\output\report_action, and core_reportbuilder\output\system_report.

◆ get_template_name()

core\output\named_templatable::get_template_name ( renderer_base $renderer)
inherited

◆ set_classes()

core\output\local\collapsable_section::set_classes ( string $classes)

Sets the CSS classes for the collapsable section.

Parameters
string$classesThe CSS classes to be applied to the collapsable section.

◆ set_open()

core\output\local\collapsable_section::set_open ( bool $open)

Sets the default open state of the collapsible section.

Parameters
bool$open

◆ set_section_content()

core\output\local\collapsable_section::set_section_content ( string $sectioncontent)

Sets the content for the collapsable section.

Parameters
string$sectioncontentThe content to be set for the section.

◆ set_title_content()

core\output\local\collapsable_section::set_title_content ( string $titlecontent)

Set the title content.

Parameters
string$titlecontent

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