Documentation

SettingsLanguageFile extends LanguageFile
in package

SettingsLanguageFile

This is used for the backend (/translation) view

Tags
copyright

Cloudrexx AG

author

Michael Ritter michael.ritter@cloudrexx.com

subpackage

core_locale

version
5.0.0

Table of Contents

Properties

$componentName  : string
The name of the component that defines the language file
$data  : mixed
$dataType  : mixed
$destLanguage  : Language
The source language which defines the language file
$identifier  : mixed
Identifier is used as a kind of description for the DataSet. For example: If you want to save an array with frontend users in a DataSet you can name the identifier something like 'frontendUser' This is used for the ViewGenerator, so you can have separated options for all DataSets
$localeCodes  : array<string|int, mixed>
List of locale codes ordered by translation fallback order per Cx instance
$mode  : string
The language file's mode ('frontend' or 'backend'), used for path
$nestingCount  : int
Counts the nesting level of __call()
$options  : array<string|int, mixed>
List of options
$path  : string
The path to the yaml file containing the customized placeholder data
$placeholders  : array<string|int, mixed>
An Array containing the overwritten placeholders
$sourceLanguage  : Language
The source language which defines the language file
$stringRepresentationBlank  : bool
Whether blank string representations are valid
$stringRepresentationFields  : array<string|int, mixed>
List of fields that should be available in the string representation
$stringRepresentationFormat  : string
Sprintf format for the string representation
$validators  : array<string|int, mixed>
Initialize this array as follows: array( 'columName' => Zend_Validate )
$virtual  : bool
Defines if an entity is virtual and therefore not persistable.
$yamlInterface  : mixed

Methods

__call()  : mixed
Route methods like getName(), getType(), getDirectory(), etc.
__construct()  : mixed
SettingsLanguageFile constructor.
__get()  : mixed
This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.
__toString()  : string
Returns this entity's identifying value
add()  : mixed
Set data-attribute $key to $value
addColumn()  : mixed
Add column to each entry
addPlaceholder()  : mixed
Adds a placeholder to the placeholder array
count()  : int
current()  : mixed
delete()  : mixed
Deletes the customizing file
entryExists()  : mixed
export()  : mixed
Exports the overwritten placeholders, called by save method
exportToFile()  : void
Exports a DataSet to a file using an export interface
filter()  : mixed
Filters entries of this DataSet
flip()  : DataSet
Returns a flipped version of this DataSet
fromYaml()  : mixed
getComponentController()  : SystemComponent
Returns the component controller for this component
getComponentName()  : string
Returns the name of the language file's component
getData()  : array<string|int, mixed>
Returns an array containing the placeholders before the overwrite
getDataType()  : mixed
getDestLang()  : mixed
getEntry()  : mixed
getIdentifier()  : string
This function returns the identifier of the DataSet
getKeyAsString()  : string
Returns this entity's key
getLanguage()  : Language
Returns the language
getMode()  : string
Returns the mode this language file is for
getPath()  : string
Returns the path of the customized YAML file
getPlaceholderArray()  : array<string|int, mixed>
Returns an array of all placeholders
getPlaceholders()  : array<string|int, Placeholder>
Returns an array containing the overwritten placeholders
getTranslatedFieldValue()  : mixed
Returns the value of a translatable field using fallback mechanisms
import()  : array<string|int, mixed>
Imports the placeholders stored in the yaml file
importFromFile()  : DataSet
Imports a DataSet from a file using an import interface
initializeValidators()  : mixed
Set $this->validators
isVirtual()  : bool
Returns the virtuality of the entity
join()  : mixed
Appends the data of passed $dataSet to the current object and rewinds it
key()  : mixed
length()  : mixed
limit()  : mixed
load()  : DataSet
next()  : mixed
remove()  : mixed
Try to remove the declared key from the dataset
removePlaceholder()  : mixed
Removes a customized placeholder.
rewind()  : mixed
save()  : void
Saves the overwritten placeholders to the YAML file
set()  : void
Set data-attribute $key to $value
setDataType()  : mixed
This function sets the DataType of an DataSet
setIdentifier()  : mixed
This function sets the identifier of the DataSet
setLanguage()  : mixed
Sets the language
setPath()  : mixed
Sets the path of the customized YAML file
setPlaceholders()  : mixed
Sets the array containing the overwritten placeholders
setVirtual()  : mixed
Set the virtuality of the entity
size()  : mixed
sort()  : DataSet
Sort this DataSet by the fields and in the order specified
sortColumns()  : mixed
Sort the columns after the given array.
toArray()  : array<string|int, mixed>
Returns a list of all elements data of this DataSet as an array
toYaml()  : mixed
updateLanguageData()  : mixed
Updates the language data with the placeholders from the yaml file
valid()  : mixed
validate()  : mixed
convert()  : mixed
convertObject()  : array<string|int, mixed>
Default conversion of objects
generatePath()  : mixed
getFallbackLocaleCodes()  : array<string|int, mixed>
Returns a list of all locale codes ordered by fallback order
getStringRepresentationBlank()  : bool
Whether blank string representations are valid
getStringRepresentationFields()  : array<string|int, mixed>
Returns a list of fields available in the string representation
getStringRepresentationFormat()  : string
Returns the sprintf() format for the string representation
getYamlInterface()  : mixed
initializeOptions()  : mixed
Initializes the options, sets necessary defaults

