Documentation

ComponentController extends SystemComponentController
in package
implements EventListener, JsonAdapter

This is the main controller for the component

Tags
copyright

Cloudrexx AG

author

Sebastian Brand sebastian.brand@comvation.com

subpackage

core_wysiwyg

version
1.0.0

Table of Contents

Interfaces

EventListener
Event listener
JsonAdapter
JSON Adapter for JSON requests

Constants

LIB_PATH  = '/ckeditor/4.21.0'
Location of the CKeditor library

Properties

$config  : array<string|int, mixed>
Config loaded from YAML
$cx  : Cx
Main class instance
$developerDocumentationUrl  : string
URL pointing to the developer documentation for this component
$enduserDocumentationUrl  : string
URL pointing to the end-user documentation for this component
$systemComponent  : SystemComponent
Decorated SystemComponent
$templateDocumentationUrl  : string
URL pointing to the template definitions for this component
$wysiwygDataCache  : array<string|int, mixed>

Methods

__call()  : mixed
Decoration: all methods that are not specified in this or child classes call the corresponding method of the decorated SystemComponent
__construct()  : mixed
Initializes a controller
adjustResponse()  : mixed
Do something with a Response object You may do page alterations here (like changing the metatitle) You may do response alterations here (like set headers) PLEASE MAKE SURE THIS METHOD IS MOCKABLE. IT MAY ONLY INTERACT WITH resolve() HOOK.
executeCommand()  : void
Execute one of the commands listed in getCommandsForCommandMode()
getAccessableMethods()  : array<string|int, mixed>
Returns an array of method names accessable from a JSON request
getCommandDescription()  : string
Returns the description for a command provided by this component
getCommandsForCommandMode()  : array<string|int, mixed>
Returns a list of command mode commands provided by this component
getComponent()  : SystemComponentController
Get component controller object
getConfig()  : mixed
Sends config for CKEditor to browser and ends request.
getConfigPath()  : string
Get the path to the CKeditor config file
getConfigValue()  : string
Returns a value from the config tree
getConfigValues()  : array<string|int, mixed>
Returns part of the config tree
getController()  : Controller
Returns a controller instance if one already exists
getControllerClasses()  : array<string|int, mixed>
Returns all Controller class names for this component (except this)
getControllers()  : array<string|int, mixed>
Returns a list of controllers
getControllersAccessableByJson()  : array<string|int, mixed>
Returns a list of JsonAdapter class names
getCustomCSSVariables()  : array<string|int, mixed>
find all custom css variables and return an array with the values
getCustomWysiwygEditorConfig()  : string
Get custom config for the Wysiwyg editor that is defined in the Wysiwyg.yml of a webdesign theme.
getCustomWysiwygEditorJsCode()  : string
Get custom JavaScript code for the Wysiwyg editor that is defined in the Wysiwyg.yml of a webdesign theme.
getDefaultPermissions()  : object
Returns default permission as object
getDeveloperDocumentationUrl()  : string
Returns the URL pointing to the developer documentation of this component.
getEnduserDocumentationUrl()  : string
Returns the URL pointing to the end-user documentation for this component.
getLibraryPath()  : string
Get the path to the CKeditor JavaScript library
getMessagesAsString()  : string
Returns all messages as string
getName()  : string
Returns the internal name used as identifier for this adapter
getRemovedButtons()  : string
Get the buttons that shall be removed or unchecked
getSystemComponent()  : SystemComponent
Returns the SystemComponent this Controller decorates
getSystemComponentController()  : SystemComponentController
Returns the main controller
getTemplateDocumentationUrl()  : string
Returns the URL pointing to the template documentation for this component.
getToolbar()  : string
Get the Toolbar of the given type
getWysiwygTemplates()  : string
Returns all Wysiwyg templates in JSON to be used by the CKEditor
hasAccessToExecuteCommand()  : bool
Check whether the command has access to execute or not.
load()  : mixed
Load your component. It is needed for this request.
onEvent()  : mixed
This function controlls the events from the eventListener
postComponentLoad()  : mixed
Do something after all active components are loaded USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
postContentLoad()  : mixed
Do something after content is loaded from DB
postContentParse()  : mixed
Do something after a module is loaded
postFinalize()  : mixed
Do something after main template got parsed
postInit()  : mixed
Do something after system initialization
postResolve()  : mixed
Do something after resolving is done
preComponentLoad()  : mixed
Do something before component load * USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
preContentLoad()  : mixed
Do something before content is loaded from DB
preContentParse()  : mixed
Do something before a module is loaded
preFinalize()  : mixed
Do something before main template gets parsed
preInit()  : mixed
Do something before system initialization
preResolve()  : mixed
Do something before resolving is done
registerController()  : null
Registers a controller instance
registerEventListeners()  : mixed
Register your event listeners here
registerEvents()  : mixed
Register your events here
resolve()  : mixed
Called for additional, component specific resolving
setSystemComponent()  : SystemComponent
Sets the SystemComponent this Controller decorates
adjustFullyQualifiedClassName()  : string
This makes sure a FQCN does not contain double backslashes
getControllerClassName()  : string
This finds the correct FQCN for a controller name
getCustomWysiwygData()  : array<string|int, mixed>
Returns specific data from the Wysiwyg.yml of a webdesign theme.
getWysiwygDataFromTheme()  : DataSet
Returns the data (as an instance of \Cx\Core_Modules\Listing\Model\Entity\DataSet) of the Wysiwyg.yml file from the theme identified by $themeId. If no theme can be identified by $themeId, then the Wysiwyg.yml from the default theme is loaded instead.
getWysiwygTemplatesFromConfig()  : array<string|int, mixed>
Returns the Wysiwyg templates from config section
loadConfigFile()  : array<string|int, mixed>
Loads a config YAML file
loadData()  : void
Load data from Component.yml
parseConfig()  : string
Builds the CKEditor config and returns it

