trait interacts_with_page

internal  
 

Trait handling Moodle $PAGE, Context, Output and Layouts.

Properties

protected null|context $context
protected string $page_layout
protected string $page_title
protected string $page_heading
protected moodle_url|string|null $page_url
protected array $page_navbar
protected string $admin_section
mixed $course
mixed $cm

Methods

void
set_context(context|null $context = null)

Set the context for the controller.

context
get_context()

Get the resolved context (defaults to system).

void
set_page_url(moodle_url|string $url)

Set the page URL.

void
set_page_layout(string $layout)

Set Moodle page layout.

void
set_page_title(string $title)

Set page title.

void
set_page_heading(string $heading)

Set page heading.

void
add_page_navbar(array|string $item)

Add an item to the page navbar trail.

void
set_url_from_route(string $route, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)

Helper to set URL from route name.

void
resolve_context()

Resolves the context if null, based on course/cm properties.

void
setup_moodle_page()

Apply all settings to the global $PAGE object.

moodle_url
get_page_url()

Get the Moodle page URL, resolving defaults when needed.

Details

at line 58
void set_context(context|null $context = null)

Set the context for the controller.

Parameters

context|null $context

Return Value

void

at line 66
context get_context()

Get the resolved context (defaults to system).

Return Value

context

at line 74
void set_page_url(moodle_url|string $url)

Set the page URL.

Parameters

moodle_url|string $url

Return Value

void

at line 82
void set_page_layout(string $layout)

Set Moodle page layout.

Parameters

string $layout

Return Value

void

at line 90
void set_page_title(string $title)

Set page title.

Parameters

string $title

Return Value

void

at line 98
void set_page_heading(string $heading)

Set page heading.

Parameters

string $heading

Return Value

void

at line 106
void add_page_navbar(array|string $item)

Add an item to the page navbar trail.

Parameters

array|string $item

Return Value

void

at line 114
void set_url_from_route(string $route, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)

Helper to set URL from route name.

Parameters

string $route
array $parameters
int $referenceType

Return Value

void

at line 129
protected void resolve_context()

Resolves the context if null, based on course/cm properties.

Return Value

void

at line 147
protected void setup_moodle_page()

Apply all settings to the global $PAGE object.

Return Value

void

Exceptions

moodle_exception

at line 179
protected moodle_url get_page_url()

Get the Moodle page URL, resolving defaults when needed.

Return Value

moodle_url

Exceptions

moodle_exception