Properties

$componentName

The name of the component that defines the language file

protected string $componentName

$identifier

Identifier is used as a kind of description for the DataSet. For example: If you want to save an array with frontend users in a DataSet you can name the identifier something like 'frontendUser' This is used for the ViewGenerator, so you can have separated options for all DataSets

protected mixed $identifier = ''
Tags
access

protected

@var

$identifier

$localeCodes

List of locale codes ordered by translation fallback order per Cx instance

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

Array in the form: array(<instanceId> => array(<localeCode>, ...))

Tags
see
getFallbackLocaleCodes()

$mode

The language file's mode ('frontend' or 'backend'), used for path

protected string $mode

$nestingCount

Counts the nesting level of __call()

protected static int $nestingCount = 0

$options

List of options

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

$path

The path to the yaml file containing the customized placeholder data

protected string $path

$placeholders

An Array containing the overwritten placeholders

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

List of \Cx\Core\Locale\Model\Entity\Placeholder, placeholder name as key

$stringRepresentationBlank

Whether blank string representations are valid

protected bool $stringRepresentationBlank = false

Whether blank string representations are valid

Tags
see
getStringRepresentationBlank()

$stringRepresentationFields

List of fields that should be available in the string representation

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

List of field names

Tags
see
getStringRepresentationFields()

$stringRepresentationFormat

Sprintf format for the string representation

protected string $stringRepresentationFormat = ''

Sprintf format string

Tags
see
getStringRepresentationFormat()

$validators

Initialize this array as follows: array( 'columName' => Zend_Validate )

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

$virtual

Defines if an entity is virtual and therefore not persistable.

protected bool $virtual = false

Defaults to FALSE - not virtual.

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

Tags
throws
Exception

If __call() nesting level reaches 20

Attributes
#[ReturnTypeWillChange]
Return values
mixed

Return value of the method to call

__construct()

SettingsLanguageFile constructor.

public __construct([mixed $sourceLanguage = '' ][, mixed $destLanguage = '' ][, string $componentName = 'Core' ][, bool $frontend = true ][, bool $onlyCustomized = true ]) : mixed

Creates new instance of \Cx\Core\Locale\Model\Entity\SettingsLanguageFile Loads component specific language data according to params

Parameters
$sourceLanguage : mixed = ''
$destLanguage : mixed = ''
$componentName : string = 'Core'

Defines the component

$frontend : bool = true

Defines wether to open the frontend or the backend specific file

$onlyCustomized : bool = true

Defines wether to load only the customized language placeholders or all

Tags
throws
LanguageFileException

__get()

This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.

public __get(mixed $name) : mixed
Parameters
$name : mixed
Attributes
#[ReturnTypeWillChange]

__toString()

Returns this entity's identifying value

public __toString() : string

By default this returns the same as getKeyAsString(), but this method might get overridden by subclasses.

Return values
string

Identifying value for this entity

add()

Set data-attribute $key to $value

public add(mixed $key, mixed $value[, mixed &$convertedData = null ]) : mixed
Parameters
$key : mixed
$value : mixed
$convertedData : mixed = null

addColumn()

Add column to each entry

public addColumn(mixed $column) : mixed
Parameters
$column : mixed

string title of column

current()

public current() : mixed
Attributes
#[ReturnTypeWillChange]

entryExists()

public entryExists(mixed $key) : mixed
Parameters
$key : mixed

exportToFile()

Exports a DataSet to a file using an export interface

public exportToFile(Exportable $exportInterface, string $filename[, bool $useCache = true ][, bool $useCodeBaseCache = false ]) : void
Parameters
$exportInterface : Exportable
$filename : string
$useCache : bool = true

Whether to cache the exported data in user cache.

$useCodeBaseCache : bool = false

If $useCache is set to true, then data is cached in the data user-cache by default. To cache data in the codebase user-cache do set $useCodeBaseCache to true.

