Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
core_renderer_cli Class Reference

A renderer that generates output for command-line scripts. More...

Inheritance diagram for core_renderer_cli:
core_renderer renderer_base

Public Member Functions

 action_icon ($url, pix_icon $pixicon, component_action $action=null, array $attributes=null, $linktext=false)
 Renders an action_icon.
 
 action_link ($url, $text, component_action $action=null, array $attributes=null, $icon=null)
 Renders a special html link with attached action.
 
 activity_information (cm_info $cminfo, cm_completion_details $completiondetails, array $activitydates)
 Returns information about an activity.
 
 activity_navigation ()
 Returns standard navigation between activities in a course.
 
 add_action_handler (component_action $action, $id=null)
 Adds a JS action for the element with the provided id.
 
 addblockbutton ($region='')
 Generate the add block button when editing mode is turned on and the user can edit blocks.
 
 block (block_contents $bc, $region)
 Prints a nice side block with an optional header.
 
 block_controls ($actions, $blockid=null)
 Output the row of editing icons for a block, as defined by the controls array.
 
 block_move_target ($target, $zones, $previous, $region)
 Output a place where the block that is currently being moved can be dropped.
 
 blocks ($region, $classes=array(), $tag='aside', $fakeblocksonly=false)
 Get the HTML for blocks in the given region.
 
 blocks_for_region ($region, $fakeblocksonly=false)
 Output all the blocks in a particular region.
 
 body_attributes ($additionalclasses=array())
 Returns HTML attributes to use within the body tag.
 
 body_css_classes (array $additionalclasses=array())
 Returns the CSS classes to apply to the body tag.
 
 body_id ()
 The ID attribute to apply to the body tag.
 
 box ($contents, $classes='generalbox', $id=null, $attributes=array())
 Outputs a box.
 
 box_end ()
 Outputs the closing section of a box.
 
 box_start ($classes='generalbox', $id=null, $attributes=array())
 Outputs the opening section of a box.
 
 check_result (core\check\result $result)
 Renders a Check API result.
 
 close_element_for_append ()
 This closes any opened stream elements.
 
 close_window_button ($text='')
 Returns HTML to display a simple button to close a window.
 
 communication_link ()
 Returns the communication link, complete with html.
 
 communication_url ()
 Returns the communication url for a given instance if it exists.
 
 confirm ($message, $continue, $cancel, array $displayoptions=[])
 Print a message along with button choices for Continue/Cancel.
 
 container ($contents, $classes=null, $id=null)
 Outputs a container.
 
 container_end ()
 Outputs the closing section of a container.
 
 container_end_all ($shouldbenone=false)
 Close all but the last open container.
 
 container_start ($classes=null, $id=null)
 Outputs the opening section of a container.
 
 context_header ($headerinfo=null, $headinglevel=1)
 
 context_header_settings_menu ()
 This is an optional menu that can be added to a layout by a theme.
 
 continue_button ($url)
 Returns HTML to display a continue button that goes to a particular URL.
 
 course_content_footer ($onlyifnotcalledbefore=false)
 Returns course-specific information to be output immediately below content on any course page (for the current course)
 
 course_content_header ($onlyifnotcalledbefore=false)
 Returns course-specific information to be output immediately above content on any course page (for the current course)
 
 course_footer ()
 Returns course-specific information to be output on any course page in the footer area (for the current course)
 
 course_header ()
 Returns course-specific information to be output on any course page in the header area (for the current course)
 
 custom_block_region ($regionname)
 Renders a custom block region.
 
 custom_menu ($custommenuitems='')
 Returns the custom menu if one has been set.
 
 custom_menu_flat ()
 We want to show the custom menus as a list of links in the footer on small screens.
 
 darrow ()
 Accessibility: Down arrow-like character.
 
 debug_footer_html ()
 Performance information and validation links for debugging.
 
 doc_link ($path, $text='', $forcepopup=false, array $attributes=[])
 Returns a string containing a link to the user documentation.
 
 doctype ()
 Get the DOCTYPE declaration that should be used with this page.
 
 download_dataformat_selector ($label, $base, $name='dataformat', $params=array())
 Returns a dataformat selection and download form.
 
 edit_button (moodle_url $url, string $method='post')
 Returns HTML to display a "Turn editing on/off" button in a form.
 
 edit_switch ()
 Create a navbar switch for toggling editing mode.
 
 error_text ($message)
 Output an error message.
 
 fatal_error ($message, $moreinfourl, $link, $backtrace, $debuginfo=null, $errorcode="")
 Returns a template fragment representing a fatal error.
 
 favicon ()
 Returns the moodle_url for the favicon.
 
 file_picker ($options)
 Returns HTML to display the file picker.
 
 footer ()
 There is no footer for a cli request, however we must override the footer method to prevent the default footer.
 
 full_header ()
 Wrapper for header elements.
 
 get_compact_logo_url ($maxwidth=300, $maxheight=300)
 Return the site's compact logo URL, if any.
 
 get_generated_color_for_id ($id)
 Get the course color to show on a course card.
 
 get_generated_image_for_id ($id)
 Get the course pattern datauri to show on a course card.
 
 get_generated_svg_for_id (int $id)
 Get the course pattern in SVG format to show on a course card.
 
 get_generated_url_for_course (context_course $context)
 Get the course pattern image URL.
 
 get_logo_url ($maxwidth=null, $maxheight=200)
 Return the site's logo URL, if any.
 
 has_communication_links ()
 Helper function to decide whether to show the communication link or not.
 
 has_popover_links ()
 Helper function to decide whether to show the help popover header or not.
 
 has_started ()
 Returns true is output has already started, and false if not.
 
 header ()
 Returns the page header.
 
 heading ($text, $level=2, $classes='main', $id=null)
 Returns a template fragment representing a Heading.
 
 heading_with_help ($text, $helpidentifier, $component='moodle', $icon='', $iconalt='', $level=2, $classnames=null)
 Centered heading with attached help button (same title text) and optional icon attached.
 
 help_icon ($identifier, $component='moodle', $linktext='', $a=null)
 Returns HTML to display a help icon.
 
 help_icon_scale ($courseid, stdClass $scale)
 Returns HTML to display a scale help icon.
 
 home_link ()
 Return the 'back' link that normally appears in the footer.
 
 htmlattributes ()
 The attributes that should be added to the <html> tag.
 
 htmllize_file_tree ()
 
 image_icon ($pix, $alt, $component='moodle', array $attributes=null)
 Return HTML for an image_icon.
 
 image_url ($imagename, $component='moodle')
 Return the moodle_url for an image.
 
 initials_bar ($current, $class, $title, $urlvar, $url, $alpha=null, bool $minirender=false)
 Returns HTML to display initials bar to provide access to other pages (usually in a search)
 
 lang_menu ()
 Returns lang menu or '', this method also checks forcing of languages in courses.
 
 larrow ()
 Accessibility: Left arrow-like character is used in the breadcrumb trail, course navigation menu (previous/next activity), calendar, and search forum block.
 
 list_block_contents ($icons, $items)
 Render the contents of a block_list.
 
 login_info ($withlinks=null)
 Return the standard string that says whether you are logged in (and switched roles/logged in as another user).
 
 main_content ()
 Returns standard main content placeholder.
 
 maintenance_warning ()
 Scheduled maintenance warning message.
 
 mform_element ($element, $required, $advanced, $error, $ingroup)
 Renders an mform element from a template.
 
 moodle_release ()
 Renders release information in the footer popup.
 
 navbar ()
 This renders the navbar.
 
 navbar_plugin_output ()
 Allow plugins to provide some content to be rendered in the navbar.
 
 notification ($message, $type=null, $closebutton=true)
 Returns a template fragment representing a notification.
 
 notify_message ()
 
 notify_problem ()
 
 notify_redirect ()
 
 notify_success ()
 
 old_help_icon ($helpidentifier, $title, $component='moodle', $linktext='')
 Returns HTML to display a help icon.
 
 page_doc_link ($text=null)
 Returns the Moodle docs link to use for this page.
 
 page_heading ($tag='h1')
 Gets HTML for the page heading.
 
 page_heading_button ()
 Gets the HTML for the page heading button.
 
 page_heading_menu ()
 Returns the page heading menu.
 
 page_title ()
 Returns the title to use on the page.
 
 paging_bar ($totalcount, $page, $perpage, $baseurl, $pagevar='page')
 Returns HTML to display a single paging bar to provide access to other pages (usually in a search)
 
 paragraph (string $contents, ?string $classes=null, ?string $id=null)
 Outputs a paragraph.
 
 pix_icon ($pix, $alt, $component='moodle', array $attributes=null)
 Return HTML for a pix_icon.
 
 pix_url ($imagename, $component='moodle')
 Return the direct URL for an image from the pix folder.
 
 print_textarea ($name, $id, $value, $rows, $cols)
 Returns the HTML for a basic textarea field.
 
 rarrow ()
 Accessibility: Right arrow-like character is used in the breadcrumb trail, course navigation menu (previous/next activity), calendar, and search forum block.
 
 redirect_message ($encodedurl, $message, $delay, $debugdisableredirect, $messagetype=core\output\notification::NOTIFY_INFO)
 Redirects the user by any means possible given the current state.
 
 region_main_settings_menu ()
 This is an optional menu that can be added to a layout by a theme.
 
 render (renderable $widget)
 Returns rendered widget.
 
 render_action_menu (action_menu $menu)
 Renders an action menu component.
 
 render_chart (\core\chart_base $chart, $withtable=true)
 Renders a chart.
 
 render_chart_bar (\core\chart_bar $chart)
 Renders a bar chart.
 
 render_chart_line (\core\chart_line $chart)
 Renders a line chart.
 
 render_chart_pie (\core\chart_pie $chart)
 Renders a pie chart.
 
 render_checkbox_toggleall (\core\output\checkbox_toggleall $element)
 Renders element for a toggle-all checkbox.
 
 render_file_picker (file_picker $fp)
 Internal implementation of file picker rendering.
 
 render_from_template ($templatename, $context)
 Renders a template by name with the given context.
 
 render_inplace_editable (\core\output\inplace_editable $element)
 Renders element for inline editing of any value.
 
 render_login (\core_auth\output\login $form)
 Renders the login form.
 
 render_login_signup_form ($form)
 Render the login signup form into a nice template for the theme.
 
 render_notification (\core\output\notification $notification)
 Render a notification (that is, a status message about something that has just happened).
 
 render_participants_tertiary_nav (object $course, ?string $renderedbuttons=null)
 Renders the tertiary nav for the participants page.
 
 render_preferences_group (preferences_group $renderable)
 Renders preferences group.
 
 render_preferences_groups (preferences_groups $renderable)
 Renders preferences groups.
 
 render_progress_bar (progress_bar $bar)
 Renders a progress bar.
 
 render_progress_bar_update (string $id, float $percent, string $msg, string $estimate)
 Renders an update to a progress bar.
 
 render_rating (rating $rating)
 Produces the html that represents this rating in the UI.
 
 render_skip_links ($links)
 Renders the skip links for the page.
 
 search_box ($id=false)
 Returns a search box.
 
 secure_layout_language_menu ()
 Returns the language menu in the secure layout.
 
 secure_layout_login_info ()
 Secure layout login info.
 
 select_element_for_append (string $selector='#region-main[role=main]', string $element='div')
 Prepares an element for streaming output.
 
 select_element_for_replace (string $selector, string $html, bool $outer=false)
 A companion method to select_element_for_append.
 
 services_support_link ()
 Returns the services and support link for the help pop-up.
 
 should_display_main_logo ($headinglevel=1)
 Whether we should display the main logo.
 
 should_display_navbar_logo ()
 Whether we should display the logo in the navbar.
 
 single_button ($url, $label, $method='post', array $options=null)
 Returns a form with a single button.
 
 single_select ($url, $name, array $options, $selected='', $nothing=array(''=> 'choosedots'), $formid=null, $attributes=array())
 Returns a form with a single select widget.
 
 skip_link_target ($id=null)
 Output the place a skip link goes to.
 
 spacer (array $attributes=null, $br=false)
 Creates and returns a spacer image with optional line break.
 
 sr_text (string $contents)
 Outputs a screen reader only inline text.
 
 standard_after_main_region_html ()
 The standard HTML that should be output just before the <footer> tag.
 
 standard_end_of_body_html ()
 The standard tags (typically script tags that are not needed earlier) that should be output after everything else.
 
 standard_footer_html ()
 content that should be output in the footer area of the page.
 
 standard_head_html ()
 The standard tags (meta tags, links to stylesheets and JavaScript, etc.) that should be included in the <head> tag.
 
 standard_top_of_body_html ()
 The standard tags (typically skip links) that should be output just inside the start of the <body> tag.
 
 supportemail (array $customattribs=[], bool $embed=false)
 Returns the HTML for the site support email link.
 
 tabtree ($tabs, $selected=null, $inactive=null)
 Renders tabs.
 
 tag_list ($tags, $label=null, $classes='', $limit=10, $pagecontext=null, $accesshidelabel=false)
 Displays the list of tags associated with an entry.
 
 tree_block_contents ($items, $attrs=array())
 Make nested HTML lists out of the items.
 
 uarrow ()
 Accessibility: Up arrow-like character is used in the book heirarchical navigation.
 
 update_module_button ()
 
 url_select (array $urls, $selected, $nothing=array(''=> 'choosedots'), $formid=null)
 Returns a form with a url select widget.
 
 user_menu ($user=null, $withlinks=null)
 Construct a user menu, returning HTML that can be echoed out by a layout file.
 
 user_picture (stdClass $user, array $options=null)
 Returns HTML to display the specified user's avatar.
 

