Contao Utils Bundle

RequestUtil
in package

Table of Contents

Properties

$kernelPackages  : array<string|int, mixed>
$modelUtil  : ModelUtil
$requestStack  : RequestStack
$contaoFramework  : ContaoFramework

Methods

__construct()  : mixed
getBaseUrl()  : string
Get the website base url (scheme and host) considering additional context.
getCurrentPageModel()  : PageModel|null
Return the current page model.
getCurrentRootPageModel()  : PageModel|null
Return the root page of the current page.
isIndexPage()  : bool
Return true if the current page (or the passed page) is the index/ start page of the current page tree.
isNewVisitor()  : bool
Detect if user already visited our domain before.

Properties

$kernelPackages

protected array<string|int, mixed> $kernelPackages

$contaoFramework

private ContaoFramework $contaoFramework

Methods

__construct()

public __construct(ModelUtil $modelUtil, RequestStack $requestStack, array<string|int, mixed> $kernelPackages, ContaoFramework $contaoFramework) : mixed
Parameters
$modelUtil : ModelUtil
$requestStack : RequestStack
$kernelPackages : array<string|int, mixed>
$contaoFramework : ContaoFramework

getBaseUrl()

Get the website base url (scheme and host) considering additional context.

public getBaseUrl([array<string|int, mixed> $context = [] ][, array<string|int, mixed> $options = [] ]) : string

If no base url could be determined, an empty string is returned.

Context:

  • (PageModel) pageModel: The current page model
  • (string) fallback: will be returned if no other base url could be determined

Options:

  • (bool) throwException: Throw exception if no base url could be determined instead of returning empty string
Parameters
$context : array<string|int, mixed> = []

Pass additional context. Available content: pageModel, fallback

$options : array<string|int, mixed> = []

Pass addition options: Available options: throwException

Return values
string

getCurrentPageModel()

Return the current page model.

public getCurrentPageModel() : PageModel|null
Tags
See

AbstractContentElementController::getPageModel()

Return values
PageModel|null

the current page model or null if no page context

getCurrentRootPageModel()

Return the root page of the current page.

public getCurrentRootPageModel([PageModel $currentPage = null ]) : PageModel|null
Parameters
$currentPage : PageModel = null
Return values
PageModel|null

the root page model or null if not exist

isIndexPage()

Return true if the current page (or the passed page) is the index/ start page of the current page tree.

public isIndexPage([PageModel $pageModel = null ]) : bool
Parameters
$pageModel : PageModel = null
Return values
bool

isNewVisitor()

Detect if user already visited our domain before.

public isNewVisitor() : bool
Return values
bool

        
On this page

Search results