Tags
throws
FileSystemException

filter()

Filters entries of this DataSet

public filter(callable $filterFunction) : mixed
Parameters
$filterFunction : callable

flip()

Returns a flipped version of this DataSet

public flip() : DataSet
Return values
DataSet

Flipped DataSet (new instance)

fromYaml()

public static fromYaml(mixed $data) : mixed
Parameters
$data : mixed

getComponentName()

Returns the name of the language file's component

public getComponentName() : string
Return values
string

getData()

Returns an array containing the placeholders before the overwrite

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

The placeholders before overwrite

getEntry()

public getEntry(mixed $key) : mixed
Parameters
$key : mixed

getIdentifier()

This function returns the identifier of the DataSet

public getIdentifier() : string
Tags
access

public

Return values
string

the identifier

getKeyAsString()

Returns this entity's key

public final getKeyAsString([string $separator = '/' ]) : string

If this entity has a composite key, the fields are separated by $separator.

Parameters
$separator : string = '/'

(optional) Separator for composite key fields, default "/"

Return values
string

Entity key as string

getMode()

Returns the mode this language file is for

public getMode() : string
Return values
string

See Cx class constants for possible values

getPath()

Returns the path of the customized YAML file

public getPath() : string
Return values
string

The path to the YAML file

getPlaceholderArray()

Returns an array of all placeholders

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

Key=>value type array

getPlaceholders()

Returns an array containing the overwritten placeholders

public getPlaceholders() : array<string|int, Placeholder>
Return values
array<string|int, Placeholder>

The array containing the placeholders

getTranslatedFieldValue()

Returns the value of a translatable field using fallback mechanisms

public getTranslatedFieldValue(string $fieldName) : mixed

If the field is not translatable its value is returned anyway. Tries to return the value in the following locales (if non-empty):

  • Current locale
  • Default locale
  • All other locales
Parameters
$fieldName : string

Name of a translatable field

import()

Imports the placeholders stored in the yaml file

public static import(Importable $importInterface, mixed $content) : array<string|int, mixed>
Parameters
$importInterface : Importable
$content : mixed

The file's content

Return values
array<string|int, mixed>

The array containing the placeholders

importFromFile()

Imports a DataSet from a file using an import interface

public static importFromFile(Importable $importInterface, string $filename[, bool $useCache = true ][, bool $useCodeBaseCache = false ]) : DataSet
Parameters
$importInterface : Importable
$filename : string
$useCache : bool = true

Whether to try to load the file from cache or not

$useCodeBaseCache : bool = false

If $useCache is set to true, then data is fetched from the data user-cache by default. To fetch data from the codebase user-cache do set $useCodeBaseCache to true.

Tags
todo

Fix CLX-5705 so that we can set a proper return type.

throws
FileSystemException
Return values
DataSet

initializeValidators()

Set $this->validators

public initializeValidators() : mixed

Validators can be found in lib/FRAMEWORK/Validator.class.php These will be executed if validate() is called

isVirtual()

Returns the virtuality of the entity

public isVirtual() : bool
Return values
bool

TRUE if the entity is virtual, otherwise FALSE

join()

Appends the data of passed $dataSet to the current object and rewinds it

public join(DataSet $dataSet) : mixed
Parameters
$dataSet : DataSet

DataSet of which its data should be appended

key()

public key() : mixed
Attributes
#[ReturnTypeWillChange]

limit()

public limit(mixed $length, mixed $offset) : mixed
Parameters
$length : mixed
$offset : mixed

load()

public static load(string $filename[, bool $useCache = true ][, bool $useCodeBaseCache = false ]) : DataSet
Parameters
$filename : string
$useCache : bool = true

Whether to try to load the file from cache or not

$useCodeBaseCache : bool = false

If $useCache is set to true, then data is fetched from the data user-cache by default. To fetch data from the codebase user-cache do set $useCodeBaseCache to true.

Tags
todo

Fix CLX-5705 so that we can set a proper return type.

throws
FileSystemException
Return values
DataSet

next()

public next() : mixed
Attributes
#[ReturnTypeWillChange]

remove()

Try to remove the declared key from the dataset

public remove(string $key) : mixed
Parameters
$key : string
Tags
throws
DataSetException

removePlaceholder()

Removes a customized placeholder.

public removePlaceholder(string $name, string $oldValue) : mixed
Parameters
$name : string

Placeholder name

$oldValue : string

Old/un-customized value

rewind()

public rewind() : mixed
Attributes
#[ReturnTypeWillChange]

save()

Saves the overwritten placeholders to the YAML file

