CoolCMS API

PresenterContext
in package

Table of Contents

Properties

$presenter  : Presenter
$siteBaseUrl  : SiteBaseUrl|null

Methods

__construct()  : mixed
The base URL is optional only for tests that build the context without DI; without it the request URL is kept.
absoluteLink()  : string
Builds an absolute link for use outside a request (e-mail, notification).
absolutize()  : string
Converts a ready absolute URL (`LinkGenerator`, `getBaseUrl()`) to the website address from settings.
getPresenter()  : Presenter
hasPresenter()  : bool
Returns false outside a presenter run (CLI, cron); links cannot be built then.
setPresenter()  : void

Properties

Methods

__construct()

The base URL is optional only for tests that build the context without DI; without it the request URL is kept.

public __construct([SiteBaseUrl|null $siteBaseUrl = null ]) : mixed
Parameters
$siteBaseUrl : SiteBaseUrl|null = null

Builds an absolute link for use outside a request (e-mail, notification).

public absoluteLink(string $destination[, array<string, mixed> $args = [] ]) : string

It is the current presenter's link('//…') converted to the website address from settings (SiteBaseUrl). $destination is written without the leading // (:Front:Bazaar:Advert:detail).

Parameters
$destination : string
$args : array<string, mixed> = []
Return values
string

absolutize()

Converts a ready absolute URL (`LinkGenerator`, `getBaseUrl()`) to the website address from settings.

public absolutize(string $url) : string
Parameters
$url : string
Return values
string

getPresenter()

public getPresenter() : Presenter
Return values
Presenter

hasPresenter()

Returns false outside a presenter run (CLI, cron); links cannot be built then.

public hasPresenter() : bool
Return values
bool

setPresenter()

public setPresenter(Presenter $presenter) : void
Parameters
$presenter : Presenter
On this page

Search results