class Detector implements ApplicationAwareInterface, SiteAggregateInterface (View source)

Traits

Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface

Properties

protected Application $app from  ApplicationAwareTrait
protected bool $enabled
protected bool|Section $preferredSection
protected Site $site
protected RequestCache $cache

Methods

setApplication(Application $app)

Setter method for the application

__construct(RequestCache $cache)

No description

getSite()

No description

Section|null
getActiveSection(Page $c)

Returns the Multilingual Page Section based on the Page object.

string
getActiveLocale(Page $c)

Returns the locale string (e.g. en_US) based on the Page object.

array
getAvailableSections()

Returns all Multilingual Sections on the current site.

getRelatedPage(Page $currentPage, Section $targetSection)

Returns a translated page based on the Page object.

string
getSwitchLink(mixed $currentPageID, mixed $targetSectionID)

Get a switch language link URL to redirect to the target section from the current page.

Section|null
getPreferredSection()

Returns the preferred section based on session, cookie, user object, default browser (if allowed), and finally site preferences.

setupSiteInterfaceLocalization(Page|null $c = null)

Set the locale associated to the 'site' localization context.

bool
isEnabled()

Check if there's some multilingual section.

bool
canSetSessionValue()

Check if we can set a session value.

Details

setApplication(Application $app)

Setter method for the application

Parameters

Application $app

__construct(RequestCache $cache)

No description

Parameters

RequestCache $cache

Site getSite()

No description

Return Value

Site

Section|null getActiveSection(Page $c)

Returns the Multilingual Page Section based on the Page object.

Parameters

Page $c

Return Value

Section|null

string getActiveLocale(Page $c)

Returns the locale string (e.g. en_US) based on the Page object.

Parameters

Page $c

Return Value

string

array getAvailableSections()

Returns all Multilingual Sections on the current site.

Return Value

array

Page getRelatedPage(Page $currentPage, Section $targetSection)

Returns a translated page based on the Page object.

Parameters

Page $currentPage
Section $targetSection

Return Value

Page

Get a switch language link URL to redirect to the target section from the current page.

Parameters

mixed $currentPageID
mixed $targetSectionID

Return Value

string

Section|null getPreferredSection()

Returns the preferred section based on session, cookie, user object, default browser (if allowed), and finally site preferences.

Since the user's language is not a locale but a language, attempts to determine best section for the given language.

Return Value

Section|null

setupSiteInterfaceLocalization(Page|null $c = null)

Set the locale associated to the 'site' localization context.

Parameters

Page|null $c

The page to be used to determine the site locale (if null we'll use the current page)

Exceptions

Exception

bool isEnabled()

Check if there's some multilingual section.

Return Value

bool

Exceptions

Exception

protected bool canSetSessionValue()

Check if we can set a session value.

Return Value

bool