public save([string $filename = '' ][, bool $useCache = true ][, bool $useCodeBaseCache = false ]) : void

If the folder for the YAML file doesn't exist yet, it's created. If the YAML file doesn't exist yet it's created

Parameters
$filename : string = ''

Is ignored since $this->path is used

$useCache : bool = true

Whether to cache the exported data in user cache.

$useCodeBaseCache : bool = false

If $useCache is set to true, then data is cached in the data user-cache by default. To cache data in the codebase user-cache do set $useCodeBaseCache to true.

Tags
throws
FileSystemException

set()

Set data-attribute $key to $value

public set(mixed $key, mixed $value[, mixed &$convertedData = null ]) : void
Parameters
$key : mixed
$value : mixed
$convertedData : mixed = null

setDataType()

This function sets the DataType of an DataSet

public setDataType(string $dataType) : mixed
Parameters
$dataType : string
Tags
access

public

setIdentifier()

This function sets the identifier of the DataSet

public setIdentifier(string $identifier) : mixed
Parameters
$identifier : string

the identifier of the DataSet

Tags
access

public

setPath()

Sets the path of the customized YAML file

public setPath(string $path) : mixed
Parameters
$path : string

The path to the YAML file

setPlaceholders()

Sets the array containing the overwritten placeholders

public setPlaceholders(array<string|int, Placeholder$placeholders) : mixed
Parameters
$placeholders : array<string|int, Placeholder>

The array containing the placeholders

setVirtual()

Set the virtuality of the entity

public setVirtual(bool $virtual) : mixed
Parameters
$virtual : bool

TRUE to set the entity as virtual or otherwise to FALSE

sort()

Sort this DataSet by the fields and in the order specified

public sort(array<string|int, mixed> $order) : DataSet

$order has the following syntax: array( {fieldname} => SORT_ASC|SORT_DESC, [{fieldname2} => SORT_ASC|SORT_DESC, [...]] )

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

Fields and order to sort

Return values
DataSet

Sorted DataSet (new instance)

sortColumns()

Sort the columns after the given array.

public sortColumns(type $orderArr) : mixed

Not defined columns are sorted after the default

Parameters
$orderArr : type

Array with the new order

toArray()

Returns a list of all elements data of this DataSet as an array

public toArray([bool $allowToReturnElement = true ]) : array<string|int, mixed>

If there is only one entry in this DataSet, the entry is returned directly instead of returning a list with just one element. If $allowToReturnElement is set to false a list with just one element is returned.

Parameters
$allowToReturnElement : bool = true

(optional) If set to false this method always returns a list of elements.

Return values
array<string|int, mixed>

List of elements as an array

updateLanguageData()

Updates the language data with the placeholders from the yaml file

public updateLanguageData() : mixed

valid()

public valid() : mixed
Attributes
#[ReturnTypeWillChange]

convert()

protected convert(mixed $data) : mixed
Parameters
$data : mixed

convertObject()

Default conversion of objects

protected convertObject(object $object[, string &$key = '' ][, array<string|int, mixed> $forbiddenClasses = array('DoctrineORMPersistentCollection') ][, string $prefix = 'x.' ]) : array<string|int, mixed>
Parameters
$object : object

Object to convert

$key : string = ''

(Reference) Object key, might get replaced by object's ID

$forbiddenClasses : array<string|int, mixed> = array('DoctrineORMPersistentCollection')

(Optional) List of classes to skip recursion of

$prefix : string = 'x.'

(Optional) Path to current object (see \Cx\Core\DataSource\Model\Entity\DoctrineRepository)

Return values
array<string|int, mixed>

Converted data

getFallbackLocaleCodes()

Returns a list of all locale codes ordered by fallback order

protected getFallbackLocaleCodes() : array<string|int, mixed>
  • First entry is the current locale
  • Second entry is the default locale (if different from current, it's omitted otherwise)
  • Then all other locales follow (in no particular order)
Tags
todo

Order the array by the fallback order (same as in ContentManager)

Return values
array<string|int, mixed>

List of locale codes

getStringRepresentationBlank()

Whether blank string representations are valid

protected getStringRepresentationBlank() : bool
Return values
bool

Whether blank string representations are valid

getStringRepresentationFields()

Returns a list of fields available in the string representation

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

List of field names

getStringRepresentationFormat()

Returns the sprintf() format for the string representation

protected getStringRepresentationFormat() : string
Return values
string

sprintf() format string

getYamlInterface()

protected static getYamlInterface() : mixed

initializeOptions()

Initializes the options, sets necessary defaults

protected initializeOptions(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>

Options to set


        
On this page

Search results