Static Public Member Functions

static prepare_classes ($classes)
 Given an array or space-separated list of classes, prepares and returns the HTML class attribute value.
 

Public Attributes

string const MAIN_CONTENT_TOKEN = '[MAIN CONTENT GOES HERE]'
 Do NOT use, please use <?php echo $OUTPUT->main_content() ?> in layout files instead.
 

Protected Member Functions

 build_action_menu_from_navigation (action_menu $menu, navigation_node $node, $indent=false, $onlytopleafnodes=false)
 Take a node in the nav tree and make an action menu out of it.
 
 get_mustache ()
 Return an instance of the mustache class.
 
 is_login_page ()
 Check whether the current page is a login page.
 
 render_action_link (action_link $link)
 Renders an action_link object.
 
 render_action_menu_filler (action_menu_filler $action)
 Renders a primary action_menu_filler item.
 
 render_action_menu_link (action_menu_link $action)
 Renders an action_menu_link item.
 
 render_action_menu_link_primary (action_menu_link_primary $action)
 Renders a primary action_menu_link item.
 
 render_action_menu_link_secondary (action_menu_link_secondary $action)
 Renders a secondary action_menu_link item.
 
 render_breadcrumb_navigation_node (breadcrumb_navigation_node $item)
 Renders a breadcrumb navigation node object.
 
 render_check_result (core\check\result $result)
 Renders a Check API result.
 
 render_context_header (context_header $contextheader)
 Renders the header bar.
 
 render_custom_menu (custom_menu $menu)
 Renders a custom menu object (located in outputcomponents.php)
 
 render_custom_menu_item (custom_menu_item $menunode)
 Renders a custom menu node as part of a submenu.
 
 render_digital_minor_page ($page)
 Render the digital minor contact information page into a nice template for the theme.
 
 render_help_icon (help_icon $helpicon)
 Implementation of user image rendering.
 
 render_image_icon (image_icon $icon)
 Renders a pix_icon widget and returns the HTML to display it.
 
 render_initials_bar (initials_bar $initialsbar)
 Internal implementation of initials bar rendering.
 
 render_navigation_node (navigation_node $item)
 Renders a navigation node object.
 
 render_page_layout ($layoutfile)
 Renders and outputs the page layout file.
 
 render_paging_bar (paging_bar $pagingbar)
 Returns HTML to display the paging bar.
 
 render_pix_emoticon (pix_emoticon $emoticon)
 Return HTML to display an emoticon icon.
 
 render_pix_icon (pix_icon $icon)
 Renders a pix_icon widget and returns the HTML to display it.
 
 render_single_button (single_button $button)
 Renders a single button widget.
 
 render_single_select (single_select $select)
 Internal implementation of single_select rendering.
 
 render_tabobject (tabobject $tabobject)
 Renders tabobject (part of tabtree)
 
 render_tabtree (tabtree $tabtree)
 Renders tabtree.
 
 render_url_select (url_select $select)
 Internal implementation of url_select rendering.
 
 render_user_picture (user_picture $userpicture)
 Internal implementation of user image rendering.
 
 render_verify_age_location_page ($page)
 Render the verify age and location page into a nice template for the theme.
 
 theme_switch_links ()
 Renders theme links for switching between default and other themes.
 

Protected Attributes

string $contenttype
 Used to pass information from core_renderer::doctype() to core_renderer::standard_head_html().
 
string $currentelement = ''
 The current element tag which is being streamed into.
 
string $currentselector = ''
 The current selector for an element being streamed into.
 
custom_menu_item $language = null
 language The language menu if created
 
string $metarefreshtag = ''
 Used by core_renderer::redirect_message() method to communicate with core_renderer::header().
 
xhtml_container_stack $opencontainers
 The xhtml_container_stack to use.
 
moodle_page $page
 The Moodle page the renderer has been created to assist with.
 
