Stud.IP  5.4
I18NStringDatafield Class Reference
Inheritance diagram for I18NStringDatafield:
I18NString

Public Member Functions

 setMetadata ($metadata)
 
 toArray ()
 
 storeTranslations ()
 
- Public Member Functions inherited from I18NString
 __construct ($base, $lang=null, $metadata=[])
 
 __toString ()
 
 jsonSerialize ()
 
 setOriginal ($text)
 
 setTranslations ($lang)
 
 setMetadata ($metadata)
 
 original ()
 
 translation ($lang)
 
 localized ($lang)
 
 setLocalized ($text, $lang)
 
 toArray ()
 
 trim ($symbols=" \\\B")
 
 storeTranslations ()
 
 removeTranslations ()
 

Static Public Member Functions

static load ($object_id, $table='', $field='', $base=null)
 
static fetchDataForField ($object_id, $table, $field)
 
static fetchDataForRow ($object_id, $table)
 
static removeAllTranslations ($object_id, $table, $lang=null)
 
- Static Public Member Functions inherited from I18NString
static setContentLanguage ($language)
 
static getContentLanguage ()
 
static setDefaultLanguage ($language=null)
 
static getDefaultLanguage ()
 
static load ($object_id, $table, $field, $base=null)
 
static fetchDataForField ($object_id, $table, $field)
 
static fetchDataForRow ($object_id, $table)
 
static removeAllTranslations ($object_id, $table, $lang=null)
 

Additional Inherited Members

- Protected Attributes inherited from I18NString
 $base
 
 $lang
 
 $metadata
 
- Static Protected Attributes inherited from I18NString
static $content_language = null
 
static $default_language = null
 

Member Function Documentation

◆ fetchDataForField()

static fetchDataForField (   $object_id,
  $table,
  $field 
)
static

Retrieves all translations for one field.

Parameters
string$object_idThe id of the object with i18n fields.
string$tableThe name of the table with the original values.
string$fieldThe name oof the i18n field.
Returns
array An array with language as key and translation as value.

◆ fetchDataForRow()

static fetchDataForRow (   $object_id,
  $table 
)
static

This function is not used in the context of datafields, so it always returns an empty array.

Parameters
string$object_idThe id of the object with i18n fields.
string$tableThe name of the table with the original values.
Returns
array An empty array.

◆ load()

static load (   $object_id,
  $table = '',
  $field = '',
  $base = null 
)
static

Returns an I18NString object by given object_id, table and field.

Parameters
string$object_idThe id of the object with i18n fields.
string$tableThe name of the table with the original values.
string$fieldThe name of the i18n field.
string$baseSets the original value or retrieve it from database if null.
Returns
I18NString The I18NString object.

◆ removeAllTranslations()

static removeAllTranslations (   $object_id,
  $table,
  $lang = null 
)
static

Removes all translations by given object id and table name. Accepts the language as third parameter to remove only translations to this language.

Parameters
string$object_idThe id of the sorm object.
string$tableThe table name.
string$langOptional name of language.
Returns
int The number of deleted translations.

◆ setMetadata()

setMetadata (   $metadata)

Sets the metadata (database info object_id) of this i18n datafield.

Parameters
array$metadataDatabase info for object_id.

◆ storeTranslations()

storeTranslations ( )

Stores the i18n String manually in the database

◆ toArray()

toArray ( )

Return an array containg the text in all additional languages.

Returns
array

The documentation for this class was generated from the following file: