Documentation

FrontendController extends FrontendController
in package

FrontendController for Media3

Tags
see
FrontendController
copyright

Cloudrexx AG

author

Michael Ritter michael.ritter@cloudrexx.com

subpackage

module_media4

Table of Contents

Properties

$currentEntityStack  : array<string|int, mixed>
$cx  : Cx
Main class instance
$widgetAvailabilityMap  : array<string|int, mixed>

Methods

__call()  : mixed
Route methods like getName(), getType(), getDirectory(), etc.
__construct()  : mixed
Creates new controller
getPage()  : mixed
This is called by the default ComponentController and does all the repeating work
getSystemComponentController()  : SystemComponentController
Returns the main controller
load()  : mixed
parseEntitiesToTemplate()  : void
Parses a list of entities to a template based on a view config
parsePage()  : mixed
Use this to parse your frontend page
getAvailableWidgets()  : array<string|int, mixed>
Returns the list of available widgets within a widget or cmd
getViewConfig()  : array<string|int, mixed>
Returns the view config for a given view name
parseEntityToTemplate()  : void
Parses an entity to a template based on a view config
parseWidget()  : string|null
Parse a widget
parseWidgets()  : void
Parses all available widget within the given CMD
resolveCmd()  : string
Returns the integration CMD by the requested page CMD
setPlaceholderWidget()  : void
Sets the widget's value in the template
setTypedWidget()  : void
Sets the widget's value in the template
toggleBlockWidget()  : void
Shows or hides a block widget in the template

Properties

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

getPage()

This is called by the default ComponentController and does all the repeating work

public getPage(Page $page) : mixed

This creates a template of the page content and calls parsePage($template)

Parameters
$page : Page

Resolved page

parseEntitiesToTemplate()

Parses a list of entities to a template based on a view config

public parseEntitiesToTemplate(string $blockName, Sigma $template, array<string|int, mixed> $entities, string $viewName) : void

The reason this is public is in order to allow parsing global ESI widgets using this. Parsing these widgets should be handled differently.

Parameters
$blockName : string

Name of the block to parse for each entity

$template : Sigma

Template to parse

$entities : array<string|int, mixed>

List of entities to parse

$viewName : string

Name of a view specified in Component.yml

parsePage()

Use this to parse your frontend page

public parsePage(Sigma $template, mixed $cmd) : mixed
Parameters
$template : Sigma

Template containing content of resolved page

$cmd : mixed

Requested cmd to parse

Tags
inheritdoc

getAvailableWidgets()

Returns the list of available widgets within a widget or cmd

protected getAvailableWidgets(string $parent, bool $isWidget) : array<string|int, mixed>
Parameters
$parent : string

Parent identifier to parse

$isWidget : bool

Whether $parent is a widget or a cmd.

Return values
array<string|int, mixed> —

List of widget identifiers

getViewConfig()

Returns the view config for a given view name

protected getViewConfig(string $viewName) : array<string|int, mixed>
Parameters
$viewName : string

Name of the view config to fetch

Tags
todo

Allow $viewName to contain an optional component name

Return values
array<string|int, mixed> —

View properties

parseEntityToTemplate()

Parses an entity to a template based on a view config

protected parseEntityToTemplate(Sigma $template, EntityBase $entity, string $viewName[, string $prefix = '' ]) : void
Parameters
$template : Sigma

Template to parse

$entity : EntityBase

Entity to parse

$viewName : string

Name of a view specified in Component.yml

$prefix : string = ''

(optional) Allows overriding the prefix set by the view

parseWidget()

Parse a widget

protected parseWidget(Sigma $template, array<string|int, mixed> &$params, string $name[, string $parent = '' ]) : string|null

Overwrite this instead of parsePage() in order to only parse the documented widgets.

Parameters
$template : Sigma

Template to parse the widget in

$params : array<string|int, mixed>

Params for the CMD this widget is parsed in

$name : string

Widget identifier to parse

$parent : string = ''
Tags
throws
WidgetSkipException

If sub-widgets should be skipped

Return values
string|null —

Value for the rendered widget for custom entity fields

parseWidgets()

Parses all available widget within the given CMD

protected parseWidgets(Sigma $template, array<string|int, mixed> $params, string $parent[, bool $isWidget = false ]) : void
Parameters
$template : Sigma

Template to parse widgets in

$params : array<string|int, mixed>

Params for the CMD this widget is parsed in

$parent : string

Parent identifier to parse

$isWidget : bool = false

(optional) Whether $parent is a widget or a cmd. Defaults to cmd.

resolveCmd()

Returns the integration CMD by the requested page CMD

protected resolveCmd(string $cmd[, array<string|int, mixed> &$params = array() ]) : string

Requested page's CMD may be empty or an alias or parametrized. The return value is the identifier of one of the specified CMDs in Component.yml.

Parameters
$cmd : string

CMD as specified in the requested page

$params : array<string|int, mixed> = array()

(reference) Will be filled by the params (if any)

Tags
todo

Does not yet resolve parametrized CMDs

throws
Exception

If no matching CMD could be found

Return values
string —

One of the CMDs listed in Component.yml

setPlaceholderWidget()

Sets the widget's value in the template

protected setPlaceholderWidget(Sigma $template, string $name, string $value) : void
Parameters
$template : Sigma

Template to parse

$name : string

Name of the widget

$value : string

Value for the widget

setTypedWidget()

Sets the widget's value in the template

protected setTypedWidget(Sigma $template, string $name, string $value, string $type) : void
Parameters
$template : Sigma

Template to parse

$name : string

Name of the widget

$value : string

Value for the widget

$type : string

toggleBlockWidget()

Shows or hides a block widget in the template

protected toggleBlockWidget(Sigma $template, string $name, bool $show) : void
Parameters
$template : Sigma

Template to parse

$name : string

Name of the widget

$show : bool

True if the block should be shown, false otherwise

On this page

Search results