string $target
 The requested rendering target.
 
array $templatecache = []
 $templatecache The mustache template cache.
 
string $unique_end_html_token
 Unique token for the closing HTML.
 
string $unique_main_content_token
 Unique token for the main content.
 
string $unique_performance_info_token
 Unique token for performance information.
 

Detailed Description

A renderer that generates output for command-line scripts.

The implementation of this renderer is probably incomplete.

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

Member Function Documentation

◆ action_icon()

core_renderer::action_icon ( $url,
pix_icon $pixicon,
component_action $action = null,
array $attributes = null,
$linktext = false )
inherited

Renders an action_icon.

This function uses the core_renderer::action_link() method for the most part. What it does different is prepare the icon as HTML and use it as the link text.

Theme developers: If you want to change how action links and/or icons are rendered, consider overriding function core_renderer::render_action_link() and core_renderer::render_pix_icon().

Parameters
string | moodle_url$urlA string URL or moodel_url
pix_icon$pixicon
component_action$action
array$attributesassociative array of html link attributes + disabled
bool$linktextshow title next to image in link
Return values
stringHTML fragment

◆ action_link()

core_renderer::action_link ( $url,
$text,
component_action $action = null,
array $attributes = null,
$icon = null )
inherited

Renders a special html link with attached action.

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_action_link() instead.

Parameters
string | moodle_url$url
string$textHTML fragment
component_action$action
array$attributesassociative array of html link attributes + disabled
pix_iconoptional pix icon to render with the link
Return values
stringHTML fragment

◆ activity_information()

core_renderer::activity_information ( cm_info $cminfo,
cm_completion_details $completiondetails,
array $activitydates )
inherited

Returns information about an activity.

Deprecated
since Moodle 4.3 MDL-78744
Todo
MDL-78926 This method will be deleted in Moodle 4.7
Parameters
cm_info$cminfoThe course module information.
cm_completion_details$completiondetailsThe completion details for this activity module.
array$activitydatesThe dates for this activity module.
Return values
stringthe activity information HTML.
Exceptions
coding_exception

◆ activity_navigation()

core_renderer::activity_navigation ( )
inherited

Returns standard navigation between activities in a course.

Return values
stringthe navigation HTML.

◆ add_action_handler()

renderer_base::add_action_handler ( component_action $action,
$id = null )
inherited

Adds a JS action for the element with the provided id.

This method adds a JS event for the provided component action to the page and then returns the id that the event has been attached to. If no id has been provided then a new ID is generated by html_writer::random_id()

Parameters
component_action$action
string$id
Return values
stringid of element, either original submitted or random new if not supplied

◆ addblockbutton()

core_renderer::addblockbutton ( $region = '')
inherited

Generate the add block button when editing mode is turned on and the user can edit blocks.

Parameters
string$regionwhere new blocks should be added.
Return values
stringhtml for the add block button.

◆ block()

core_renderer::block ( block_contents $bc,
$region )
inherited

Prints a nice side block with an optional header.

Parameters
block_contents$bcHTML for the content
string$regionthe region the block is appearing in.
Return values
stringthe HTML to be output.

Reimplemented in core_renderer_maintenance.

◆ block_controls()

core_renderer::block_controls ( $actions,
$blockid = null )
inherited

Output the row of editing icons for a block, as defined by the controls array.

Parameters
array$controlsan array like block_contents::$controls.
string$blockidThe ID given to the block.
Return values
stringHTML fragment.

◆ block_move_target()

core_renderer::block_move_target ( $target,
$zones,
$previous,
$region )
inherited

Output a place where the block that is currently being moved can be dropped.

Parameters
block_move_target$targetwith the necessary details.
array$zonesarray of areas where the block can be moved to
string$previousthe block located before the area currently being rendered.
string$regionthe name of the region
Return values
stringthe HTML to be output.

◆ blocks()

core_renderer::blocks ( $region,
$classes = array(),
$tag = 'aside',
$fakeblocksonly = false )
inherited

Get the HTML for blocks in the given region.

Since
Moodle 2.5.1 2.6
Parameters
string$regionThe region to get HTML for.
array$classesWrapping tag classes.
string$tagWrapping tag.
boolean$fakeblocksonlyInclude fake blocks only.
Return values
stringHTML.

Reimplemented in core_renderer_maintenance.

◆ blocks_for_region()

core_renderer::blocks_for_region ( $region,
$fakeblocksonly = false )
inherited

Output all the blocks in a particular region.

Parameters
string$regionthe name of a region on this page.
boolean$fakeblocksonlyOutput fake block only.
Return values
stringthe HTML to be output.

Reimplemented in core_renderer_maintenance.

◆ body_attributes()

core_renderer::body_attributes ( $additionalclasses = array())
inherited

Returns HTML attributes to use within the body tag.

This includes an ID and classes.

Since
Moodle 2.5.1 2.6
Parameters
string | array$additionalclassesAny additional classes to give the body tag,
Return values
string

◆ body_css_classes()

core_renderer::body_css_classes ( array $additionalclasses = array())
inherited

Returns the CSS classes to apply to the body tag.

Since
Moodle 2.5.1 2.6
Parameters
array$additionalclassesAny additional classes to apply.
Return values
string

◆ body_id()

core_renderer::body_id ( )
inherited

The ID attribute to apply to the body tag.

Since
Moodle 2.5.1 2.6
Return values
string

◆ box()

core_renderer::box ( $contents,
$classes = 'generalbox',
$id = null,
$attributes = array() )
inherited

Outputs a box.

Parameters
string$contentsThe contents of the box
string$classesA space-separated list of CSS classes
string$idAn optional ID
array$attributesAn array of other attributes to give the box.
Return values
stringthe HTML to output.

◆ box_end()

core_renderer::box_end ( )
inherited

Outputs the closing section of a box.

Return values
stringthe HTML to output.

◆ box_start()

core_renderer::box_start ( $classes = 'generalbox',
$id = null,
$attributes = array() )
inherited

Outputs the opening section of a box.

Parameters
string$classesA space-separated list of CSS classes
string$idAn optional ID
array$attributesAn array of other attributes to give the box.
Return values
stringthe HTML to output.

◆ build_action_menu_from_navigation()

core_renderer::build_action_menu_from_navigation ( action_menu $menu,
navigation_node $node,
$indent = false,
$onlytopleafnodes = false )
protectedinherited

Take a node in the nav tree and make an action menu out of it.

The links are injected in the action menu.

Parameters
action_menu$menu
navigation_node$node
boolean$indent
boolean$onlytopleafnodes
Return values
booleannodesskipped - True if nodes were skipped in building the menu

◆ check_result()

core_renderer_cli::check_result ( core\check\result $result)

Renders a Check API result.

Parameters
result$result
Return values
stringfragment

Reimplemented from core_renderer.

◆ close_element_for_append()

core_renderer::close_element_for_append ( )
inherited

This closes any opened stream elements.

Return values
stringhtml to be written

◆ close_window_button()

core_renderer::close_window_button ( $text = '')
inherited

Returns HTML to display a simple button to close a window.

Parameters
string$textThe lang string for the button's label (already output from get_string())
Return values
stringhtml fragment

◆ communication_link()

core_renderer::communication_link ( )
inherited

Returns the communication link, complete with html.

Return values
string

◆ communication_url()

core_renderer::communication_url ( )
inherited

Returns the communication url for a given instance if it exists.

Return values
string

◆ confirm()

core_renderer::confirm ( $message,
$continue,
$cancel,
array $displayoptions = [] )
inherited

Print a message along with button choices for Continue/Cancel.

If a string or moodle_url is given instead of a single_button, method defaults to post.

Parameters
string$messageThe question to ask the user
single_button | moodle_url | string$continueThe single_button component representing the Continue answer. Can also be a moodle_url or string URL
single_button | moodle_url | string$cancelThe single_button component representing the Cancel answer. Can also be a moodle_url or string URL
array$displayoptionsoptional extra display options
Return values
stringHTML fragment

Reimplemented in core_renderer_maintenance.

◆ container()

core_renderer::container ( $contents,
$classes = null,
$id = null )
inherited

Outputs a container.

Parameters
string$contentsThe contents of the box
string$classesA space-separated list of CSS classes
string$idAn optional ID
Return values
stringthe HTML to output.

◆ container_end()

core_renderer::container_end ( )
inherited

Outputs the closing section of a container.

Return values
stringthe HTML to output.

◆ container_end_all()

core_renderer::container_end_all ( $shouldbenone = false)
inherited

Close all but the last open container.

This is useful in places like error handling, where you want to close all the open containers (apart from <body>) before outputting the error message.

Parameters
bool$shouldbenoneassert that the stack should be empty now - causes a developer debug warning if it isn't.
Return values
stringthe HTML required to close any open containers inside <body>.

