‪TYPO3CMS  10.4
TYPO3\CMS\Core\DataHandling\Localization\State Class Reference

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

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

Protected Member Functions

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

Static Protected Member Functions

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

Protected Attributes

string $tableName
 
array $states
 
array $originalStates
 
array $validStates
 

Detailed Description

Value object for l10n_state field value.

Definition at line 23 of file State.php.

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ create()

static State null TYPO3\CMS\Core\DataHandling\Localization\State::create ( string  $tableName)
static
Parameters
string$tableName
Returns
‪State|null

Definition at line 33 of file State.php.

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

Referenced by TYPO3\CMS\Core\DataHandling\Localization\DataMapItem\buildState().

◆ enrich()

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

Add missing states for field names.

Parameters
array$states
Returns
‪array

Definition at line 318 of file State.php.

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

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

◆ export()

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

Definition at line 193 of file State.php.

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

◆ filterFieldNames()

string [] 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 282 of file State.php.

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

Referenced by TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor\getFieldNamesForItemScope(), and TYPO3\CMS\Core\DataHandling\Localization\State\updateStates().

◆ fromJSON()

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

◆ getFieldNames()

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

Definition at line 82 of file State.php.

References $GLOBALS, and TYPO3\CMS\Core\DataHandling\Localization\State\$tableName.

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

◆ getModifiedFieldNames()

string [] TYPO3\CMS\Core\DataHandling\Localization\State::getModifiedFieldNames ( )

◆ getState()

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

Definition at line 270 of file State.php.

◆ hasColumns()

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

Definition at line 101 of file State.php.

References $GLOBALS, and TYPO3\CMS\Core\DataHandling\Localization\State\$tableName.

◆ hasLanguageFieldName()

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

Definition at line 113 of file State.php.

References $GLOBALS, and TYPO3\CMS\Core\DataHandling\Localization\State\$tableName.

◆ hasTranslationParentFieldName()

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

Definition at line 122 of file State.php.

References $GLOBALS, and TYPO3\CMS\Core\DataHandling\Localization\State\$tableName.

◆ isApplicable()

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

◆ isCustomState()

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

Definition at line 243 of file State.php.

◆ isModified()

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

Definition at line 225 of file State.php.

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

◆ isParentState()

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

Definition at line 252 of file State.php.

◆ isSourceState()

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

Definition at line 261 of file State.php.

◆ isUndefined()

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

Definition at line 234 of file State.php.

◆ sanitize()

array 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 303 of file State.php.

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

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

◆ toArray()

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

Definition at line 204 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 179 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().

Referenced by TYPO3\CMS\Core\DataHandling\Localization\DataMapItem\buildState().

Member Data Documentation

◆ $originalStates

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

Definition at line 137 of file State.php.

◆ $states

◆ $tableName

◆ $validStates

array TYPO3\CMS\Core\DataHandling\Localization\State::$validStates
protected
Initial value:
= array(
self::STATE_CUSTOM,
self::STATE_SOURCE,
self::STATE_PARENT,
)

Definition at line 141 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'