Constants

Properties

$developerDocumentationUrl

URL pointing to the developer documentation for this component

protected string $developerDocumentationUrl = ''

Developer documentation URL

$enduserDocumentationUrl

URL pointing to the end-user documentation for this component

protected string $enduserDocumentationUrl = ''

End-user documentation URL

$templateDocumentationUrl

URL pointing to the template definitions for this component

protected string $templateDocumentationUrl = ''

Template documentation URL

$wysiwygDataCache

protected array<string|int, mixed> $wysiwygDataCache = array()

List of cached DataSets (\Cx\Core_Modules\Listing\Model\Entity\DataSet) of Wysiwyg.yml files of themes. The array has the following structure: array(<themeId> => <DataSet>)

Methods

__call()

Decoration: all methods that are not specified in this or child classes call the corresponding method of the decorated SystemComponent

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

adjustResponse()

Do something with a Response object You may do page alterations here (like changing the metatitle) You may do response alterations here (like set headers) PLEASE MAKE SURE THIS METHOD IS MOCKABLE. IT MAY ONLY INTERACT WITH resolve() HOOK.

public adjustResponse(Response $response) : mixed
Parameters
$response : Response

Response object to adjust

Tags
todo

This is currently only available in "frontend" mode.

executeCommand()

Execute one of the commands listed in getCommandsForCommandMode()

public executeCommand(string $command, array<string|int, mixed> $arguments[, array<string|int, mixed> $dataArguments = array() ]) : void
Parameters
$command : string

Name of command to execute

$arguments : array<string|int, mixed>

List of arguments for the command

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

(optional) List of data arguments for the command

Tags
see
getCommandsForCommandMode()

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

getCommandDescription()

Returns the description for a command provided by this component

public getCommandDescription(string $command[, bool $short = false ]) : string
Parameters
$command : string

The name of the command to fetch the description from

$short : bool = false

Wheter to return short or long description

Return values
string

Command description

getCommandsForCommandMode()

Returns a list of command mode commands provided by this component

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

List of command names

getConfig()

Sends config for CKEditor to browser and ends request.

public getConfig() : mixed

Sets content-type to: application/javascript

getConfigPath()

Get the path to the CKeditor config file

public getConfigPath() : string
Return values
string

getConfigValue()

Returns a value from the config tree

public getConfigValue(string $key) : string
Parameters
$key : string

Slash-separated path to requested branch

Tags
throws
Exception

If the requested branch was not found in config

throws
Exception

If the value is not a leaf but a branch

Return values
string

Requested value as string

getConfigValues()

Returns part of the config tree

public getConfigValues(string $key) : array<string|int, mixed>
Parameters
$key : string

Slash-separated path to requested branch

Tags
throws
Exception

If the requested branch was not found in config

throws
Exception

If the value found is not an array

Return values
array<string|int, mixed>

Requested values

getController()

Returns a controller instance if one already exists

public getController(mixed $controllerClass) : Controller
Parameters
$controllerClass : mixed

Short or FQCN controller name

Tags
throws
Exception

if controller exists but cannot be loaded

Return values
Controller

Controller instance

getControllerClasses()

Returns all Controller class names for this component (except this)

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

List of Controller class names (without namespace)

getControllers()

Returns a list of controllers

public getControllers([bool $loadedOnly = true ]) : array<string|int, mixed>
Parameters
$loadedOnly : bool = true