◆ container_start()

core_renderer::container_start ( $classes = null,
$id = null )
inherited

Outputs the opening section of a container.

Parameters
string$classesA space-separated list of CSS classes
string$idAn optional ID
Return values
stringthe HTML to output.

◆ context_header_settings_menu()

core_renderer::context_header_settings_menu ( )
inherited

This is an optional menu that can be added to a layout by a theme.

It contains the menu for the course administration, only on the course main page.

Return values
string

◆ continue_button()

core_renderer::continue_button ( $url)
inherited

Returns HTML to display a continue button that goes to a particular URL.

Parameters
string | moodle_url$urlThe url the button goes to.
Return values
stringthe HTML to output.

◆ course_content_footer()

core_renderer::course_content_footer ( $onlyifnotcalledbefore = false)
inherited

Returns course-specific information to be output immediately below content on any course page (for the current course)

Parameters
bool$onlyifnotcalledbeforeoutput content only if it has not been output before
Return values
string

Reimplemented in core_renderer_maintenance.

◆ course_content_header()

core_renderer::course_content_header ( $onlyifnotcalledbefore = false)
inherited

Returns course-specific information to be output immediately above content on any course page (for the current course)

Parameters
bool$onlyifnotcalledbeforeoutput content only if it has not been output before
Return values
string

Reimplemented in core_renderer_maintenance.

◆ course_footer()

core_renderer::course_footer ( )
inherited

Returns course-specific information to be output on any course page in the footer area (for the current course)

Return values
string

Reimplemented in core_renderer_maintenance.

◆ course_header()

core_renderer::course_header ( )
inherited

Returns course-specific information to be output on any course page in the header area (for the current course)

Return values
string

Reimplemented in core_renderer_maintenance.

◆ custom_block_region()

core_renderer::custom_block_region ( $regionname)
inherited

Renders a custom block region.

Use this method if you want to add an additional block region to the content of the page. Please note this should only be used in special situations. We want to leave the theme is control where ever possible!

This method must use the same method that the theme uses within its layout file. As such it asks the theme what method it is using. It can be one of two values, blocks or blocks_for_region (deprecated).

Parameters
string$regionnameThe name of the custom region to add.
Return values
stringHTML for the block region.

◆ custom_menu()

core_renderer::custom_menu ( $custommenuitems = '')
inherited

Returns the custom menu if one has been set.

A custom menu can be configured by browsing to Settings: Administration > Appearance > Themes > Theme settings and then configuring the custommenu config setting as described.

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_custom_menu() instead.

Parameters
string$custommenuitems- custom menuitems set by theme instead of global theme settings
Return values
string

Reimplemented in core_renderer_maintenance.

◆ custom_menu_flat()

core_renderer::custom_menu_flat ( )
inherited

We want to show the custom menus as a list of links in the footer on small screens.

Just return the menu object exported so we can render it differently.

◆ darrow()

core_renderer::darrow ( )
inherited

Accessibility: Down arrow-like character.

If the theme does not set characters, appropriate defaults are set automatically.

Return values
string

◆ debug_footer_html()

core_renderer::debug_footer_html ( )
inherited

Performance information and validation links for debugging.

Return values
stringHTML fragment.

◆ doc_link()

core_renderer::doc_link ( $path,
$text = '',
$forcepopup = false,
array $attributes = [] )
inherited

Returns a string containing a link to the user documentation.

Also contains an icon by default. Shown to teachers and admin only.

Parameters
string$pathThe page link after doc root and language, no leading slash.
string$textThe text to be displayed for the link
boolean$forcepopupWhether to force a popup regardless of the value of $CFG->doctonewwindow
array$attributeshtm attributes
Return values
string

◆ doctype()

core_renderer::doctype ( )
inherited

Get the DOCTYPE declaration that should be used with this page.

Designed to be called in theme layout.php files.

Return values
stringthe DOCTYPE declaration that should be used.

◆ download_dataformat_selector()

core_renderer::download_dataformat_selector ( $label,
$base,
$name = 'dataformat',
$params = array() )
inherited

Returns a dataformat selection and download form.

Parameters
string$labelA text label
moodle_url | string$baseThe download page url
string$nameThe query param which will hold the type of the download
array$paramsExtra params sent to the download page
Return values
stringHTML fragment

◆ edit_button()

core_renderer::edit_button ( moodle_url $url,
string $method = 'post' )
inherited

Returns HTML to display a "Turn editing on/off" button in a form.

Parameters
moodle_url$urlThe URL + params to send through when clicking the button
string$method
Return values
stringHTML the button

◆ edit_switch()

core_renderer::edit_switch ( )
inherited

Create a navbar switch for toggling editing mode.

Return values
stringHtml containing the edit switch

◆ error_text()

core_renderer::error_text ( $message)
inherited

Output an error message.

By default wraps the error message in . If the error message is blank, nothing is output.

Parameters
string$messagethe error message.
Return values
stringthe HTML to output.

◆ fatal_error()

core_renderer_cli::fatal_error ( $message,
$moreinfourl,
$link,
$backtrace,
$debuginfo = null,
$errorcode = "" )

Returns a template fragment representing a fatal error.

Parameters
string$messageThe message to output
string$moreinfourlURL where more info can be found about the error
string$linkLink for the Continue button
array$backtraceThe execution backtrace
string$debuginfoDebugging information
Return values
stringA template fragment for a fatal error

Reimplemented from core_renderer.

◆ favicon()

core_renderer::favicon ( )
inherited

Returns the moodle_url for the favicon.

Since
Moodle 2.5.1 2.6
Return values
moodle_urlThe moodle_url for the favicon

◆ file_picker()

core_renderer::file_picker ( $options)
inherited

Returns HTML to display the file picker.

$OUTPUT->file_picker($options);

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_file_picker() instead.

Parameters
stdClass$optionsfile manager options options are: maxbytes=>-1, itemid=>0, client_id=>uniqid(), acepted_types=>'*', return_types=>FILE_INTERNAL, context=>current page context
Return values
stringHTML fragment

Reimplemented in core_renderer_maintenance.

◆ footer()

core_renderer_cli::footer ( )

There is no footer for a cli request, however we must override the footer method to prevent the default footer.

Reimplemented from core_renderer.

◆ full_header()

core_renderer::full_header ( )
inherited

Wrapper for header elements.

Return values
stringHTML to display the main header.

◆ get_compact_logo_url()

renderer_base::get_compact_logo_url ( $maxwidth = 300,
$maxheight = 300 )
inherited

Return the site's compact logo URL, if any.

Parameters
int$maxwidthThe maximum width, or null when the maximum width does not matter.
int$maxheightThe maximum height, or null when the maximum height does not matter.
Return values
moodle_url|false

◆ get_generated_color_for_id()

core_renderer::get_generated_color_for_id ( $id)
inherited

Get the course color to show on a course card.

Parameters
int$idId to use when generating the color.
Return values
stringhex color code.

◆ get_generated_image_for_id()

core_renderer::get_generated_image_for_id ( $id)
inherited

Get the course pattern datauri to show on a course card.

The datauri is an encoded svg that can be passed as a url.

Parameters
int$idId to use when generating the pattern
Return values
stringdatauri

◆ get_generated_svg_for_id()

core_renderer::get_generated_svg_for_id ( int $id)
inherited

Get the course pattern in SVG format to show on a course card.

Parameters
int$idid to use when generating the pattern
Return values
stringSVG file contents

◆ get_generated_url_for_course()

core_renderer::get_generated_url_for_course ( context_course $context)
inherited

Get the course pattern image URL.

Parameters
context_course$contextcourse context object
Return values
stringURL of the course pattern image in SVG format

◆ get_logo_url()

renderer_base::get_logo_url ( $maxwidth = null,
$maxheight = 200 )
inherited

Return the site's logo URL, if any.

Parameters
int$maxwidthThe maximum width, or null when the maximum width does not matter.
int$maxheightThe maximum height, or null when the maximum height does not matter.
Return values
moodle_url|false

◆ get_mustache()

renderer_base::get_mustache ( )
protectedinherited

Return an instance of the mustache class.

Since
2.9
Return values
Mustache_Engine

◆ has_communication_links()

core_renderer::has_communication_links ( )
inherited

Helper function to decide whether to show the communication link or not.

Return values
bool

◆ has_popover_links()

core_renderer::has_popover_links ( )
inherited

Helper function to decide whether to show the help popover header or not.

Return values
bool

◆ has_started()

renderer_base::has_started ( )
inherited

Returns true is output has already started, and false if not.

Return values
booleantrue if the header has been printed.

◆ header()

core_renderer_cli::header ( )

Returns the page header.

Return values
stringHTML fragment

Reimplemented from core_renderer.

◆ heading()

core_renderer_cli::heading ( $text,
$level = 2,
$classes = 'main',
$id = null )

