Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
The standard implementation of the core_renderer interface. More...
Public Member Functions | |
__construct (moodle_page $page, $target) | |
Constructor. | |
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="") | |
Do not call this function directly. | |
favicon () | |
Returns the moodle_url for the favicon. | |
file_picker ($options) | |
Returns HTML to display the file picker. | |
footer () | |
Outputs the page's 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 () | |
Start output by sending the HTTP headers, and printing the HTML <head> and the start of the <body>. | |
heading ($text, $level=2, $classes=null, $id=null) | |
Outputs 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) | |
Output a notification (that is, a status message about something that has just happened). | |
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_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_notification (\core\output\notification $notification) | |
Render a notification (that is, a status message about something that has just happened). | |
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. | |
The standard implementation of the core_renderer interface.
core_renderer::__construct | ( | moodle_page | $page, |
$target ) |
Constructor.
moodle_page | $page | the page we are doing output for. |
string | $target | one of rendering target constants |
Reimplemented from renderer_base.
Reimplemented in core_renderer_maintenance.
core_renderer::action_icon | ( | $url, | |
pix_icon | $pixicon, | ||
component_action | $action = null, | ||
array | $attributes = null, | ||
$linktext = false ) |
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().
string | moodle_url | $url | A string URL or moodel_url |
pix_icon | $pixicon | |
component_action | $action | |
array | $attributes | associative array of html link attributes + disabled |
bool | $linktext | show title next to image in link |
string | HTML fragment |
core_renderer::action_link | ( | $url, | |
$text, | |||
component_action | $action = null, | ||
array | $attributes = null, | ||
$icon = null ) |
Renders a special html link with attached action.
Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_action_link() instead.
string | moodle_url | $url | |
string | $text | HTML fragment |
component_action | $action | |
array | $attributes | associative array of html link attributes + disabled |
pix_icon | optional pix icon to render with the link |
string | HTML fragment |
core_renderer::activity_information | ( | cm_info | $cminfo, |
cm_completion_details | $completiondetails, | ||
array | $activitydates ) |
Returns information about an activity.
cm_info | $cminfo | The course module information. |
cm_completion_details | $completiondetails | The completion details for this activity module. |
array | $activitydates | The dates for this activity module. |
string | the activity information HTML. |
coding_exception |
core_renderer::activity_navigation | ( | ) |
Returns standard navigation between activities in a course.
string | the navigation HTML. |
|
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()
component_action | $action | |
string | $id |
string | id of element, either original submitted or random new if not supplied |
core_renderer::addblockbutton | ( | $region = '' | ) |
Generate the add block button when editing mode is turned on and the user can edit blocks.
string | $region | where new blocks should be added. |
string | html for the add block button. |
core_renderer::block | ( | block_contents | $bc, |
$region ) |
Prints a nice side block with an optional header.
block_contents | $bc | HTML for the content |
string | $region | the region the block is appearing in. |
string | the HTML to be output. |
Reimplemented in core_renderer_maintenance.
core_renderer::block_controls | ( | $actions, | |
$blockid = null ) |
Output the row of editing icons for a block, as defined by the controls array.
array | $controls | an array like block_contents::$controls. |
string | $blockid | The ID given to the block. |
string | HTML fragment. |
core_renderer::block_move_target | ( | $target, | |
$zones, | |||
$previous, | |||
$region ) |
Output a place where the block that is currently being moved can be dropped.
block_move_target | $target | with the necessary details. |
array | $zones | array of areas where the block can be moved to |
string | $previous | the block located before the area currently being rendered. |
string | $region | the name of the region |
string | the HTML to be output. |
core_renderer::blocks | ( | $region, | |
$classes = array(), | |||
$tag = 'aside', | |||
$fakeblocksonly = false ) |
Get the HTML for blocks in the given region.
string | $region | The region to get HTML for. |
array | $classes | Wrapping tag classes. |
string | $tag | Wrapping tag. |
boolean | $fakeblocksonly | Include fake blocks only. |
string | HTML. |
Reimplemented in core_renderer_maintenance.
core_renderer::blocks_for_region | ( | $region, | |
$fakeblocksonly = false ) |
Output all the blocks in a particular region.
string | $region | the name of a region on this page. |
boolean | $fakeblocksonly | Output fake block only. |
string | the HTML to be output. |
Reimplemented in core_renderer_maintenance.
core_renderer::body_attributes | ( | $additionalclasses = array() | ) |
Returns HTML attributes to use within the body tag.
This includes an ID and classes.
string | array | $additionalclasses | Any additional classes to give the body tag, |
string |
core_renderer::body_css_classes | ( | array | $additionalclasses = array() | ) |
Returns the CSS classes to apply to the body tag.
array | $additionalclasses | Any additional classes to apply. |
string |
core_renderer::body_id | ( | ) |
core_renderer::box | ( | $contents, | |
$classes = 'generalbox', | |||
$id = null, | |||
$attributes = array() ) |
Outputs a box.
string | $contents | The contents of the box |
string | $classes | A space-separated list of CSS classes |
string | $id | An optional ID |
array | $attributes | An array of other attributes to give the box. |
string | the HTML to output. |
core_renderer::box_end | ( | ) |
Outputs the closing section of a box.
string | the HTML to output. |
core_renderer::box_start | ( | $classes = 'generalbox', | |
$id = null, | |||
$attributes = array() ) |
Outputs the opening section of a box.
string | $classes | A space-separated list of CSS classes |
string | $id | An optional ID |
array | $attributes | An array of other attributes to give the box. |
string | the HTML to output. |
|
protected |
Take a node in the nav tree and make an action menu out of it.
The links are injected in the action menu.
action_menu | $menu | |
navigation_node | $node | |
boolean | $indent | |
boolean | $onlytopleafnodes |
boolean | nodesskipped - True if nodes were skipped in building the menu |
core_renderer::check_result | ( | core\check\result | $result | ) |
Renders a Check API result.
core\check\result | $result |
string | HTML fragment |
Reimplemented in core_renderer_cli.
core_renderer::close_element_for_append | ( | ) |
This closes any opened stream elements.
string | html to be written |
core_renderer::close_window_button | ( | $text = '' | ) |
Returns HTML to display a simple button to close a window.
string | $text | The lang string for the button's label (already output from get_string()) |
string | html fragment |
core_renderer::communication_link | ( | ) |
Returns the communication link, complete with html.
string |
core_renderer::communication_url | ( | ) |
Returns the communication url for a given instance if it exists.
string |
core_renderer::confirm | ( | $message, | |
$continue, | |||
$cancel, | |||
array | $displayoptions = [] ) |
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.
string | $message | The question to ask the user |
single_button | moodle_url | string | $continue | The single_button component representing the Continue answer. Can also be a moodle_url or string URL |
single_button | moodle_url | string | $cancel | The single_button component representing the Cancel answer. Can also be a moodle_url or string URL |
array | $displayoptions | optional extra display options |
string | HTML fragment |
Reimplemented in core_renderer_maintenance.
core_renderer::container | ( | $contents, | |
$classes = null, | |||
$id = null ) |
Outputs a container.
string | $contents | The contents of the box |
string | $classes | A space-separated list of CSS classes |
string | $id | An optional ID |
string | the HTML to output. |
core_renderer::container_end | ( | ) |
Outputs the closing section of a container.
string | the HTML to output. |
core_renderer::container_end_all | ( | $shouldbenone = false | ) |
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.
bool | $shouldbenone | assert that the stack should be empty now - causes a developer debug warning if it isn't. |
string | the HTML required to close any open containers inside <body>. |
core_renderer::container_start | ( | $classes = null, | |
$id = null ) |
Outputs the opening section of a container.
string | $classes | A space-separated list of CSS classes |
string | $id | An optional ID |
string | the HTML to output. |
core_renderer::context_header_settings_menu | ( | ) |
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.
string |
core_renderer::continue_button | ( | $url | ) |
Returns HTML to display a continue button that goes to a particular URL.
string | moodle_url | $url | The url the button goes to. |
string | the HTML to output. |
core_renderer::course_content_footer | ( | $onlyifnotcalledbefore = false | ) |
Returns course-specific information to be output immediately below content on any course page (for the current course)
bool | $onlyifnotcalledbefore | output content only if it has not been output before |
string |
Reimplemented in core_renderer_maintenance.
core_renderer::course_content_header | ( | $onlyifnotcalledbefore = false | ) |
Returns course-specific information to be output immediately above content on any course page (for the current course)
bool | $onlyifnotcalledbefore | output content only if it has not been output before |
string |
Reimplemented in core_renderer_maintenance.
core_renderer::course_footer | ( | ) |
Returns course-specific information to be output on any course page in the footer area (for the current course)
string |
Reimplemented in core_renderer_maintenance.
core_renderer::course_header | ( | ) |
Returns course-specific information to be output on any course page in the header area (for the current course)
string |
Reimplemented in core_renderer_maintenance.
core_renderer::custom_block_region | ( | $regionname | ) |
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).
string | $regionname | The name of the custom region to add. |
string | HTML for the block region. |
core_renderer::custom_menu | ( | $custommenuitems = '' | ) |
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.
string | $custommenuitems | - custom menuitems set by theme instead of global theme settings |
string |
Reimplemented in core_renderer_maintenance.
core_renderer::custom_menu_flat | ( | ) |
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.
core_renderer::darrow | ( | ) |
Accessibility: Down arrow-like character.
If the theme does not set characters, appropriate defaults are set automatically.
string |
core_renderer::debug_footer_html | ( | ) |
Performance information and validation links for debugging.
string | HTML fragment. |
core_renderer::doc_link | ( | $path, | |
$text = '', | |||
$forcepopup = false, | |||
array | $attributes = [] ) |
Returns a string containing a link to the user documentation.
Also contains an icon by default. Shown to teachers and admin only.
string | $path | The page link after doc root and language, no leading slash. |
string | $text | The text to be displayed for the link |
boolean | $forcepopup | Whether to force a popup regardless of the value of $CFG->doctonewwindow |
array | $attributes | htm attributes |
string |
core_renderer::doctype | ( | ) |
Get the DOCTYPE declaration that should be used with this page.
Designed to be called in theme layout.php files.
string | the DOCTYPE declaration that should be used. |
core_renderer::download_dataformat_selector | ( | $label, | |
$base, | |||
$name = 'dataformat', | |||
$params = array() ) |
Returns a dataformat selection and download form.
string | $label | A text label |
moodle_url | string | $base | The download page url |
string | $name | The query param which will hold the type of the download |
array | $params | Extra params sent to the download page |
string | HTML fragment |
core_renderer::edit_button | ( | moodle_url | $url, |
string | $method = 'post' ) |
Returns HTML to display a "Turn editing on/off" button in a form.
moodle_url | $url | The URL + params to send through when clicking the button |
string | $method |
string | HTML the button |
core_renderer::edit_switch | ( | ) |
Create a navbar switch for toggling editing mode.
string | Html containing the edit switch |
core_renderer::error_text | ( | $message | ) |
Output an error message.
By default wraps the error message in . If the error message is blank, nothing is output.
string | $message | the error message. |
string | the HTML to output. |
core_renderer::fatal_error | ( | $message, | |
$moreinfourl, | |||
$link, | |||
$backtrace, | |||
$debuginfo = null, | |||
$errorcode = "" ) |
Do not call this function directly.
To terminate the current script with a fatal error, throw an exception. Doing this will then call this function to display the error, before terminating the execution.
string | $message | The message to output |
string | $moreinfourl | URL where more info can be found about the error |
string | $link | Link for the Continue button |
array | $backtrace | The execution backtrace |
string | $debuginfo | Debugging information |
string | the HTML to output. |
Reimplemented in core_renderer_ajax, and core_renderer_cli.
core_renderer::favicon | ( | ) |
Returns the moodle_url for the favicon.
moodle_url | The moodle_url for the favicon |
core_renderer::file_picker | ( | $options | ) |
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.
stdClass | $options | file manager options options are: maxbytes=>-1, itemid=>0, client_id=>uniqid(), acepted_types=>'*', return_types=>FILE_INTERNAL, context=>current page context |
string | HTML fragment |
Reimplemented in core_renderer_maintenance.
core_renderer::footer | ( | ) |
Outputs the page's footer.
string | HTML fragment |
Reimplemented in core_renderer_ajax, and core_renderer_cli.
core_renderer::full_header | ( | ) |
Wrapper for header elements.
string | HTML to display the main header. |
|
inherited |
Return the site's compact logo URL, if any.
int | $maxwidth | The maximum width, or null when the maximum width does not matter. |
int | $maxheight | The maximum height, or null when the maximum height does not matter. |
moodle_url|false |
core_renderer::get_generated_color_for_id | ( | $id | ) |
Get the course color to show on a course card.
int | $id | Id to use when generating the color. |
string | hex color code. |
core_renderer::get_generated_image_for_id | ( | $id | ) |
Get the course pattern datauri to show on a course card.
The datauri is an encoded svg that can be passed as a url.
int | $id | Id to use when generating the pattern |
string | datauri |
core_renderer::get_generated_svg_for_id | ( | int | $id | ) |
Get the course pattern in SVG format to show on a course card.
int | $id | id to use when generating the pattern |
string | SVG file contents |
core_renderer::get_generated_url_for_course | ( | context_course | $context | ) |
Get the course pattern image URL.
context_course | $context | course context object |
string | URL of the course pattern image in SVG format |
|
inherited |
Return the site's logo URL, if any.
int | $maxwidth | The maximum width, or null when the maximum width does not matter. |
int | $maxheight | The maximum height, or null when the maximum height does not matter. |
moodle_url|false |
|
protectedinherited |
core_renderer::has_communication_links | ( | ) |
Helper function to decide whether to show the communication link or not.
bool |
core_renderer::has_popover_links | ( | ) |
Helper function to decide whether to show the help popover header or not.
bool |
|
inherited |
Returns true is output has already started, and false if not.
boolean | true if the header has been printed. |
core_renderer::header | ( | ) |
Start output by sending the HTTP headers, and printing the HTML <head> and the start of the <body>.
To control what is printed, you should set properties on $PAGE.
string | HTML that you must output this, preferably immediately. |
Reimplemented in core_renderer_ajax, and core_renderer_cli.
core_renderer::heading | ( | $text, | |
$level = 2, | |||
$classes = null, | |||
$id = null ) |
Outputs a heading.
string | $text | The text of the heading |
int | $level | The level of importance of the heading. Defaulting to 2 |
string | $classes | A space-separated list of CSS classes. Defaulting to null |
string | $id | An optional ID |
string | the HTML to output. |
Reimplemented in core_renderer_ajax, and core_renderer_cli.
core_renderer::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.
string | $text | A heading text |
string | $helpidentifier | The keyword that defines a help page |
string | $component | component name |
string | moodle_url | $icon | |
string | $iconalt | icon alt text |
int | $level | The level of importance of the heading. Defaulting to 2 |
string | $classnames | A space-separated list of CSS classes. Defaulting to null |
string | HTML fragment |
core_renderer::help_icon | ( | $identifier, | |
$component = 'moodle', | |||
$linktext = '', | |||
$a = null ) |
Returns HTML to display a help icon.
Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_help_icon() instead.
string | $identifier | The keyword that defines a help page |
string | $component | component name |
string | bool | $linktext | true means use $title as link text, string means link text value |
string | object | array | int | $a | An object, string or number that can be used within translation strings |
string | HTML fragment |
core_renderer::help_icon_scale | ( | $courseid, | |
stdClass | $scale ) |
Returns HTML to display a scale help icon.
int | $courseid | |
stdClass | $scale | instance |
string | HTML fragment |
core_renderer::home_link | ( | ) |
Return the 'back' link that normally appears in the footer.
string | HTML fragment. |
core_renderer::htmlattributes | ( | ) |
The attributes that should be added to the <html> tag.
Designed to be called in theme layout.php files.
string | HTML fragment. |
core_renderer::htmllize_file_tree | ( | ) |
core_renderer::image_icon | ( | $pix, | |
$alt, | |||
$component = 'moodle', | |||
array | $attributes = null ) |
Return HTML for an image_icon.
Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_image_icon() instead.
string | $pix | short pix name |
string | $alt | mandatory alt attribute |
string | $component | standard compoennt name like 'moodle', 'mod_forum', etc. |
array | $attributes | htm attributes |
string | HTML fragment |
|
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')
string | $imagename | the pathname of the image |
string | $component | full plugin name (aka component) or 'theme' |
moodle_url |
core_renderer::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)
string | $current | the currently selected letter. |
string | $class | class name to add to this initial bar. |
string | $title | the name to put in front of this initial bar. |
string | $urlvar | URL parameter name for this initial. |
string | $url | URL object. |
array | $alpha | of letters in the alphabet. |
bool | $minirender | Return a trimmed down view of the initials bar. |
string | the HTML to output. |
|
protected |
core_renderer::lang_menu | ( | ) |
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.
string | The lang menu HTML or empty string |
Reimplemented in core_renderer_maintenance.
core_renderer::larrow | ( | ) |
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.
string |
core_renderer::list_block_contents | ( | $icons, | |
$items ) |
Render the contents of a block_list.
array | $icons | the icon for each item. |
array | $items | the content of each item. |
string | HTML |
core_renderer::login_info | ( | $withlinks = null | ) |
Return the standard string that says whether you are logged in (and switched roles/logged in as another user).
bool | $withlinks | if 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. |
string | HTML fragment. |
Reimplemented in core_renderer_maintenance.
core_renderer::main_content | ( | ) |
Returns standard main content placeholder.
Designed to be called in theme layout.php files.
string | HTML fragment. |
core_renderer::maintenance_warning | ( | ) |
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.
string |
core_renderer::mform_element | ( | $element, | |
$required, | |||
$advanced, | |||
$error, | |||
$ingroup ) |
Renders an mform element from a template.
HTML_QuickForm_element | $element | element |
bool | $required | if input is required field |
bool | $advanced | if input is an advanced field |
string | $error | error message to display |
bool | $ingroup | True if this element is rendered as part of a group |
mixed | string|bool |
core_renderer::moodle_release | ( | ) |
Renders release information in the footer popup.
string | Moodle release info. |
core_renderer::navbar | ( | ) |
This renders the navbar.
Uses bootstrap compatible html.
core_renderer::navbar_plugin_output | ( | ) |
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.
string | HTML for the navbar |
core_renderer::notification | ( | $message, | |
$type = null, | |||
$closebutton = true ) |
Output a notification (that is, a status message about something that has just happened).
Note: core\notification\add() may be more suitable for your usage.
string | $message | The message to print out. |
?string | $type | The type of notification. See constants on core\output\notification. |
bool | $closebutton | Whether to show a close icon to remove the notification (default true). |
string | the HTML to output. |
Reimplemented in core_renderer_ajax, and core_renderer_cli.
core_renderer::notify_message | ( | ) |
core_renderer::notify_problem | ( | ) |
core_renderer::notify_redirect | ( | ) |
core_renderer::notify_success | ( | ) |
core_renderer::old_help_icon | ( | $helpidentifier, | |
$title, | |||
$component = 'moodle', | |||
$linktext = '' ) |
Returns HTML to display a help icon.
core_renderer::page_doc_link | ( | $text = null | ) |
core_renderer::page_heading | ( | $tag = 'h1' | ) |
Gets HTML for the page heading.
string | $tag | The tag to encase the heading in. h1 by default. |
string | HTML. |
core_renderer::page_heading_button | ( | ) |
core_renderer::page_heading_menu | ( | ) |
core_renderer::page_title | ( | ) |
core_renderer::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)
Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_paging_bar() instead.
int | $totalcount | The total number of entries available to be paged through |
int | $page | The page you are currently viewing |
int | $perpage | The number of entries that should be shown per page |
string | moodle_url | $baseurl | url of the current page, the $pagevar parameter is added |
string | $pagevar | name of page parameter that holds the page number |
string | the HTML to output. |
core_renderer::paragraph | ( | string | $contents, |
?string | $classes = null, | ||
?string | $id = null ) |
Outputs a paragraph.
string | $contents | The contents of the paragraph |
string | null | $classes | A space-separated list of CSS classes |
string | null | $id | An optional ID |
string | the HTML to output. |
core_renderer::pix_icon | ( | $pix, | |
$alt, | |||
$component = 'moodle', | |||
array | $attributes = null ) |
Return HTML for a pix_icon.
Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_pix_icon() instead.
string | $pix | short pix name |
string | $alt | mandatory alt attribute |
string | $component | standard compoennt name like 'moodle', 'mod_forum', etc. |
array | $attributes | htm lattributes |
string | HTML fragment |
|
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.
string | $imagename | the name of the icon. |
string | $component | specification of one plugin like in get_string() |
moodle_url |
|
staticinherited |
Given an array or space-separated list of classes, prepares and returns the HTML class attribute value.
mixed | $classes | Space-separated string or array of classes |
string | HTML class attribute value |
core_renderer::print_textarea | ( | $name, | |
$id, | |||
$value, | |||
$rows, | |||
$cols ) |
Returns the HTML for a basic textarea field.
string | $name | Name to use for the textarea element |
string | $id | The id to use fort he textarea element |
string | $value | Initial content to display in the textarea |
int | $rows | Number of rows to display |
int | $cols | Number of columns to display |
string | the HTML to display |
core_renderer::rarrow | ( | ) |
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.
string |
core_renderer::redirect_message | ( | $encodedurl, | |
$message, | |||
$delay, | |||
$debugdisableredirect, | |||
$messagetype = core\output\notification::NOTIFY_INFO ) |
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
string | $encodedurl | The URL to send to encoded if required |
string | $message | The message to display to the user if any |
int | $delay | The delay before redirecting a user, if $message has been set this is a requirement and defaults to 3, set to 0 no delay |
boolean | $debugdisableredirect | this redirect has been disabled for debugging purposes. Display a message that explains, and don't trigger the redirect. |
string | $messagetype | The type of notification to show the message in. See constants on core\output\notification. |
string | The 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.
core_renderer::region_main_settings_menu | ( | ) |
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.
string |
|
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.
renderable | $widget | instance with renderable interface |
string |
Reimplemented in core_courseformat\output\section_renderer, plugin_renderer_base, and tool_policy\output\renderer.
|
protected |
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()
action_link | $link |
string | HTML fragment |
core_renderer::render_action_menu | ( | action_menu | $menu | ) |
|
protected |
Renders a primary action_menu_filler item.
action_menu_link_filler | $action |
string | HTML fragment |
|
protected |
Renders an action_menu_link item.
action_menu_link | $action |
string | HTML fragment |
|
protected |
Renders a primary action_menu_link item.
action_menu_link_primary | $action |
string | HTML fragment |
|
protected |
Renders a secondary action_menu_link item.
action_menu_link_secondary | $action |
string | HTML fragment |
|
protected |
Renders a breadcrumb navigation node object.
breadcrumb_navigation_node | $item | The navigation node to render. |
string | HTML fragment |
core_renderer::render_chart | ( | \core\chart_base | $chart, |
$withtable = true ) |
Renders a chart.
core\chart_base | $chart | The chart. |
bool | $withtable | Whether to include a data table with the chart. |
string |
core_renderer::render_chart_bar | ( | \core\chart_bar | $chart | ) |
core_renderer::render_chart_line | ( | \core\chart_line | $chart | ) |
core_renderer::render_chart_pie | ( | \core\chart_pie | $chart | ) |
|
protected |
Renders a Check API result.
core\check\result | $result |
string | HTML fragment |
Reimplemented in core_renderer_cli.
core_renderer::render_checkbox_toggleall | ( | \core\output\checkbox_toggleall | $element | ) |
Renders element for a toggle-all checkbox.
core\output\checkbox_toggleall | $element |
string |
|
protected |
Renders the header bar.
context_header | $contextheader | Header bar object. |
string | HTML for the header bar. |
|
protected |
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
custom_menu | $menu |
string |
|
protected |
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.
@staticvar int $submenucount
custom_menu_item | $menunode |
string |
|
protected |
Render the digital minor contact information page into a nice template for the theme.
core_auth\output\digital_minor_page | $page | The renderable |
string |
core_renderer::render_file_picker | ( | file_picker | $fp | ) |
|
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
array | stdClass | $context | Context containing data for the template. |
string|boolean |
|
protected |
Implementation of user image rendering.
help_icon | $helpicon | A help icon instance |
string | HTML fragment |
|
protected |
Renders a pix_icon widget and returns the HTML to display it.
image_icon | $icon |
string | HTML fragment |
|
protected |
Internal implementation of initials bar rendering.
initials_bar | $initialsbar |
string |
core_renderer::render_inplace_editable | ( | \core\output\inplace_editable | $element | ) |
Renders element for inline editing of any value.
core\output\inplace_editable | $element |
string |
core_renderer::render_login | ( | \core_auth\output\login | $form | ) |
core_renderer::render_login_signup_form | ( | $form | ) |
Render the login signup form into a nice template for the theme.
mform | $form |
string |
|
protected |
Renders a navigation node object.
navigation_node | $item | The navigation node to render. |
string | HTML fragment |
|
protected |
Render a notification (that is, a status message about something that has just happened).
core\output\notification | $notification | the notification to print out |
string | the HTML to output. |
Reimplemented in core_renderer_cli.
|
protected |
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.
string | $layoutfile | The name of the layout file |
string | HTML code |
|
protected |
Returns HTML to display the paging bar.
paging_bar | $pagingbar |
string | the HTML to output. |
core_renderer::render_participants_tertiary_nav | ( | object | $course, |
?string | $renderedbuttons = null ) |
Renders the tertiary nav for the participants page.
object | $course | The course we are operating within |
string | null | $renderedbuttons | Any additional buttons/content to be displayed in line with the nav |
string |
|
protected |
Return HTML to display an emoticon icon.
pix_emoticon | $emoticon |
string | HTML fragment |
|
protected |
core_renderer::render_preferences_group | ( | preferences_group | $renderable | ) |
Renders preferences group.
preferences_group | $renderable | The renderable |
string | The output. |
core_renderer::render_preferences_groups | ( | preferences_groups | $renderable | ) |
Renders preferences groups.
preferences_groups | $renderable | The renderable |
string | The output. |
core_renderer::render_progress_bar | ( | progress_bar | $bar | ) |
Renders a progress bar.
Do not use $OUTPUT->render($bar), instead use progress_bar\create().
progress_bar | $bar | The bar. |
string | HTML fragment |
Reimplemented in core_renderer_cli.
core_renderer::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.
string | $id | |
float | $percent | |
string | $msg | Message |
string | $estimate | time remaining message |
string | ascii fragment |
Reimplemented in core_renderer_cli.
core_renderer::render_rating | ( | rating | $rating | ) |
Produces the html that represents this rating in the UI.
rating | $rating | the page object on which this rating will appear |
string |
|
protected |
Renders a single button widget.
This will return HTML to display a form containing a single button.
single_button | $button |
string | HTML fragment |
|
protected |
Internal implementation of single_select rendering.
single_select | $select |
string | HTML fragment |
core_renderer::render_skip_links | ( | $links | ) |
Renders the skip links for the page.
array | $links | List of skip links. |
string | HTML for the skip links. |
|
protected |
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.
tabobject | $tabobject |
string | HTML fragment |
|
protected |
Renders tabtree.
tabtree | $tabtree |
string |
|
protected |
Internal implementation of url_select rendering.
url_select | $select |
string | HTML fragment |
|
protected |
Internal implementation of user image rendering.
user_picture | $userpicture |
string |
|
protected |
Render the verify age and location page into a nice template for the theme.
core_auth\output\verify_age_location_page | $page | The renderable |
string |
core_renderer::search_box | ( | $id = false | ) |
Returns a search box.
string | $id | The search box wrapper div id, defaults to an autogenerated one. |
string | HTML with the search form hidden by default. |
core_renderer::secure_layout_language_menu | ( | ) |
Returns the language menu in the secure layout.
No custom menu items are passed though, such that it will render only the language selection.
string |
core_renderer::secure_layout_login_info | ( | ) |
Secure layout login info.
string |
core_renderer::select_element_for_append | ( | string | $selector = '#region-main [role=main]', |
string | $element = 'div' ) |
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.
string | $selector | where new content should be appended |
string | $element | which contains the streamed content |
string | html to be written |
core_renderer::select_element_for_replace | ( | string | $selector, |
string | $html, | ||
bool | $outer = false ) |
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.
string | $selector | where new content should be replaced |
string | $html | A chunk of well formed html |
bool | $outer | Wether it replaces the innerHTML or the outerHTML |
string | html to be written |
core_renderer::services_support_link | ( | ) |
Returns the services and support link for the help pop-up.
string |
|
inherited |
Whether we should display the main logo.
int | $headinglevel | The heading level we want to check against. |
bool |
|
inherited |
Whether we should display the logo in the navbar.
We will when there are no main logos, and we have compact logo.
bool |
core_renderer::single_button | ( | $url, | |
$label, | |||
$method = 'post', | |||
array | $options = null ) |
Returns a form with a single button.
Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_single_button() instead.
string | moodle_url | $url | |
string | $label | button text |
string | $method | get or post submit method |
array | $options | associative array {disabled, title, etc.} |
string | HTML fragment |
core_renderer::single_select | ( | $url, | |
$name, | |||
array | $options, | ||
$selected = '', | |||
$nothing = array('' => 'choosedots'), | |||
$formid = null, | |||
$attributes = array() ) |
Returns a form with a single select widget.
Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_single_select() instead.
moodle_url | $url | form action target, includes hidden fields |
string | $name | name of selection field - the changing parameter in url |
array | $options | list of options |
string | $selected | selected element |
array | $nothing | |
string | $formid | |
array | $attributes | other attributes for the single select |
string | HTML fragment |
core_renderer::skip_link_target | ( | $id = null | ) |
Output the place a skip link goes to.
string | $id | The target name from the corresponding $PAGE->requires->skip_link_to($target) call. |
string | the HTML to output. |
core_renderer::spacer | ( | array | $attributes = null, |
$br = false ) |
Creates and returns a spacer image with optional line break.
array | $attributes | Any HTML attributes to add to the spaced. |
bool | $br | Include a BR after the spacer.... DON'T USE THIS. Don't be laxy do it with CSS which is a much better solution. |
string | HTML fragment |
core_renderer::sr_text | ( | string | $contents | ) |
Outputs a screen reader only inline text.
string | $contents | The contents of the paragraph |
string | the HTML to output. |
core_renderer::standard_after_main_region_html | ( | ) |
The standard HTML that should be output just before the <footer> tag.
Designed to be called in theme layout.php files.
string | HTML fragment. |
core_renderer::standard_end_of_body_html | ( | ) |
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.
string | HTML fragment. |
core_renderer::standard_footer_html | ( | ) |
content that should be output in the footer area of the page.
Designed to be called in theme layout.php files.
string | HTML fragment. |
core_renderer::standard_head_html | ( | ) |
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.
string | HTML fragment. |
core_renderer::standard_top_of_body_html | ( | ) |
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.
string | HTML fragment. |
core_renderer::supportemail | ( | array | $customattribs = [], |
bool | $embed = false ) |
Returns the HTML for the site support email link.
array | $customattribs | Array of custom attributes for the support email anchor tag. |
bool | $embed | Set to true if you want to embed the link in other inline content. |
string | The html code for the support email link. |
|
final |
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()
array | $tabs | array of tabs, each of them may have it's own ->subtree |
string | null | $selected | which tab to mark as selected, all parent tabs will automatically be marked as activated |
array | string | null | $inactive | list of ids of inactive tabs, regardless of their level. Note that you can as weel specify tabobject\$inactive for separate instances |
string |
core_renderer::tag_list | ( | $tags, | |
$label = null, | |||
$classes = '', | |||
$limit = 10, | |||
$pagecontext = null, | |||
$accesshidelabel = false ) |
Displays the list of tags associated with an entry.
array | $tags | list of instances of core_tag or stdClass |
string | $label | label 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 | $classes | additional classes for the enclosing div element |
int | $limit | limit 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 | $pagecontext | specify if needed to overwrite the current page context for the view tag link |
bool | $accesshidelabel | if true, the label should have class="accesshide" added. |
string |
|
protected |
Renders theme links for switching between default and other themes.
string |
core_renderer::tree_block_contents | ( | $items, | |
$attrs = array() ) |
Make nested HTML lists out of the items.
The resulting list will look something like this:
<
array | $items | |
array | $attrs | html attributes passed to the top ofs the list |
string | HTML |
core_renderer::uarrow | ( | ) |
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.
string |
core_renderer::update_module_button | ( | ) |
core_renderer::url_select | ( | array | $urls, |
$selected, | |||
$nothing = array('' => 'choosedots'), | |||
$formid = null ) |
Returns a form with a url select widget.
Theme developers: DO NOT OVERRIDE! Please override function core_renderer::render_url_select() instead.
array | $urls | list of urls - array('/course/view.php?id=1'=>'Frontpage', ....) |
string | $selected | selected element |
array | $nothing | |
string | $formid |
string | HTML fragment |
core_renderer::user_menu | ( | $user = null, | |
$withlinks = null ) |
Construct a user menu, returning HTML that can be echoed out by a layout file.
stdClass | $user | A user object, usually $USER. |
bool | $withlinks | true if a dropdown should be built. |
string | HTML fragment. |
core_renderer::user_picture | ( | stdClass | $user, |
array | $options = null ) |
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.
stdClass | $user | Object 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 | $options | associative array with user picture options, used only if not a user_picture object, options are:
|
string | HTML fragment |
Reimplemented in core_renderer_maintenance.
string const core_renderer::MAIN_CONTENT_TOKEN = '[MAIN CONTENT GOES HERE]' |
Do NOT use, please use <?php echo $OUTPUT->main_content() ?> in layout files instead.