Class $k.Attribute
Represents an attribute.
- Defined in: Attribute.js
- Extends: $k.Property
Constructor Attributes | Constructor Name and Description |
---|---|
Method Summary
Class Detail
$k.Attribute()
Method Detail
-
{boolean} hasTranslatedValues()True if the attribute has translated values
- Returns:
- {boolean}
-
Removes the translated value for the language
- Parameters:
- {string} language
- Language of the value. If not defined, the current language will be used
- Throws:
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- {$k.exception.RemoveNotPossible}
- If the language cannot be removed, because it is the last remaining translation
- {$k.exception.TransactionError}
- If no write transaction is active
- Returns:
- {$k.Attribute} The attribute itself
-
Sets the value of the attribute
- Parameters:
- value
- The value that should be set.
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidValue}
- If the value is not in the range of allowed values of the attribute
- {$k.exception.AccessDenied}
- If modifying is not allowed
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- {$k.exception.TransactionError}
- If no write transaction is active
- Returns:
- {$k.Attribute} The attribute
-
Sets the value of the attribute from the string representation
- Parameters:
- {string} string
- The string represantation of the value that should be set.
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidValue}
- If the string is not in the range of allowed values of the attribute
- {$k.exception.AccessDenied}
- If modifying is not allowed
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- {$k.exception.TransactionError}
- If no write transaction is active
- Returns:
- {$k.Attribute} The attribute
-
{string[]} translatedLanguages()Returns the translated languages as 3-letter codes (ISO639 2b). Empty if the attribute is not translated
- Returns:
- {string[]}
-
value(language)Returns the value of the attribute
- Parameters:
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- Returns:
- The value of the attribute. The type depends on the type of the attribute.
-
Returns the range of the values of the attribute
- Returns:
- {$k.ValueRange}
-
{string} valueString(language)Returns the string representation of the value of the attribute
- Parameters:
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- Returns:
- {string}