Returns a template fragment representing a Heading.

Parameters
string$textThe text of the heading
int$levelThe level of importance of the heading
string$classesA space-separated list of CSS classes
string$idAn optional ID
Return values
stringA template fragment for a heading

Reimplemented from core_renderer.

◆ heading_with_help()

core_renderer::heading_with_help ( $text,
$helpidentifier,
$component = 'moodle',
$icon = '',
$iconalt = '',
$level = 2,
$classnames = null )
inherited

Centered heading with attached help button (same title text) and optional icon attached.

Parameters
string$textA heading text
string$helpidentifierThe keyword that defines a help page
string$componentcomponent name
string | moodle_url$icon
string$iconalticon alt text
int$levelThe level of importance of the heading. Defaulting to 2
string$classnamesA space-separated list of CSS classes. Defaulting to null
Return values
stringHTML fragment

◆ help_icon()

core_renderer::help_icon ( $identifier,
$component = 'moodle',
$linktext = '',
$a = null )
inherited

Returns HTML to display a help icon.

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_help_icon() instead.

Parameters
string$identifierThe keyword that defines a help page
string$componentcomponent name
string | bool$linktexttrue means use $title as link text, string means link text value
string | object | array | int$aAn object, string or number that can be used within translation strings
Return values
stringHTML fragment

◆ help_icon_scale()

core_renderer::help_icon_scale ( $courseid,
stdClass $scale )
inherited

Returns HTML to display a scale help icon.

Parameters
int$courseid
stdClass$scaleinstance
Return values
stringHTML fragment

◆ home_link()

core_renderer::home_link ( )
inherited

Return the 'back' link that normally appears in the footer.

Return values
stringHTML fragment.

◆ htmlattributes()

core_renderer::htmlattributes ( )
inherited

The attributes that should be added to the <html> tag.

Designed to be called in theme layout.php files.

Return values
stringHTML fragment.

◆ htmllize_file_tree()

core_renderer::htmllize_file_tree ( )
inherited
Deprecated
since Moodle 4.3

◆ image_icon()

core_renderer::image_icon ( $pix,
$alt,
$component = 'moodle',
array $attributes = null )
inherited

Return HTML for an image_icon.

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_image_icon() instead.

Parameters
string$pixshort pix name
string$altmandatory alt attribute
string$componentstandard compoennt name like 'moodle', 'mod_forum', etc.
array$attributeshtm attributes
Return values
stringHTML fragment

◆ image_url()

renderer_base::image_url ( $imagename,
$component = 'moodle' )
inherited

Return the moodle_url for an image.

The exact image location and extension is determined automatically by searching for gif|png|jpg|jpeg, please note there can not be diferent images with the different extension. The imagename is for historical reasons a relative path name, it may be changed later for core images. It is recommended to not use subdirectories in plugin and theme pix directories.

There are three types of images: 1/ theme images - stored in theme/mytheme/pix/, use component 'theme' 2/ core images - stored in /pix/, overridden via theme/mytheme/pix_core/ 3/ plugin images - stored in mod/mymodule/pix, overridden via theme/mytheme/pix_plugins/mod/mymodule/, example: image_url('comment', 'mod_glossary')

Parameters
string$imagenamethe pathname of the image
string$componentfull plugin name (aka component) or 'theme'
Return values
moodle_url

◆ initials_bar()

core_renderer::initials_bar ( $current,
$class,
$title,
$urlvar,
$url,
$alpha = null,
bool $minirender = false )
inherited

Returns HTML to display initials bar to provide access to other pages (usually in a search)

Parameters
string$currentthe currently selected letter.
string$classclass name to add to this initial bar.
string$titlethe name to put in front of this initial bar.
string$urlvarURL parameter name for this initial.
string$urlURL object.
array$alphaof letters in the alphabet.
bool$minirenderReturn a trimmed down view of the initials bar.
Return values
stringthe HTML to output.

◆ is_login_page()

core_renderer::is_login_page ( )
protectedinherited

Check whether the current page is a login page.

Since
Moodle 2.9
Return values
bool

◆ lang_menu()

core_renderer::lang_menu ( )
inherited

Returns lang menu or '', this method also checks forcing of languages in courses.

This function calls core_renderer::render_single_select() to actually display the language menu.

Return values
stringThe lang menu HTML or empty string

Reimplemented in core_renderer_maintenance.

◆ larrow()

core_renderer::larrow ( )
inherited

Accessibility: Left arrow-like character is used in the breadcrumb trail, course navigation menu (previous/next activity), calendar, and search forum block.

If the theme does not set characters, appropriate defaults are set automatically. Please DO NOT use < > » - these are confusing for blind users.

Return values
string

◆ list_block_contents()

core_renderer::list_block_contents ( $icons,
$items )
inherited

Render the contents of a block_list.

Parameters
array$iconsthe icon for each item.
array$itemsthe content of each item.
Return values
stringHTML

◆ login_info()

core_renderer::login_info ( $withlinks = null)
inherited

Return the standard string that says whether you are logged in (and switched roles/logged in as another user).

Parameters
bool$withlinksif false, then don't include any links in the HTML produced. If not set, the default is the nologinlinks option from the theme config.php file, and if that is not set, then links are included.
Return values
stringHTML fragment.

Reimplemented in core_renderer_maintenance.

◆ main_content()

core_renderer::main_content ( )
inherited

Returns standard main content placeholder.

Designed to be called in theme layout.php files.

Return values
stringHTML fragment.

◆ maintenance_warning()

core_renderer::maintenance_warning ( )
inherited

Scheduled maintenance warning message.

Note: This is a nasty hack to display maintenance notice, this should be moved to some general notification area once we have it.

Return values
string

◆ mform_element()

core_renderer::mform_element ( $element,
$required,
$advanced,
$error,
$ingroup )
inherited

Renders an mform element from a template.

Parameters
HTML_QuickForm_element$elementelement
bool$requiredif input is required field
bool$advancedif input is an advanced field
string$errorerror message to display
bool$ingroupTrue if this element is rendered as part of a group
Return values
mixedstring|bool

◆ moodle_release()

core_renderer::moodle_release ( )
inherited

Renders release information in the footer popup.

Return values
stringMoodle release info.

◆ navbar()

core_renderer::navbar ( )
inherited

This renders the navbar.

Uses bootstrap compatible html.

◆ navbar_plugin_output()

core_renderer::navbar_plugin_output ( )
inherited

Allow plugins to provide some content to be rendered in the navbar.

The plugin must define a PLUGIN_render_navbar_output function that returns the HTML they wish to add to the navbar.

Return values
stringHTML for the navbar

◆ notification()

core_renderer_cli::notification ( $message,
$type = null,
$closebutton = true )

Returns a template fragment representing a notification.

Parameters
string$messageThe message to print out.
string$typeThe type of notification. See constants on core\output\notification.
bool$closebuttonWhether to show a close icon to remove the notification (default true).
Return values
stringA template fragment for a notification

Reimplemented from core_renderer.

◆ notify_message()

core_renderer::notify_message ( )
inherited
Deprecated
since Moodle 3.1 MDL-30811 - please do not use this function any more.

◆ notify_problem()

core_renderer::notify_problem ( )
inherited
Deprecated
since Moodle 3.1 MDL-30811 - please do not use this function any more.

◆ notify_redirect()

core_renderer::notify_redirect ( )
inherited
Deprecated
since Moodle 3.1 MDL-30811 - please do not use this function any more.

◆ notify_success()

core_renderer::notify_success ( )
inherited
Deprecated
since Moodle 3.1 MDL-30811 - please do not use this function any more.

◆ old_help_icon()

core_renderer::old_help_icon ( $helpidentifier,
$title,
$component = 'moodle',
$linktext = '' )
inherited

Returns HTML to display a help icon.

Deprecated
since Moodle 2.0

◆ page_doc_link()

core_renderer::page_doc_link ( $text = null)
inherited

Returns the Moodle docs link to use for this page.

Since
Moodle 2.5.1 2.6
Parameters
string$text
Return values
string

◆ page_heading()

core_renderer::page_heading ( $tag = 'h1')
inherited

Gets HTML for the page heading.

Since
Moodle 2.5.1 2.6
Parameters
string$tagThe tag to encase the heading in. h1 by default.
Return values
stringHTML.

◆ page_heading_button()

core_renderer::page_heading_button ( )
inherited

Gets the HTML for the page heading button.

Since
Moodle 2.5.1 2.6
Return values
stringHTML.

◆ page_heading_menu()

core_renderer::page_heading_menu ( )
inherited

Returns the page heading menu.

Since
Moodle 2.5.1 2.6
Return values
stringHTML.

◆ page_title()

core_renderer::page_title ( )
inherited

Returns the title to use on the page.

Since
Moodle 2.5.1 2.6
Return values
string

◆ paging_bar()

core_renderer::paging_bar ( $totalcount,
$page,
$perpage,
$baseurl,
$pagevar = 'page' )
inherited

Returns HTML to display a single paging bar to provide access to other pages (usually in a search)

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_paging_bar() instead.

Parameters
int$totalcountThe total number of entries available to be paged through
int$pageThe page you are currently viewing
int$perpageThe number of entries that should be shown per page
string | moodle_url$baseurlurl of the current page, the $pagevar parameter is added
string$pagevarname of page parameter that holds the page number
Return values
stringthe HTML to output.

◆ paragraph()

core_renderer::paragraph ( string $contents,
?string $classes = null,
?string $id = null )
inherited

Outputs a paragraph.

Parameters
string$contentsThe contents of the paragraph
string | null$classesA space-separated list of CSS classes
string | null$idAn optional ID
Return values
stringthe HTML to output.

◆ pix_icon()

core_renderer::pix_icon ( $pix,
$alt,
$component = 'moodle',
array $attributes = null )
inherited

Return HTML for a pix_icon.

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_pix_icon() instead.

Parameters
string$pixshort pix name
string$altmandatory alt attribute
string$componentstandard compoennt name like 'moodle', 'mod_forum', etc.
array$attributeshtm lattributes
Return values
stringHTML fragment

◆ pix_url()

renderer_base::pix_url ( $imagename,
$component = 'moodle' )
inherited

Return the direct URL for an image from the pix folder.

Use this function sparingly and never for icons. For icons use pix_icon or the pix helper in a mustache template.

Deprecated
since Moodle 3.3
Parameters
string$imagenamethe name of the icon.
string$componentspecification of one plugin like in get_string()
Return values
moodle_url

◆ prepare_classes()

static renderer_base::prepare_classes ( $classes)
staticinherited

Given an array or space-separated list of classes, prepares and returns the HTML class attribute value.

Parameters
mixed$classesSpace-separated string or array of classes
Return values
stringHTML class attribute value

◆ print_textarea()

core_renderer::print_textarea ( $name,
$id,
$value,
$rows,
$cols )
inherited

Returns the HTML for a basic textarea field.

Parameters
string$nameName to use for the textarea element
string$idThe id to use fort he textarea element
string$valueInitial content to display in the textarea
int$rowsNumber of rows to display
int$colsNumber of columns to display
Return values
stringthe HTML to display

◆ rarrow()

core_renderer::rarrow ( )
inherited

Accessibility: Right arrow-like character is used in the breadcrumb trail, course navigation menu (previous/next activity), calendar, and search forum block.

If the theme does not set characters, appropriate defaults are set automatically. Please DO NOT use < > » - these are confusing for blind users.

Return values
string

◆ redirect_message()

core_renderer::redirect_message ( $encodedurl,
$message,
$delay,
$debugdisableredirect,
$messagetype = core\output\notification::NOTIFY_INFO )
inherited

Redirects the user by any means possible given the current state.

This function should not be called directly, it should always be called using the redirect function in lib/weblib.php

The redirect function should really only be called before page output has started however it will allow itself to be called during the state STATE_IN_BODY

Parameters
string$encodedurlThe URL to send to encoded if required
string$messageThe message to display to the user if any
int$delayThe delay before redirecting a user, if $message has been set this is a requirement and defaults to 3, set to 0 no delay
boolean$debugdisableredirectthis redirect has been disabled for debugging purposes. Display a message that explains, and don't trigger the redirect.
string$messagetypeThe type of notification to show the message in. See constants on core\output\notification.
Return values
stringThe HTML to display to the user before dying, may contain meta refresh, javascript refresh, and may have set header redirects

Reimplemented in core_renderer_ajax.

◆ region_main_settings_menu()

core_renderer::region_main_settings_menu ( )
inherited

This is an optional menu that can be added to a layout by a theme.

It contains the menu for the most specific thing from the settings block. E.g. Module administration.

Return values
string

◆ render()

renderer_base::render ( renderable $widget)
inherited

Returns rendered widget.

The provided widget needs to be an object that extends the renderable interface. If will then be rendered by a method based upon the classname for the widget. For instance a widget of class crazywidget will be rendered by a protected render_crazywidget method of this renderer. If no render_crazywidget method exists and crazywidget implements templatable, look for the 'crazywidget' template in the same component and render that.

Parameters
renderable$widgetinstance with renderable interface
Return values
string

Reimplemented in core_courseformat\output\section_renderer, plugin_renderer_base, and tool_policy\output\renderer.

◆ render_action_link()

core_renderer::render_action_link ( action_link $link)
protectedinherited

Renders an action_link object.

The provided link is renderer and the HTML returned. At the same time the associated actions are setup in JS by core_renderer::add_action_handler()

Parameters
action_link$link
Return values
stringHTML fragment

◆ render_action_menu()

core_renderer::render_action_menu ( action_menu $menu)
inherited

Renders an action menu component.

Parameters
action_menu$menu
Return values
stringHTML

◆ render_action_menu_filler()

core_renderer::render_action_menu_filler ( action_menu_filler $action)
protectedinherited

Renders a primary action_menu_filler item.

Parameters
action_menu_link_filler$action
Return values
stringHTML fragment

◆ render_action_menu_link()

core_renderer::render_action_menu_link ( action_menu_link $action)
protectedinherited

Renders an action_menu_link item.

Parameters
action_menu_link$action
Return values
stringHTML fragment

◆ render_action_menu_link_primary()

core_renderer::render_action_menu_link_primary ( action_menu_link_primary $action)
protectedinherited

Renders a primary action_menu_link item.

Parameters
action_menu_link_primary$action
Return values
stringHTML fragment

◆ render_action_menu_link_secondary()

core_renderer::render_action_menu_link_secondary ( action_menu_link_secondary $action)
protectedinherited

Renders a secondary action_menu_link item.

Parameters
action_menu_link_secondary$action
Return values
stringHTML fragment

◆ render_breadcrumb_navigation_node()

core_renderer::render_breadcrumb_navigation_node ( breadcrumb_navigation_node $item)
protectedinherited

Renders a breadcrumb navigation node object.

Parameters
breadcrumb_navigation_node$itemThe navigation node to render.
Return values
stringHTML fragment

◆ render_chart()

core_renderer::render_chart ( \core\chart_base $chart,
$withtable = true )
inherited

Renders a chart.

Parameters
core\chart_base$chartThe chart.
bool$withtableWhether to include a data table with the chart.
Return values
string

◆ render_chart_bar()

core_renderer::render_chart_bar ( \core\chart_bar $chart)
inherited

Renders a bar chart.

Parameters
core\chart_bar$chartThe chart.
Return values
string

◆ render_chart_line()

core_renderer::render_chart_line ( \core\chart_line $chart)
inherited

Renders a line chart.

Parameters
core\chart_line$chartThe chart.
Return values
string

◆ render_chart_pie()

core_renderer::render_chart_pie ( \core\chart_pie $chart)
inherited

Renders a pie chart.

Parameters
core\chart_pie$chartThe chart.
Return values
string

◆ render_check_result()

core_renderer_cli::render_check_result ( core\check\result $result)
protected

Renders a Check API result.

To aid in CLI consistency this status is NOT translated and the visual width is always exactly 10 chars.

Parameters
core\check\result$result
Return values
stringHTML fragment

Reimplemented from core_renderer.

◆ render_checkbox_toggleall()

core_renderer::render_checkbox_toggleall ( \core\output\checkbox_toggleall $element)
inherited

Renders element for a toggle-all checkbox.

Parameters
core\output\checkbox_toggleall$element
Return values
string

◆ render_context_header()

core_renderer::render_context_header ( context_header $contextheader)
protectedinherited

Renders the header bar.

Parameters
context_header$contextheaderHeader bar object.
Return values
stringHTML for the header bar.

◆ render_custom_menu()

core_renderer::render_custom_menu ( custom_menu $menu)
protectedinherited

Renders a custom menu object (located in outputcomponents.php)

The custom menu this method produces makes use of the YUI3 menunav widget and requires very specific html elements and classes.

@staticvar int $menucount

Parameters
custom_menu$menu
Return values
string

◆ render_custom_menu_item()

core_renderer::render_custom_menu_item ( custom_menu_item $menunode)
protectedinherited

Renders a custom menu node as part of a submenu.

The custom menu this method produces makes use of the YUI3 menunav widget and requires very specific html elements and classes.

See also
core:renderer::render_custom_menu()

@staticvar int $submenucount

Parameters
custom_menu_item$menunode
Return values
string

◆ render_digital_minor_page()

core_renderer::render_digital_minor_page ( $page)
protectedinherited

Render the digital minor contact information page into a nice template for the theme.

