TYPO3 CMS  TYPO3_8-7
TYPO3\CMS\Core\DataHandling\Localization\State Class Reference

Public Member Functions

 __construct (string $tableName, array $states=[])
 
 update (array $states)
 
 updateStates (string $currentState, string $targetState)
 
 export ()
 
 toArray ()
 
 getModifiedFieldNames ()
 
 isModified ()
 
 isUndefined (string $fieldName)
 
 isCustomState (string $fieldName)
 
 isParentState (string $fieldName)
 
 isSourceState (string $fieldName)
 
 getState (string $fieldName)
 
 filterFieldNames (string $desiredState, bool $modified=false)
 

Static Public Member Functions

static create (string $tableName)
 
static fromJSON (string $tableName, string $json=null)
 
static isApplicable (string $tableName)
 
static getFieldNames (string $tableName)
 

Public Attributes

const STATE_CUSTOM = 'custom'
 
const STATE_PARENT = 'parent'
 
const STATE_SOURCE = 'source'
 

Protected Member Functions

 sanitize (array $states)
 
 enrich (array $states)
 

Static Protected Member Functions

static hasColumns (string $tableName)
 
static hasLanguageFieldName (string $tableName)
 
static hasTranslationParentFieldName (string $tableName)
 

Protected Attributes

 $tableName
 
 $states
 
 $originalStates
 
 $validStates
 

Detailed Description

Value object for l10n_state field value.

Definition at line 22 of file State.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\DataHandling\Localization\State::__construct ( string  $tableName,
array  $states = [] 
)

Member Function Documentation

◆ create()

static TYPO3\CMS\Core\DataHandling\Localization\State::create ( string  $tableName)
static

◆ enrich()

TYPO3\CMS\Core\DataHandling\Localization\State::enrich ( array  $states)
protected

Add missing states for field names.

Parameters
array$states
Returns
array

Definition at line 321 of file State.php.

References TYPO3\CMS\Core\DataHandling\Localization\State\$states.

Referenced by TYPO3\CMS\Core\DataHandling\Localization\State\__construct().

◆ export()

TYPO3\CMS\Core\DataHandling\Localization\State::export ( )
Returns
string|null

Definition at line 196 of file State.php.

◆ filterFieldNames()

TYPO3\CMS\Core\DataHandling\Localization\State::filterFieldNames ( string  $desiredState,
bool  $modified = false 
)

Filters field names having a desired state.

Parameters
string$desiredState
bool$modified
Returns
string[]

Definition at line 285 of file State.php.

References TYPO3\CMS\Core\DataHandling\Localization\State\getModifiedFieldNames().

Referenced by TYPO3\CMS\Core\DataHandling\Localization\State\updateStates().

◆ fromJSON()

static TYPO3\CMS\Core\DataHandling\Localization\State::fromJSON ( string  $tableName,
string  $json = null 
)
static

◆ getFieldNames()

static TYPO3\CMS\Core\DataHandling\Localization\State::getFieldNames ( string  $tableName)
static
Parameters
string$tableName
Returns
array

Definition at line 81 of file State.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor\getFieldNamesToBeHandled().

◆ getModifiedFieldNames()

TYPO3\CMS\Core\DataHandling\Localization\State::getModifiedFieldNames ( )

◆ getState()

TYPO3\CMS\Core\DataHandling\Localization\State::getState ( string  $fieldName)
Parameters
string$fieldName
Returns
string|null

Definition at line 273 of file State.php.

◆ hasColumns()

static TYPO3\CMS\Core\DataHandling\Localization\State::hasColumns ( string  $tableName)
staticprotected
Parameters
string$tableName
Returns
bool

Definition at line 100 of file State.php.

References $GLOBALS.

◆ hasLanguageFieldName()

static TYPO3\CMS\Core\DataHandling\Localization\State::hasLanguageFieldName ( string  $tableName)
staticprotected
Parameters
string$tableName
Returns
bool

Definition at line 112 of file State.php.

References $GLOBALS.

◆ hasTranslationParentFieldName()

static TYPO3\CMS\Core\DataHandling\Localization\State::hasTranslationParentFieldName ( string  $tableName)
staticprotected
Parameters
string$tableName
Returns
bool

Definition at line 121 of file State.php.

References $GLOBALS.

◆ isApplicable()

◆ isCustomState()

TYPO3\CMS\Core\DataHandling\Localization\State::isCustomState ( string  $fieldName)
Parameters
string$fieldName
Returns
bool

Definition at line 246 of file State.php.

◆ isModified()

TYPO3\CMS\Core\DataHandling\Localization\State::isModified ( )
Returns
bool

Definition at line 228 of file State.php.

References TYPO3\CMS\Core\DataHandling\Localization\State\getModifiedFieldNames().

◆ isParentState()

TYPO3\CMS\Core\DataHandling\Localization\State::isParentState ( string  $fieldName)
Parameters
string$fieldName
Returns
bool

Definition at line 255 of file State.php.

◆ isSourceState()

TYPO3\CMS\Core\DataHandling\Localization\State::isSourceState ( string  $fieldName)
Parameters
string$fieldName
Returns
bool

Definition at line 264 of file State.php.

◆ isUndefined()

TYPO3\CMS\Core\DataHandling\Localization\State::isUndefined ( string  $fieldName)
Parameters
string$fieldName
Returns
bool

Definition at line 237 of file State.php.

◆ sanitize()

TYPO3\CMS\Core\DataHandling\Localization\State::sanitize ( array  $states)
protected

Filter out field names that don't exist in TCA.

Parameters
array$states
Returns
array

Definition at line 306 of file State.php.

Referenced by TYPO3\CMS\Core\DataHandling\Localization\State\__construct(), and TYPO3\CMS\Core\DataHandling\Localization\State\update().

◆ toArray()

TYPO3\CMS\Core\DataHandling\Localization\State::toArray ( )
Returns
array

Definition at line 207 of file State.php.

◆ update()

TYPO3\CMS\Core\DataHandling\Localization\State::update ( array  $states)

◆ updateStates()

TYPO3\CMS\Core\DataHandling\Localization\State::updateStates ( string  $currentState,
string  $targetState 
)

Updates field names having a particular state to a target state.

Parameters
string$currentState
string$targetState

Definition at line 182 of file State.php.

References TYPO3\CMS\Core\DataHandling\Localization\State\$states, TYPO3\CMS\Core\DataHandling\Localization\State\filterFieldNames(), and TYPO3\CMS\Core\DataHandling\Localization\State\update().

Member Data Documentation

◆ $originalStates

TYPO3\CMS\Core\DataHandling\Localization\State::$originalStates
protected

Definition at line 139 of file State.php.

◆ $states

◆ $tableName

TYPO3\CMS\Core\DataHandling\Localization\State::$tableName
protected

◆ $validStates

TYPO3\CMS\Core\DataHandling\Localization\State::$validStates
protected
Initial value:
= [
self::STATE_CUSTOM,
self::STATE_SOURCE,
self::STATE_PARENT,
]

Definition at line 144 of file State.php.

◆ STATE_CUSTOM

const TYPO3\CMS\Core\DataHandling\Localization\State::STATE_CUSTOM = 'custom'

◆ STATE_PARENT

const TYPO3\CMS\Core\DataHandling\Localization\State::STATE_PARENT = 'parent'

◆ STATE_SOURCE

const TYPO3\CMS\Core\DataHandling\Localization\State::STATE_SOURCE = 'source'