Documentation

RandomEsiWidgetController extends RandomEsiWidgetController

JsonAdapter Controller to handle EsiWidgets Usage: - Create a subclass that implements parseWidget() - Register it as a Controller in your ComponentController

Tags
author

Michael Ritter michael.ritter@cloudrexx.com

subpackage

coremodules_widget

Table of Contents

Constants

DEFAULT_SUBWIDGET_CACHE_LIFETIME  = 60 * 60 * 24
DEFAULT_SUBWIDGET_COUNT_LIMIT  = 100

Properties

$cx  : Cx
Main class instance
$esiParamPage  : Page
Holds
$subwidgetCacheLifetime  : int
Max lifetime of randomized content in seconds This is only used if the number of sub-widgets is greater than $subwidgetCountLimit. In this case sub-widgets are randomly picked and cached.
$subwidgetCountLimit  : int
Max number of sub-widgets that will be randomized per widget

Methods

__call()  : mixed
Route methods like getName(), getType(), getDirectory(), etc.
__construct()  : mixed
Creates new controller
getAccessableMethods()  : array<string|int, mixed>
Returns an array of method names accessable from a JSON request
getDefaultPermissions()  : Permission
Returns default permission as object
getMessagesAsString()  : string
Returns all messages as string
getName()  : string
Returns the internal name used as identifier for this adapter
getRandomEsiWidgetContentInfos()  : array<string|int, mixed>
Returns a list of ESI request infos that are to be randomized
getSubwidgetCacheLifetime()  : int
Returns the max lifetime of cached sub-widgets
getSubwidgetCountLimit()  : int
Returns the max number of cached sub-widgets
getSystemComponentController()  : SystemComponentController
Returns the main controller
getWidget()  : array<string|int, mixed>
Returns the content of a widget
parseWidget()  : mixed
Parses a widget
internalParseWidget()  : array<string|int, mixed>
Parses a widget
objectifyParams()  : array<string|int, mixed>
This makes object of the given params (if possible) Known params are page, lang, user, theme, channel, country, currency and ref

Constants

DEFAULT_SUBWIDGET_CACHE_LIFETIME

public int DEFAULT_SUBWIDGET_CACHE_LIFETIME = 60 * 60 * 24

Max cache lifetime of subwidgets in seconds

Properties

$subwidgetCacheLifetime

Max lifetime of randomized content in seconds This is only used if the number of sub-widgets is greater than $subwidgetCountLimit. In this case sub-widgets are randomly picked and cached.

protected int $subwidgetCacheLifetime

Cache lifetime in seconds

$subwidgetCountLimit

Max number of sub-widgets that will be randomized per widget

protected int $subwidgetCountLimit

Sub-widget count

Methods

__call()

Route methods like getName(), getType(), getDirectory(), etc.

public __call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
$methodName : string

Name of method to call

$arguments : array<string|int, mixed>

List of arguments for the method to call

Attributes
#[ReturnTypeWillChange]
Return values
mixed

Return value of the method to call

getRandomEsiWidgetContentInfos()

Returns a list of ESI request infos that are to be randomized

public getRandomEsiWidgetContentInfos(Widget $widget, array<string|int, mixed> $params, mixed $template) : array<string|int, mixed>

Each returned entry consists of an array like: array( <adapterName>, <adapterMethod>, , )

Parameters
$widget : Widget

The RandomEsiWidget

$params : array<string|int, mixed>

ESI request params

$template : mixed
Return values
array<string|int, mixed>

List of URLs

getSubwidgetCacheLifetime()

Returns the max lifetime of cached sub-widgets

public getSubwidgetCacheLifetime() : int
Return values
int

Lifetime in seconds

getSubwidgetCountLimit()

Returns the max number of cached sub-widgets

public getSubwidgetCountLimit() : int
Return values
int

Number of widgets

getWidget()

Returns the content of a widget

public getWidget(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

JsonAdapter parameters

Return values
array<string|int, mixed>

Content in an associative array

parseWidget()

Parses a widget

public parseWidget(string $name, mixed $template, Response $response, array<string|int, mixed> $params) : mixed
Parameters
$name : string

Widget name

$template : mixed
$response : Response

Current response

$params : array<string|int, mixed>

Array of params

Tags
todo

Add support for subwidgets

internalParseWidget()

Parses a widget

protected internalParseWidget(Widget $widget, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$widget : Widget

The Widget

$params : array<string|int, mixed>

Params passed by ESI (/API) request

Return values
array<string|int, mixed>

Content in an associative array

objectifyParams()

This makes object of the given params (if possible) Known params are page, lang, user, theme, channel, country, currency and ref

protected objectifyParams(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Associative array of params

Return values
array<string|int, mixed>

Associative array of params


        
On this page

Search results