Parameters
core_auth\output\digital_minor_page$pageThe renderable
Return values
string

◆ render_file_picker()

core_renderer::render_file_picker ( file_picker $fp)
inherited

Internal implementation of file picker rendering.

Parameters
file_picker$fp
Return values
string

◆ render_from_template()

renderer_base::render_from_template ( $templatename,
$context )
inherited

Renders a template by name with the given context.

The provided data needs to be array/stdClass made up of only simple types. Simple types are array,stdClass,bool,int,float,string

Since
2.9
Parameters
array | stdClass$contextContext containing data for the template.
Return values
string|boolean

◆ render_help_icon()

core_renderer::render_help_icon ( help_icon $helpicon)
protectedinherited

Implementation of user image rendering.

Parameters
help_icon$helpiconA help icon instance
Return values
stringHTML fragment

◆ render_image_icon()

core_renderer::render_image_icon ( image_icon $icon)
protectedinherited

Renders a pix_icon widget and returns the HTML to display it.

Parameters
image_icon$icon
Return values
stringHTML fragment

◆ render_initials_bar()

core_renderer::render_initials_bar ( initials_bar $initialsbar)
protectedinherited

Internal implementation of initials bar rendering.

Parameters
initials_bar$initialsbar
Return values
string

◆ render_inplace_editable()

core_renderer::render_inplace_editable ( \core\output\inplace_editable $element)
inherited

Renders element for inline editing of any value.

Parameters
core\output\inplace_editable$element
Return values
string

◆ render_login()

core_renderer::render_login ( \core_auth\output\login $form)
inherited

Renders the login form.

Parameters
core_auth\output\login$formThe renderable.
Return values
string

◆ render_login_signup_form()

core_renderer::render_login_signup_form ( $form)
inherited

Render the login signup form into a nice template for the theme.

Parameters
mform$form
Return values
string

◆ render_navigation_node()

core_renderer::render_navigation_node ( navigation_node $item)
protectedinherited

Renders a navigation node object.

Parameters
navigation_node$itemThe navigation node to render.
Return values
stringHTML fragment

◆ render_notification()

core_renderer_cli::render_notification ( \core\output\notification $notification)

Render a notification (that is, a status message about something that has just happened).

Parameters
core\output\notification$notificationthe notification to print out
Return values
stringplain text output

Reimplemented from core_renderer.

◆ render_page_layout()

core_renderer::render_page_layout ( $layoutfile)
protectedinherited

Renders and outputs the page layout file.

This is done by preparing the normal globals available to a script, and then including the layout file provided by the current theme for the requested layout.

Parameters
string$layoutfileThe name of the layout file
Return values
stringHTML code

◆ render_paging_bar()

core_renderer::render_paging_bar ( paging_bar $pagingbar)
protectedinherited

Returns HTML to display the paging bar.

Parameters
paging_bar$pagingbar
Return values
stringthe HTML to output.

◆ render_participants_tertiary_nav()

core_renderer::render_participants_tertiary_nav ( object $course,
?string $renderedbuttons = null )
inherited

Renders the tertiary nav for the participants page.

Parameters
object$courseThe course we are operating within
string | null$renderedbuttonsAny additional buttons/content to be displayed in line with the nav
Return values
string

◆ render_pix_emoticon()

core_renderer::render_pix_emoticon ( pix_emoticon $emoticon)
protectedinherited

Return HTML to display an emoticon icon.

Parameters
pix_emoticon$emoticon
Return values
stringHTML fragment

◆ render_pix_icon()

core_renderer::render_pix_icon ( pix_icon $icon)
protectedinherited

Renders a pix_icon widget and returns the HTML to display it.

Parameters
pix_icon$icon
Return values
stringHTML fragment

◆ render_preferences_group()

core_renderer::render_preferences_group ( preferences_group $renderable)
inherited

Renders preferences group.

Parameters
preferences_group$renderableThe renderable
Return values
stringThe output.

◆ render_preferences_groups()

core_renderer::render_preferences_groups ( preferences_groups $renderable)
inherited

Renders preferences groups.

Parameters
preferences_groups$renderableThe renderable
Return values
stringThe output.

◆ render_progress_bar()

core_renderer_cli::render_progress_bar ( progress_bar $bar)

Renders a progress bar.

Do not use $OUTPUT->render($bar), instead use progress_bar\create().

Parameters
progress_bar$barThe bar.
Return values
stringascii fragment

Reimplemented from core_renderer.

◆ render_progress_bar_update()

core_renderer_cli::render_progress_bar_update ( string $id,
float $percent,
string $msg,
string $estimate )

Renders an update to a progress bar.

Note: This does not cleanly map to a renderable class and should never be used directly.

Parameters
string$id
float$percent
string$msgMessage
string$estimatetime remaining message
Return values
stringascii fragment

Reimplemented from core_renderer.

◆ render_rating()

core_renderer::render_rating ( rating $rating)
inherited

Produces the html that represents this rating in the UI.

Parameters
rating$ratingthe page object on which this rating will appear
Return values
string

◆ render_single_button()

core_renderer::render_single_button ( single_button $button)
protectedinherited

Renders a single button widget.

This will return HTML to display a form containing a single button.

Parameters
single_button$button
Return values
stringHTML fragment

◆ render_single_select()

core_renderer::render_single_select ( single_select $select)
protectedinherited

Internal implementation of single_select rendering.

Parameters
single_select$select
Return values
stringHTML fragment

◆ render_skip_links()

core_renderer::render_skip_links ( $links)
inherited

Renders the skip links for the page.

Parameters
array$linksList of skip links.
Return values
stringHTML for the skip links.

◆ render_tabobject()

core_renderer::render_tabobject ( tabobject $tabobject)
protectedinherited

Renders tabobject (part of tabtree)

This function is called from core_renderer::render_tabtree() and also it calls itself when printing the $tabobject subtree recursively.

Property $tabobject->level indicates the number of row of tabs.

Parameters
tabobject$tabobject
Return values
stringHTML fragment

◆ render_tabtree()

core_renderer::render_tabtree ( tabtree $tabtree)
protectedinherited

Renders tabtree.

Parameters
tabtree$tabtree
Return values
string

◆ render_url_select()

core_renderer::render_url_select ( url_select $select)
protectedinherited

Internal implementation of url_select rendering.

Parameters
url_select$select
Return values
stringHTML fragment

◆ render_user_picture()

core_renderer::render_user_picture ( user_picture $userpicture)
protectedinherited

Internal implementation of user image rendering.

Parameters
user_picture$userpicture
Return values
string

◆ render_verify_age_location_page()

core_renderer::render_verify_age_location_page ( $page)
protectedinherited

Render the verify age and location page into a nice template for the theme.

Parameters
core_auth\output\verify_age_location_page$pageThe renderable
Return values
string

◆ search_box()

core_renderer::search_box ( $id = false)
inherited

Returns a search box.

Parameters
string$idThe search box wrapper div id, defaults to an autogenerated one.
Return values
stringHTML with the search form hidden by default.

◆ secure_layout_language_menu()

core_renderer::secure_layout_language_menu ( )
inherited

Returns the language menu in the secure layout.

No custom menu items are passed though, such that it will render only the language selection.

Return values
string

◆ secure_layout_login_info()

core_renderer::secure_layout_login_info ( )
inherited

Secure layout login info.

Return values
string

◆ select_element_for_append()

core_renderer::select_element_for_append ( string $selector = '#region-main [role=main]',
string $element = 'div' )
inherited

Prepares an element for streaming output.

This must be used with NO_OUTPUT_BUFFERING set to true. After using this method any subsequent prints or echos to STDOUT result in the outputted content magically being appended inside that element rather than where the current html would be normally. This enables pages which take some time to render incremental content to first output a fully formed html page, including the footer, and to then stream into an element such as the main content div. This fixes a class of page layout bugs and reduces layout shift issues and was inspired by Facebook BigPipe.

Some use cases such as a simple page which loads content via ajax could be swapped to this method wich saves another http request and its network latency resulting in both lower server load and better front end performance.

You should consider giving the element you stream into a minimum height to further reduce layout shift as the content initally streams into the element.

You can safely finish the output without closing the streamed element. You can also call this method again to swap the target of the streaming to a new element as often as you want.

https://www.youtube.com/watch?v=LLRig4s1_yA&t=1022s Watch this video segment to explain how and why this 'One Weird Trick' works.

Parameters
string$selectorwhere new content should be appended
string$elementwhich contains the streamed content
Return values
stringhtml to be written

◆ select_element_for_replace()

core_renderer::select_element_for_replace ( string $selector,
string $html,
bool $outer = false )
inherited

A companion method to select_element_for_append.

This must be used with NO_OUTPUT_BUFFERING set to true.

