ConstantConfigurationParser
Parser for TypoScript constant configuration lines and values like "# cat=content/cText/1; type=; label= Bodytext font: This is the font face used for text!" for display of the constant editor and extension settings configuration
Basic TypoScript parsing is delegated to the TypoScriptParser which returns with comments intact. These comments are then parsed by this class to prepare/set display related options. The Constant Editor renders fields itself whereas the extension settings are rendered by fluid.
Table of Contents
Properties
- $subCategories : array<string|int, mixed>
- This will be filled with the available categories of the current template.
Methods
- getConfigurationAsValuedArray() : array<string|int, mixed>
- Create a flat array of configuration options from raw constants string.
- getSubCategories() : array<string|int, mixed>
- Provide a public getter as the constant editor directly accesses this array to render the fields.
- parseComments() : array<string|int, mixed>
- This function compares the flattened constants (default and all).
- prepareConfigurationForView() : array<string|int, mixed>
- Converts the configuration array to an hierarchical category array for use in fluid templates.
- buildConfigurationArray() : array<string|int, mixed>
- Builds a configuration array from each line (option) of the config file.
- extractInformationForConfigFieldsOfTypeOptions() : array<string|int, mixed>
- Extracts additional information for fields of type "options" Extracts "type", "label" and values information
- extractInformationForConfigFieldsOfTypeUser() : array<string|int, mixed>
- Extract additional information for fields of type "user" Extracts "type" and the function to be called
- getLanguageService() : LanguageService
Properties
$subCategories
This will be filled with the available categories of the current template.
protected
array<string|int, mixed>
$subCategories
= [
// Standard categories:
'enable' => ['Enable features', 'a'],
'dims' => ['Dimensions, widths, heights, pixels', 'b'],
'file' => ['Files', 'c'],
'typo' => ['Typography', 'd'],
'color' => ['Colors', 'e'],
'links' => ['Links and targets', 'f'],
'language' => ['Language specific constants', 'g'],
// subcategories based on the default content elements
'cheader' => ['Content: \'Header\'', 'ma'],
'cheader_g' => ['Content: \'Header\', Graphical', 'ma'],
'ctext' => ['Content: \'Text\'', 'mb'],
'cimage' => ['Content: \'Image\'', 'md'],
'ctextmedia' => ['Content: \'Textmedia\'', 'ml'],
'cbullets' => ['Content: \'Bullet list\'', 'me'],
'ctable' => ['Content: \'Table\'', 'mf'],
'cuploads' => ['Content: \'Filelinks\'', 'mg'],
'cmultimedia' => ['Content: \'Multimedia\'', 'mh'],
'cmedia' => ['Content: \'Media\'', 'mr'],
'cmailform' => ['Content: \'Form\'', 'mi'],
'csearch' => ['Content: \'Search\'', 'mj'],
'clogin' => ['Content: \'Login\'', 'mk'],
'cmenu' => ['Content: \'Menu/Sitemap\'', 'mm'],
'cshortcut' => ['Content: \'Insert records\'', 'mn'],
'clist' => ['Content: \'List of records\'', 'mo'],
'chtml' => ['Content: \'HTML\'', 'mq'],
]
Methods
getConfigurationAsValuedArray()
Create a flat array of configuration options from raw constants string.
public
getConfigurationAsValuedArray(string $rawConfiguration) : array<string|int, mixed>
Result is an array, with configuration item as array keys, and item properties as key-value sub-array: array( 'fooOption' => array( 'type' => 'string', 'value' => 'foo', ... ), 'barOption' => array( 'type' => boolean, 'default_value' => 0, ... ), ... )
Conditions are currently not supported in this context.
Parameters
- $rawConfiguration : string
Return values
array<string|int, mixed>getSubCategories()
Provide a public getter as the constant editor directly accesses this array to render the fields.
public
getSubCategories() : array<string|int, mixed>
Can be removed once the constant editor uses fluid for rendering (see prepareConfigurationForView).
Tags
Return values
array<string|int, mixed>parseComments()
This function compares the flattened constants (default and all).
public
parseComments(array<string|int, mixed> $flatSetup[, array<string|int, mixed>|null $default = null ]) : array<string|int, mixed>
Returns an array with the constants from the whole template which may be edited by the module.
Parameters
- $flatSetup : array<string|int, mixed>
- $default : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>prepareConfigurationForView()
Converts the configuration array to an hierarchical category array for use in fluid templates.
public
prepareConfigurationForView(array<string|int, mixed> $configuration) : array<string|int, mixed>
Parameters
- $configuration : array<string|int, mixed>
Return values
array<string|int, mixed>buildConfigurationArray()
Builds a configuration array from each line (option) of the config file.
protected
buildConfigurationArray(array<string|int, mixed> $configurationOption) : array<string|int, mixed>
Helper method for getConfigurationPreparedForView()
Parameters
- $configurationOption : array<string|int, mixed>
-
config file line representing one setting
Return values
array<string|int, mixed>extractInformationForConfigFieldsOfTypeOptions()
Extracts additional information for fields of type "options" Extracts "type", "label" and values information
protected
extractInformationForConfigFieldsOfTypeOptions(array<string|int, mixed> $configurationOption) : array<string|int, mixed>
Parameters
- $configurationOption : array<string|int, mixed>
Return values
array<string|int, mixed>extractInformationForConfigFieldsOfTypeUser()
Extract additional information for fields of type "user" Extracts "type" and the function to be called
protected
extractInformationForConfigFieldsOfTypeUser(array<string|int, mixed> $configurationOption) : array<string|int, mixed>
Parameters
- $configurationOption : array<string|int, mixed>
Return values
array<string|int, mixed>getLanguageService()
protected
getLanguageService() : LanguageService