phpBB API Documentation
Class

phpbb\controller\helper

class helper

Controller helper class, contains methods that do things for controllers

Methods

__construct(template $template, user $user, config $config, symfony_request $symfony_request, request_interface $request, helper $routing_helper)

Constructor

Response render(string $template_file, string $page_title = '', int $status_code = 200, bool $display_online_list = false, int $item_id, string $item = 'forum', bool $send_headers = false)

Automate setting up the page and creating the response object.

string route(string $route, array $params = array(), bool $is_amp = true, string|bool $session_id = false, bool|string $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH)

Generate a URL to a route

Response error(string $message, int $code = 500)

Output an error, effectively the same thing as trigger_error

Response message(string $message, array $parameters = array(), string $title = 'INFORMATION', int $code = 200)

Output a message

assign_meta_refresh_var($time, $url)

Assigns automatic refresh time meta tag in template

string get_current_url()

Return the current url

Details

at line 64
public __construct(template $template, user $user, config $config, symfony_request $symfony_request, request_interface $request, helper $routing_helper)

Constructor

Parameters

template $template Template object
user $user User object
config $config Config object
symfony_request $symfony_request Symfony Request object
request_interface $request phpBB request object
helper $routing_helper Helper to generate the routes

at line 87
public Response render(string $template_file, string $page_title = '', int $status_code = 200, bool $display_online_list = false, int $item_id, string $item = 'forum', bool $send_headers = false)

Automate setting up the page and creating the response object.

Parameters

string $template_file The template handle to render
string $page_title The title of the page to output
int $status_code The status code to be sent to the page header
bool $display_online_list Do we display online users list
int $item_id Restrict online users to item id
string $item Restrict online users to a certain session item, e.g. forum for sessionforumid
bool $send_headers Whether headers should be sent by page_header(). Defaults to false for controllers.

Return Value

Response object containing rendered page

at line 112
public string route(string $route, array $params = array(), bool $is_amp = true, string|bool $session_id = false, bool|string $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH)

Generate a URL to a route

Parameters

string $route Name of the route to travel
array $params String or array of additional url parameters
bool $is_amp Is url using & (true) or & (false)
string|bool $session_id Possibility to use a custom session id instead of the global one
bool|string $reference_type The type of reference to be generated (one of the constants)

Return Value

string The URL already passed through append_sid()

at line 126
public Response error(string $message, int $code = 500)

Output an error, effectively the same thing as trigger_error

Parameters

string $message The error message
int $code The error code (e.g. 404, 500, 503, etc.)

Return Value

Response A Response instance

at line 142
public Response message(string $message, array $parameters = array(), string $title = 'INFORMATION', int $code = 200)

Output a message

In case of an error, please throw an exception instead

Parameters

string $message The message to display (must be a language variable)
array $parameters The parameters to use with the language var
string $title Title for the message (must be a language variable)
int $code The HTTP status code (e.g. 404, 500, 503, etc.)

Return Value

Response A Response instance

at line 179
public assign_meta_refresh_var($time, $url)

Assigns automatic refresh time meta tag in template

Parameters

$time
$url

at line 191
public string get_current_url()

Return the current url

Return Value

string