BackendController
extends SystemComponentBackendController
in package
Backend controller to create the locale backend view.
Tags
Table of Contents
Properties
- $cx : Cx
- Main class instance
- $defaultPermission : Permission
- Default permission
- $isViewTranslatable : bool
- Whether the current view contains translatable content
- $languageFile : SettingsLanguageFile
- The language file which is used to parse the placeholder list
- $languageRepo : LanguageRepository
- The doctrine repository of the language entities
- $localeRepo : LocaleRepository
- The doctrine repository of the locale entities
Methods
- __call() : mixed
- Route methods like getName(), getType(), getDirectory(), etc.
- __construct() : mixed
- Creates new controller
- getAllViewGeneratorOptions() : array<string|int, mixed>
- This function returns an array which contains the vgOptions array for all entities
- getCommands() : array<string|int, mixed>
- Returns a list of available commands (?act=XY)
- getPage() : mixed
- This is called by the default ComponentController and does all the repeating work
- getParsedCommands() : array<string|int, mixed>
- Returns a unified representation of commands
- getSystemComponentController() : SystemComponentController
- Returns the main controller
- parseBackendSettings() : mixed
- Parses the localization configuration page for backend
- parseNavigation() : Sigma
- Parse the navigation
- parsePage() : ViewGenerator|null
- Use this to parse your backend page
- checkAndModifyCmdByPermission() : mixed
- Check and modify the cmd based on the permission
- createComponentSelect() : DataElement
- Creates a select field with all componentss as options
- createLanguageSelect() : DataElement
- Creates a select field with all source languages as options
- createSelect() : DataElement
- Creates a select field with the given values as options
- getEntityClassesWithView() : array<string|int, mixed>
- Returns all entities of this component which can have an auto-generated view
- getLanguageRepository() : LanguageRepository
- Gets the language repository from the entity manager
- getLocaleRepo() : LocaleRepository
- Gets the locale repository from the entity manager
- getViewGeneratorOptions() : array<string|int, mixed>
- This function returns the ViewGeneration options for a given entityClass
- getViewGeneratorParseObjectForEntityClass() : string|array<string|int, mixed>|object
- Returns the object to parse a view with
- hasAccess() : bool
- Check the access permission
- hasAccessToCommand() : bool
- Check the access permission based on the command
- hasEntityData() : bool
- Tells whether the given entity class name has stored entities
- hasNoEntityData() : bool
- Tells whether the given entity class name has no stored entities
- isComponentCustomizable() : mixed
- parseCommands() : void
- Parses the command list into a consistent form
- parseCurrentNavItem() : mixed
- Parse the current navigation item
- parseEntityClassPage() : mixed
- showOverviewPage() : bool
- Return true here if you want the first tab to be an entity view
- showSplash() : bool
- Returns whether to show the splash screen or not. Every module "should" have an introductionary splash screen. This method can be used to define conditions on when to show it.
- updateBackends() : mixed
- Updates the backend languages
- updateLanguageFile() : mixed
- Compares the placeholders from post to the current set placeholders and stores the effectively changed ones
- updateLocales() : mixed
- Updates the locales
Properties
$cx
Main class instance
protected
Cx
$cx
= null
$defaultPermission
Default permission
protected
Permission
$defaultPermission
$isViewTranslatable
Whether the current view contains translatable content
protected
bool
$isViewTranslatable
= false
$languageFile
The language file which is used to parse the placeholder list
protected
SettingsLanguageFile
$languageFile
$languageRepo
The doctrine repository of the language entities
protected
LanguageRepository
$languageRepo
$localeRepo
The doctrine repository of the locale entities
protected
LocaleRepository
$localeRepo
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
__construct()
Creates new controller
public
__construct(SystemComponentController $systemComponentController, Cx $cx) : mixed
Parameters
- $systemComponentController : SystemComponentController
-
Main controller for this system component
- $cx : Cx
-
Main class instance
getAllViewGeneratorOptions()
This function returns an array which contains the vgOptions array for all entities
public
getAllViewGeneratorOptions([mixed $dataSetIdentifier = '' ]) : array<string|int, mixed>
Parameters
- $dataSetIdentifier : mixed = ''
Tags
Return values
array<string|int, mixed>getCommands()
Returns a list of available commands (?act=XY)
public
getCommands() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of acts
getPage()
This is called by the default ComponentController and does all the repeating work
public
getPage(Page $page) : mixed
This loads a template named after current $act and calls parsePage($actTemplate)
Parameters
- $page : Page
-
Resolved page
Tags
getParsedCommands()
Returns a unified representation of commands
public
getParsedCommands() : array<string|int, mixed>
Returns a list of CMDs indexed by their key. Each entry is an array with the following keys:
- permission \Cx\Core_Modules\Access\Model\Entity\Permission needed to access this CMD or NULL
- translatable True if this CMD contains frontend-translated stuff, false otherwise
- children An array in the same form (recursion)
- langKey The key for use in $_CORELANG or this components $_ARRAYLANG
Return values
array<string|int, mixed> —See description
getSystemComponentController()
Returns the main controller
public
getSystemComponentController() : SystemComponentController
Return values
SystemComponentController —Main controller for this system component
parseBackendSettings()
Parses the localization configuration page for backend
public
parseBackendSettings(Sigma $template) : mixed
Parameters
- $template : Sigma
-
Template for cmd Backend
Tags
parseNavigation()
Parse the navigation
public
parseNavigation([array<string|int, mixed> &$cmd = array() ]) : Sigma
Parameters
- $cmd : array<string|int, mixed> = array()
Return values
SigmaparsePage()
Use this to parse your backend page
public
parsePage(Sigma $template, array<string|int, mixed> $cmd[, mixed &$isSingle = false ]) : ViewGenerator|null
You will get the template located in /View/Template/{CMD}.html You can access Cx class using $this->cx To show messages, use \Message class
Parameters
- $template : Sigma
-
Template for current CMD
- $cmd : array<string|int, mixed>
-
CMD separated by slashes
- $isSingle : mixed = false
-
Wether edit view or not
Return values
ViewGenerator|null —Used ViewGenerator or null
checkAndModifyCmdByPermission()
Check and modify the cmd based on the permission
protected
checkAndModifyCmdByPermission(array<string|int, mixed> &$cmd, array<string|int, mixed> $currentCommands) : mixed
Parameters
- $cmd : array<string|int, mixed>
- $currentCommands : array<string|int, mixed>
createComponentSelect()
Creates a select field with all componentss as options
protected
createComponentSelect(string $name, string $selectedValue, mixed $mode) : DataElement
Parameters
- $name : string
-
Name of the select field
- $selectedValue : string
-
Pre-selected value
- $mode : mixed
Return values
DataElement —Select field
createLanguageSelect()
Creates a select field with all source languages as options
protected
createLanguageSelect(string $name, string $selectedValue) : DataElement
Parameters
- $name : string
-
Name of the select field
- $selectedValue : string
-
Pre-selected value
Return values
DataElement —Select field
createSelect()
Creates a select field with the given values as options
protected
createSelect(string $name, array<string|int, mixed> $options, string $selectedValue) : DataElement
Parameters
- $name : string
-
Name of the select field
- $options : array<string|int, mixed>
-
Key=>value type array
- $selectedValue : string
-
Pre-selected value
Return values
DataElement —Select field
getEntityClassesWithView()
Returns all entities of this component which can have an auto-generated view
protected
getEntityClassesWithView() : array<string|int, mixed>
Adds DataSet to the entity classes with view, which is neccessary to auto-generate the language file view
Tags
Return values
array<string|int, mixed>getLanguageRepository()
Gets the language repository from the entity manager
protected
getLanguageRepository() : LanguageRepository
Return values
LanguageRepositorygetLocaleRepo()
Gets the locale repository from the entity manager
protected
getLocaleRepo() : LocaleRepository
Return values
LocaleRepositorygetViewGeneratorOptions()
This function returns the ViewGeneration options for a given entityClass
protected
getViewGeneratorOptions(mixed $entityClassName[, mixed $dataSetIdentifier = '' ]) : array<string|int, mixed>
Parameters
- $entityClassName : mixed
-
contains the FQCN from entity
- $dataSetIdentifier : mixed = ''
-
if $entityClassName is DataSet, this is used for better partition
Tags
Return values
array<string|int, mixed> —with options
getViewGeneratorParseObjectForEntityClass()
Returns the object to parse a view with
protected
getViewGeneratorParseObjectForEntityClass(mixed $entityClassName) : string|array<string|int, mixed>|object
Returns a LanguageFile object for language file view
Parameters
- $entityClassName : mixed
Return values
string|array<string|int, mixed>|object —An entity class name, entity, array of entities or DataSet
hasAccess()
Check the access permission
protected
hasAccess(array<string|int, mixed> $command) : bool
Parameters
- $command : array<string|int, mixed>
Return values
boolhasAccessToCommand()
Check the access permission based on the command
protected
hasAccessToCommand([array<string|int, mixed> $commands = array() ]) : bool
Parameters
- $commands : array<string|int, mixed> = array()
Return values
boolhasEntityData()
Tells whether the given entity class name has stored entities
protected
hasEntityData(string $entityClassName) : bool
This method is intended for use in showSplash(). Instead of the fully qualified class name the entity name can be specified relative to the component's entity namespace. If $entityClassName does not start with component's entity namespace it is prepended. Therefore only entities within this component's entity namespace can be checked with this method. The component's entity namespace is: \Cx<component_type><component_name>\Model\Entity\
Parameters
- $entityClassName : string
-
Fully qualified entity class name or according to description
Return values
bool —True if entity has data, false otherwise
hasNoEntityData()
Tells whether the given entity class name has no stored entities
protected
hasNoEntityData(string $entityClassName) : bool
This method is intended for use in showSplash(). Instead of the fully qualified class name the entity name can be specified relative to the component's entity namespace. If $entityClassName does not start with component's entity namespace it is prepended. Therefore only entities within this component's entity namespace can be checked with this method. The component's entity namespace is: \Cx<component_type><component_name>\Model\Entity\
Parameters
- $entityClassName : string
-
Fully qualified entity class name or according to description
Return values
bool —True if entity has no data, false otherwise
isComponentCustomizable()
protected
isComponentCustomizable(mixed $component, mixed $mode) : mixed
Parameters
- $component : mixed
- $mode : mixed
parseCommands()
Parses the command list into a consistent form
protected
parseCommands(array<string|int, mixed> &$currentLayer[, bool $firstLayer = true ]) : void
See {$this->getParsedCommands()} for the format $currentLayer is turned into.
Parameters
- $currentLayer : array<string|int, mixed>
-
(reference) CMDs as provided by getCommands()
- $firstLayer : bool = true
-
Defaults to true, is set to false for recursions
parseCurrentNavItem()
Parse the current navigation item
protected
parseCurrentNavItem(Sigma $navigation, string $blockName, string $currentCmd, string $mainCmd, bool $isActiveNav, bool $isSubNav) : mixed
Parameters
- $navigation : Sigma
- $blockName : string
- $currentCmd : string
- $mainCmd : string
- $isActiveNav : bool
- $isSubNav : bool
Tags
parseEntityClassPage()
protected
parseEntityClassPage(mixed $template, mixed $entityClassName, mixed $classIdentifier[, mixed $filter = array() ][, mixed &$isSingle = false ]) : mixed
Parameters
- $template : mixed
- $entityClassName : mixed
- $classIdentifier : mixed
- $filter : mixed = array()
- $isSingle : mixed = false
showOverviewPage()
Return true here if you want the first tab to be an entity view
protected
showOverviewPage() : bool
Return values
bool —True if overview should be shown, false otherwise
showSplash()
Returns whether to show the splash screen or not. Every module "should" have an introductionary splash screen. This method can be used to define conditions on when to show it.
protected
showSplash() : bool
Tags
Return values
bool —True if splash is to be shown.
updateBackends()
Updates the backend languages
protected
updateBackends(mixed $post) : mixed
Changes the default backend language (when neccessary) and adds or/and deletes backend languages
Parameters
- $post : mixed
-
The post data
Tags
updateLanguageFile()
Compares the placeholders from post to the current set placeholders and stores the effectively changed ones
protected
updateLanguageFile(array<string|int, mixed> $placeholders) : mixed
Parameters
- $placeholders : array<string|int, mixed>
-
The placeholders submitted by the user
updateLocales()
Updates the locales
protected
updateLocales(array<string|int, mixed> $post) : mixed
Changes the default locale (when neccessary) and updates the fallbacks
Parameters
- $post : array<string|int, mixed>
-
The post data