Documentation

JsonBlockController extends Controller
in package
implements JsonAdapter

JSON Adapter for Block

Tags
copyright

Cloudrexx AG

author

Project Team SS4U info@cloudrexx.com

subpackage

module_block

Table of Contents

Interfaces

JsonAdapter
JSON Adapter for JSON requests

Properties

$cx  : Cx
Main class instance
$messages  : array<string|int, mixed>
List of messages

Methods

__call()  : mixed
Route methods like getName(), getType(), getDirectory(), etc.
__construct()  : mixed
Creates new controller
cmpByOrder()  : int
Compares two arrays by order attribute
getAccessableMethods()  : array<string|int, mixed>
Returns an array of method names accessable from a JSON request
getBlock()  : array<string|int, mixed>
Gets every block attribute for given block and version
getBlockContent()  : string
Get the block content as html
getBlocks()  : array<string|int, mixed>
Returns all available blocks for each language
getCategoryBlockContent()  : array<string|int, mixed>
Returns the rendered content for all blocks of a given category.
getCountries()  : array<string|int, mixed>
Get countries from given name
getDefaultPermissions()  : object
Returns default permission as object
getGlobalBlockContent()  : array<string|int, mixed>
Returns the rendered content for all global blocks.
getMessagesAsString()  : string
Returns all messages as string
getName()  : string
Returns the internal name used as identifier for this adapter
getRandomBlockContent()  : mixed
Fetch content for ESI requests of random block widgets
getSystemComponentController()  : SystemComponentController
Returns the main controller
getVersionValue()  : mixed
Processes and returns value of related block entities stored in block

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

cmpByOrder()

Compares two arrays by order attribute

public cmpByOrder(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>
$b : array<string|int, mixed>
Return values
int

relative position

getAccessableMethods()

Returns an array of method names accessable from a JSON request

public getAccessableMethods() : array<string|int, mixed>
Return values
array<string|int, mixed>

List of method names

getBlock()

Gets every block attribute for given block and version

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

all given params from http request

Tags
throws
NotEnoughArgumentsException

if not enough arguments are provided

throws
NoBlockFoundException

if the requested block can't be found

throws
NoBlockVersionFoundException

if the requested block version can't be found

Return values
array<string|int, mixed>

$blockVersion all attributes from block

getBlockContent()

Get the block content as html

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

all given params from http request

Tags
throws
NotEnoughArgumentsException
Return values
string

the html content of the block

getBlocks()

Returns all available blocks for each language

public getBlocks() : array<string|int, mixed>
Return values
array<string|int, mixed>

List of blocks (lang => id )

getCategoryBlockContent()

Returns the rendered content for all blocks of a given category.

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

Depending on the configuration (CLX5087_BlockHistory), this method either:

  • Queries blocks via Doctrine ORM (block history enabled).
  • Queries blocks via raw SQL (legacy mode).

Behavior:

  • Validates that required arguments (category, locale) are provided.
  • Retrieves blocks assigned to the given category (via showInCategory or explicit page/category relations) that are active and match the locale.
  • Filters blocks based on targeting options.
  • Applies publishing schedule checks (start/end). If a response object is provided, updates its expiration date.
  • Fetches block content via ESI (getBlockContent).
  • Joins block contents with the configured category separator.
  • Optionally wraps content in identifying comments (markParsedBlock).

Returns an array with a single content key containing the final rendered HTML of ESI include tags for the category blocks.

Parameters
$params : array<string|int, mixed>

Arguments for rendering. Must include:

  • get (array):
    • category (int): Category ID (required).
    • locale (string): Language code (required).
    • page (int, optional): Page ID.
  • response (\Cx\Core\Routing\Model\Entity\Response): Response object for publishing schedule expiration handling.
Tags
todo

This is legacy code and must be replaced by proper EsiWidget implementation through a EsiWidgetController.

throws
NotEnoughArgumentsException

If required parameters are missing (category or locale).

Return values
array<string|int, mixed>

Array with key content holding the rendered block HTML of ESI include tags. Returns an empty string in content if no blocks are available.

getCountries()

Get countries from given name

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

Get parameters,

Return values
array<string|int, mixed>

Array of countries

getDefaultPermissions()

Returns default permission as object

public getDefaultPermissions() : object
Return values
object

getGlobalBlockContent()

Returns the rendered content for all global blocks.

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

Depending on the configuration (CLX5087_BlockHistory), this method either:

  • Queries blocks via Doctrine ORM (block history enabled).
  • Queries blocks via raw SQL (legacy mode).

Behavior:

  • Validates that required arguments (locale) are provided.
  • Retrieves global blocks (showInGlobal or global flag) that are active, belong to the requested page, and match the locale.
  • Filters blocks based on targeting options.
  • Applies publishing schedule checks (start/end). If a response object is provided, updates its expiration date.
  • Fetches block content via ESI (getBlockContent).
  • Joins block contents with the configured separator (blockGlobalSeperator).
  • Optionally wraps content in identifying comments (markParsedBlock).

Returns an array with a single content key containing the final rendered HTML of ESI-include tags.

Parameters
$params : array<string|int, mixed>

Arguments for rendering. Must include:

  • get (array):
    • locale (string): Language code (required).
    • page (int, optional): Page ID.
  • response (\Cx\Core\Routing\Model\Entity\Response): Response object for publishing schedule expiration handling.
Tags
todo

This is legacy code and must be replaced by proper EsiWidget implementation through a EsiWidgetController.

throws
NotEnoughArgumentsException

If required parameters are missing (locale).

Return values
array<string|int, mixed>

Array with key content holding the rendered block HTML of ESI include tags. Returns an empty string in content if no blocks are available.

getMessagesAsString()

Returns all messages as string

public getMessagesAsString() : string
Return values
string

HTML encoded error messages

getName()

Returns the internal name used as identifier for this adapter

public getName() : string
Return values
string

Name of this adapter

getRandomBlockContent()

Fetch content for ESI requests of random block widgets

public getRandomBlockContent(mixed $params) : mixed
Parameters
$params : mixed
Tags
todo

This is legacy code and must be replaced by proper EsiWidget implementation through a EsiWidgetController.

getVersionValue()

Processes and returns value of related block entities stored in block

protected getVersionValue(mixed $className, mixed $data, mixed $attributes, mixed $idAttributes) : mixed
Parameters
$className : mixed

string full qualified class name to get repo

$data : mixed

array serialized data

$attributes : mixed

array wanted attributes of entity

$idAttributes : mixed

array wanted attributes to get an ID on

Tags
@return

$entityValue array processed entity value


        
On this page

Search results