CoolCMS API

ParameterRelCollectionTrait

Tags
template

Table of Contents

Properties

$parameterRels  : Collection<int, TParameterRel>
$parameterEditorKeys  : array<string, true>
$parameterIndex  : array<string, array<int, string|null>>|null
$parameterRenderModes  : array<string, ContentFilterMode}>
$renderBlacklistedWords  : array<string|int, string>
$renderUrlsAllowed  : bool
Render-time URL replacement (`disallowUrl` is `OnRender`) is skipped; set by the presenter for a paid "Show links" tariff.

Methods

addParameterRel()  : $this
clearParameterRels()  : $this
get()  : mixed
Returns the parameter value by its key.
getParameterRels()  : Collection<int, TParameterRel>
getString()  : string
Returns the parameter value as text (titles, meta, OG) with the content filter, like {@see get()}.
parameterRelCollectionInit()  : void
removeParameterRel()  : $this
setParameterRels()  : $this
setRenderBlacklistedWords()  : $this
Sets the context for the render-time content filter: the deny-listed words in the target language.
setRenderUrlsAllowed()  : $this
Lets web addresses through the render-time filter (the advert has an active "Show links" tariff, {@see \App\Core\Config\AdvertLinksConfig}). Only the `OnRender` mode is skipped: with `OnSave` the database already holds the placeholder.
usesEditor()  : bool
Returns whether the parameter value is editor HTML (`useEditor`).
buildParameterIndex()  : array<string, array<int, string|null>>

Properties

$parameterEditorKeys

private array<string, true> $parameterEditorKeys = []

Runtime cache: keys of parameters with an editor (useEditor), whose value is HTML

Attributes
#[Transient]

$renderBlacklistedWords

private array<string|int, string> $renderBlacklistedWords = []

Words for render-time replacement (disallowBlacklistedWords is OnRender); set by the presenter before rendering.

Attributes
#[FieldAccess]
$read: \App\Core\Attributes\Hydration\Audience::All
$insert: \App\Core\Attributes\Hydration\Audience::Privileged
$update: \App\Core\Attributes\Hydration\Audience::Privileged
#[Transient]

$renderUrlsAllowed

Render-time URL replacement (`disallowUrl` is `OnRender`) is skipped; set by the presenter for a paid "Show links" tariff.

private bool $renderUrlsAllowed = false
Attributes
#[FieldAccess]
$read: \App\Core\Attributes\Hydration\Audience::All
$insert: \App\Core\Attributes\Hydration\Audience::Privileged
$update: \App\Core\Attributes\Hydration\Audience::Privileged
#[Transient]

Methods

addParameterRel()

public addParameterRel(TParameterRel $parameterRel) : $this
Parameters
$parameterRel : TParameterRel
Return values
$this

get()

Returns the parameter value by its key.

public get(string $key[, string $type = 'string' ][, bool $alwaysReturnArray = false ]) : mixed
Parameters
$key : string

Parameter key

$type : string = 'string'

'string' | 'int' | 'float' | 'bool'

$alwaysReturnArray : bool = false

returns an array even for a single value

getParameterRels()

public getParameterRels() : Collection<int, TParameterRel>
Return values
Collection<int, TParameterRel>

getString()

Returns the parameter value as text (titles, meta, OG) with the content filter, like {@see get()}.

public getString(string $key) : string

Multiple values are joined by a comma; get() would return an array for them and the string would read "Array".

Parameters
$key : string
Return values
string

removeParameterRel()

public removeParameterRel(TParameterRel $parameterRel) : $this
Parameters
$parameterRel : TParameterRel
Return values
$this

setParameterRels()

public setParameterRels(Collection<int, TParameterRel>|array<int, TParameterRel> $parameterRels) : $this
Parameters
$parameterRels : Collection<int, TParameterRel>|array<int, TParameterRel>
Return values
$this

setRenderBlacklistedWords()

Sets the context for the render-time content filter: the deny-listed words in the target language.

public setRenderBlacklistedWords(array<string|int, string> $words) : $this

Without it the word replacement (OnRender) is skipped; URL replacement does not depend on it.

Parameters
$words : array<string|int, string>
Return values
$this

setRenderUrlsAllowed()

Lets web addresses through the render-time filter (the advert has an active "Show links" tariff, {@see \App\Core\Config\AdvertLinksConfig}). Only the `OnRender` mode is skipped: with `OnSave` the database already holds the placeholder.

public setRenderUrlsAllowed(bool $allowed) : $this
Parameters
$allowed : bool
Return values
$this

usesEditor()

Returns whether the parameter value is editor HTML (`useEditor`).

public usesEditor(string $key) : bool

Templates choose between |noescape (the HTML is sanitized in the Api on write) and escaped output by it. The parameter setting decides, not the presence of tags in the text.

Parameters
$key : string
Return values
bool

buildParameterIndex()

private buildParameterIndex() : array<string, array<int, string|null>>
Return values
array<string, array<int, string|null>>
On this page

Search results