This is similar but instead of appending into the element it replaces the content in the element. Depending on the 3rd argument it can replace the innerHTML or the outerHTML which can be useful to completely remove the element if needed.

Parameters
string$selectorwhere new content should be replaced
string$htmlA chunk of well formed html
bool$outerWether it replaces the innerHTML or the outerHTML
Return values
stringhtml to be written

◆ services_support_link()

core_renderer::services_support_link ( )
inherited

Returns the services and support link for the help pop-up.

Return values
string

◆ should_display_main_logo()

renderer_base::should_display_main_logo ( $headinglevel = 1)
inherited

Whether we should display the main logo.

Deprecated
since Moodle 4.0
Todo
final deprecation. To be removed in Moodle 4.4 MDL-73165.
Parameters
int$headinglevelThe heading level we want to check against.
Return values
bool

◆ should_display_navbar_logo()

renderer_base::should_display_navbar_logo ( )
inherited

Whether we should display the logo in the navbar.

We will when there are no main logos, and we have compact logo.

Return values
bool

◆ single_button()

core_renderer::single_button ( $url,
$label,
$method = 'post',
array $options = null )
inherited

Returns a form with a single button.

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_single_button() instead.

Parameters
string | moodle_url$url
string$labelbutton text
string$methodget or post submit method
array$optionsassociative array {disabled, title, etc.}
Return values
stringHTML fragment

◆ single_select()

core_renderer::single_select ( $url,
$name,
array $options,
$selected = '',
$nothing = array('' => 'choosedots'),
$formid = null,
$attributes = array() )
inherited

Returns a form with a single select widget.

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_single_select() instead.

Parameters
moodle_url$urlform action target, includes hidden fields
string$namename of selection field - the changing parameter in url
array$optionslist of options
string$selectedselected element
array$nothing
string$formid
array$attributesother attributes for the single select
Return values
stringHTML fragment

◆ skip_link_target()

core_renderer::skip_link_target ( $id = null)
inherited

Output the place a skip link goes to.

Parameters
string$idThe target name from the corresponding $PAGE->requires->skip_link_to($target) call.
Return values
stringthe HTML to output.

◆ spacer()

core_renderer::spacer ( array $attributes = null,
$br = false )
inherited

Creates and returns a spacer image with optional line break.

Parameters
array$attributesAny HTML attributes to add to the spaced.
bool$brInclude a BR after the spacer.... DON'T USE THIS. Don't be laxy do it with CSS which is a much better solution.
Return values
stringHTML fragment

◆ sr_text()

core_renderer::sr_text ( string $contents)
inherited

Outputs a screen reader only inline text.

Parameters
string$contentsThe contents of the paragraph
Return values
stringthe HTML to output.

◆ standard_after_main_region_html()

core_renderer::standard_after_main_region_html ( )
inherited

The standard HTML that should be output just before the <footer> tag.

Designed to be called in theme layout.php files.

Return values
stringHTML fragment.

◆ standard_end_of_body_html()

core_renderer::standard_end_of_body_html ( )
inherited

The standard tags (typically script tags that are not needed earlier) that should be output after everything else.

Designed to be called in theme layout.php files.

Return values
stringHTML fragment.

◆ standard_footer_html()

core_renderer::standard_footer_html ( )
inherited

content that should be output in the footer area of the page.

Designed to be called in theme layout.php files.

Return values
stringHTML fragment.

◆ standard_head_html()

core_renderer::standard_head_html ( )
inherited

The standard tags (meta tags, links to stylesheets and JavaScript, etc.) that should be included in the <head> tag.

Designed to be called in theme layout.php files.

Return values
stringHTML fragment.

◆ standard_top_of_body_html()

core_renderer::standard_top_of_body_html ( )
inherited

The standard tags (typically skip links) that should be output just inside the start of the <body> tag.

Designed to be called in theme layout.php files.

Return values
stringHTML fragment.

◆ supportemail()

core_renderer::supportemail ( array $customattribs = [],
bool $embed = false )
inherited

Returns the HTML for the site support email link.

Parameters
array$customattribsArray of custom attributes for the support email anchor tag.
bool$embedSet to true if you want to embed the link in other inline content.
Return values
stringThe html code for the support email link.

◆ tabtree()

core_renderer::tabtree ( $tabs,
$selected = null,
$inactive = null )
finalinherited

Renders tabs.

This function replaces print_tabs() used before Moodle 2.5 but with slightly different arguments

Theme developers: In order to change how tabs are displayed please override functions core_renderer::render_tabtree() and/or core_renderer::render_tabobject()

Parameters
array$tabsarray of tabs, each of them may have it's own ->subtree
string | null$selectedwhich tab to mark as selected, all parent tabs will automatically be marked as activated
array | string | null$inactivelist of ids of inactive tabs, regardless of their level. Note that you can as weel specify tabobject\$inactive for separate instances
Return values
string

◆ tag_list()

core_renderer::tag_list ( $tags,
$label = null,
$classes = '',
$limit = 10,
$pagecontext = null,
$accesshidelabel = false )
inherited

Displays the list of tags associated with an entry.

Parameters
array$tagslist of instances of core_tag or stdClass
string$labellabel to display in front, by default 'Tags' (get_string('tags')), set to null to use default, set to '' (empty string) to omit the label completely
string$classesadditional classes for the enclosing div element
int$limitlimit the number of tags to display, if size of $tags is more than this limit the "more" link will be appended to the end, JS will toggle the rest of the tags
context$pagecontextspecify if needed to overwrite the current page context for the view tag link
bool$accesshidelabelif true, the label should have class="accesshide" added.
Return values
string

◆ theme_switch_links()

core_renderer::theme_switch_links ( )
protectedinherited

Renders theme links for switching between default and other themes.

Return values
string

◆ tree_block_contents()

core_renderer::tree_block_contents ( $items,
$attrs = array() )
inherited

Make nested HTML lists out of the items.

The resulting list will look something like this:

<
<>
(item contents)
<
>
(item contents)
<> <> <> <>
Parameters
array$items
array$attrshtml attributes passed to the top ofs the list
Return values
stringHTML

◆ uarrow()

core_renderer::uarrow ( )
inherited

Accessibility: Up arrow-like character is used in the book heirarchical navigation.

If the theme does not set characters, appropriate defaults are set automatically. Please DO NOT use ^ - this is confusing for blind users.

Return values
string

◆ update_module_button()

core_renderer::update_module_button ( )
inherited
Deprecated
since Moodle 3.2

◆ url_select()

core_renderer::url_select ( array $urls,
$selected,
$nothing = array('' => 'choosedots'),
$formid = null )
inherited

Returns a form with a url select widget.

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_url_select() instead.

Parameters
array$urlslist of urls - array('/course/view.php?id=1'=>'Frontpage', ....)
string$selectedselected element
array$nothing
string$formid
Return values
stringHTML fragment

◆ user_menu()

core_renderer::user_menu ( $user = null,
$withlinks = null )
inherited

Construct a user menu, returning HTML that can be echoed out by a layout file.

Parameters
stdClass$userA user object, usually $USER.
bool$withlinkstrue if a dropdown should be built.
Return values
stringHTML fragment.

◆ user_picture()

core_renderer::user_picture ( stdClass $user,
array $options = null )
inherited

Returns HTML to display the specified user's avatar.

User avatar may be obtained in two ways:

// Option 1: (shortcut for simple cases, preferred way)
// $user has come from the DB and has fields id, picture, imagealt, firstname and lastname
$OUTPUT->user_picture($user, array('popup'=>true));

// Option 2:
$userpic = new user_picture($user);
// Set properties of $userpic
$userpic->popup = true;
$OUTPUT->render($userpic);

Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_user_picture() instead.

Parameters
stdClass$userObject with at least fields id, picture, imagealt, firstname, lastname If any of these are missing, the database is queried. Avoid this if at all possible, particularly for reports. It is very bad for performance.
array$optionsassociative array with user picture options, used only if not a user_picture object, options are:
  • courseid=$this->page->course->id (course id of user profile in link)
  • size=35 (size of image)
  • link=true (make image clickable - the link leads to user profile)
  • popup=false (open in popup)
  • alttext=true (add image alt attribute)
  • class = image class attribute (default 'userpicture')
  • visibletoscreenreaders=true (whether to be visible to screen readers)
  • includefullname=false (whether to include the user's full name together with the user picture)
  • includetoken = false (whether to use a token for authentication. True for current user, int value for other user id)
Return values
stringHTML fragment

Reimplemented in core_renderer_maintenance.

Member Data Documentation

◆ MAIN_CONTENT_TOKEN

string const core_renderer::MAIN_CONTENT_TOKEN = '[MAIN CONTENT GOES HERE]'
inherited

Do NOT use, please use <?php echo $OUTPUT->main_content() ?> in layout files instead.

Deprecated
used in core_renderer::header().

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