(optional) If false, controller that did not register are instanciated, default true

Return values
array<string|int, mixed>

List of Controller instances

getControllersAccessableByJson()

Returns a list of JsonAdapter class names

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

List of ComponentController classes

getCustomCSSVariables()

find all custom css variables and return an array with the values

public getCustomCSSVariables([int $skinId = 0 ]) : array<string|int, mixed>
Parameters
$skinId : int = 0

skin id, default is 0

Return values
array<string|int, mixed>

List with needed wysiwyg options

getCustomWysiwygEditorConfig()

Get custom config for the Wysiwyg editor that is defined in the Wysiwyg.yml of a webdesign theme.

public getCustomWysiwygEditorConfig(int $themeId[, int $tabCount = 0 ]) : string
Parameters
$themeId : int

The ID of the webdesign template to load the Wysiwyg editor config from.

$tabCount : int = 0

Number of tabs to be added on each line if the config spreads over multiple lines. Defaults to 0 (no indent).

Return values
string

Wysiwyg editor config loaded from Wysiwyg.yml file of theme identified by $themeId.

getCustomWysiwygEditorJsCode()

Get custom JavaScript code for the Wysiwyg editor that is defined in the Wysiwyg.yml of a webdesign theme.

public getCustomWysiwygEditorJsCode(int $themeId) : string
Parameters
$themeId : int

The ID of the webdesign template to load the Wysiwyg editor code from.

Return values
string

Wysiwyg editor code loaded from Wysiwyg.yml file of theme identified by $themeId.

getDefaultPermissions()

Returns default permission as object

public getDefaultPermissions() : object
Return values
object

getDeveloperDocumentationUrl()

Returns the URL pointing to the developer documentation of this component.

public getDeveloperDocumentationUrl() : string
Return values
string

URL pointing to the developer documentation

getEnduserDocumentationUrl()

Returns the URL pointing to the end-user documentation for this component.

public getEnduserDocumentationUrl() : string
Return values
string

URL pointing to the end-user documentation or empty string

getLibraryPath()

Get the path to the CKeditor JavaScript library

public getLibraryPath() : string
Return values
string

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

getRemovedButtons()

Get the buttons that shall be removed or unchecked

public getRemovedButtons() : string
Tags
internal

param bool|false $buttonsOnly If set, returns only the buttons no config.removedButtons prefix

internal

param bool|false $isAccess If set, removes the prefix config.removedButtons from the string

Return values
string

getTemplateDocumentationUrl()

Returns the URL pointing to the template documentation for this component.

public getTemplateDocumentationUrl() : string
Return values
string

URL pointing to the template documentation or empty string

getToolbar()

Get the Toolbar of the given type

public getToolbar([string $type = 'Full' ]) : string

Returns the toolbar of the desired based on the restricted of functions according to user group and default setting

Parameters
$type : string = 'Full'

Type of desired Toolbar (one of the following: small, full, frontendEditingContent, frontendEditingTitle or bbcode)

Return values
string

Toolbar of the desired type based on the restrictions according to user group and default setting

getWysiwygTemplates()

Returns all Wysiwyg templates in JSON to be used by the CKEditor

public getWysiwygTemplates(int $themeId) : string

Returns the Wysiwyg templates from the Wysiwyg.yml file from the theme identified by $themeId. If no theme can be identified by $themeId, then the Wysiwyg.yml from the default theme is loaded instead.

Parameters
$themeId : int

The ID of the webdesign template (theme) to load the Wysiwyg templates from.

Return values
string

JSON-encoded string of Wysiwyg templates

hasAccessToExecuteCommand()

Check whether the command has access to execute or not.

public hasAccessToExecuteCommand(string $command, array<string|int, mixed> $arguments) : bool
Parameters
$command : string

name of the command to execute

$arguments : array<string|int, mixed>

list of arguments for the command

Return values
bool

load()

Load your component. It is needed for this request.

public load(Page $page) : mixed

This loads your FrontendController or BackendController depending on the mode Cx runs in. For modes other than frontend and backend, nothing is done. If you you'd like to name your Controllers differently, or have another use case, overwrite this.

Parameters
$page : Page

The resolved page

onEvent()

This function controlls the events from the eventListener

public onEvent(string $eventName, array<string|int, mixed> $eventArgs) : mixed
Parameters
$eventName : string

Name of the event

$eventArgs : array<string|int, mixed>

Arguments of the event

postComponentLoad()

Do something after all active components are loaded USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.

public postComponentLoad() : mixed

postContentLoad()

Do something after content is loaded from DB

public postContentLoad(Page $page) : mixed

USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE

Parameters
$page : Page

The resolved page

postContentParse()

Do something after a module is loaded

public postContentParse(Page $page) : mixed

This method is called only if any module gets loaded for content parsing USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE

Parameters
$page : Page

The resolved page

postFinalize()

Do something after main template got parsed

public postFinalize(string &$endcode) : mixed

USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE!

Parameters
$endcode : string

The processed data to be sent to the client as response

postInit()

Do something after system initialization

public postInit(Cx $cx) : mixed

USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE. This event must be registered in the postInit-Hook definition file config/postInitHooks.yml.

Parameters
$cx : Cx

The instance of \Cx\Core\Core\Controller\Cx

postResolve()

Do something after resolving is done

public postResolve(Page $page) : mixed

USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE

Parameters
$page : Page

The resolved page

preComponentLoad()

Do something before component load * USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.

public preComponentLoad() : mixed

This event must be registered in the preComponentLoad-Hook definition file config/preComponentLoadHooks.yml.

preContentLoad()

Do something before content is loaded from DB

public preContentLoad(Page $page) : mixed
Parameters
$page : Page

The resolved page

preContentParse()

Do something before a module is loaded

public preContentParse(Page $page) : mixed

This method is called only if any module gets loaded for content parsing USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE

Parameters
$page : Page

The resolved page

preFinalize()

Do something before main template gets parsed

public preFinalize(Sigma $template) : mixed

USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE

Parameters
$template : Sigma

The main template

preInit()

Do something before system initialization

public preInit(Cx $cx) : mixed

USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE. This event must be registered in the preInit-Hook definition file config/preInitHooks.yml.

Parameters
$cx : Cx

The instance of \Cx\Core\Core\Controller\Cx

preResolve()

Do something before resolving is done

public preResolve(Url $request) : mixed

USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE

Parameters
$request : Url

The URL object for this request

registerEventListeners()

Register your event listeners here

public registerEventListeners() : mixed
Tags
inheritdoc

resolve()

Called for additional, component specific resolving

public resolve(array<string|int, mixed> $parts, Page $page) : mixed

If /en/Path/to/Page is the path to a page for this component a request like /en/Path/to/Page/with/some/parameters will give an array like array('with', 'some', 'parameters') for $parts PLEASE MAKE SURE THIS METHOD IS MOCKABLE. IT MAY ONLY INTERACT WITH adjustResponse() HOOK.

This may be used to redirect to another page

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

List of additional path parts

$page : Page

Resolved virtual page

adjustFullyQualifiedClassName()

This makes sure a FQCN does not contain double backslashes

protected adjustFullyQualifiedClassName(string $className) : string
Parameters
$className : string

FQCN of a controller

Return values
string

Clean FQCN of a controller

getControllerClassName()

This finds the correct FQCN for a controller name

protected getControllerClassName(string $controllerClassShort) : string
Parameters
$controllerClassShort : string

Short name for controller

Return values
string

Fully qualified controller class name

getCustomWysiwygData()

Returns specific data from the Wysiwyg.yml of a webdesign theme.

protected getCustomWysiwygData(int $themeId, string $key) : array<string|int, mixed>
Parameters
$themeId : int

The ID of the webdesign template (theme) to load the Wysiwyg data from.

$key : string

The key by which the Wysiwyg data is identified by.

Return values
array<string|int, mixed>

Data identified by $key of Wysiwyg.yml file of theme identified by $themeId.

getWysiwygDataFromTheme()

Returns the data (as an instance of \Cx\Core_Modules\Listing\Model\Entity\DataSet) of the Wysiwyg.yml file from the theme identified by $themeId. If no theme can be identified by $themeId, then the Wysiwyg.yml from the default theme is loaded instead.

protected getWysiwygDataFromTheme(int $themeId) : DataSet

If no data can be loaded, then null is returned

Parameters
$themeId : int

The ID of the webdesign template (theme) to load the Wysiwyg templates from.

Return values
DataSet

Loaded DataSet of Wysiwyg.yml

getWysiwygTemplatesFromConfig()

Returns the Wysiwyg templates from config section

protected getWysiwygTemplatesFromConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

List of Wysiwyg templates loaded from config section

loadConfigFile()

Loads a config YAML file

protected loadConfigFile(string $filename) : array<string|int, mixed>
Parameters
$filename : string

Name of the file to load

Tags
throws
Exception

If the file could not be loaded correctly

Return values
array<string|int, mixed>

Loaded data

parseConfig()

Builds the CKEditor config and returns it

protected parseConfig() : string
Return values
string

        
On this page

Search results