class SourceString in Drupal 8
Same name and namespace in other branches
- 9 core/modules/locale/src/SourceString.php \Drupal\locale\SourceString
- 10 core/modules/locale/src/SourceString.php \Drupal\locale\SourceString
Defines the locale source string object.
This class represents a module-defined string value that is to be translated. This string must at least contain a 'source' field, which is the raw source value, and is assumed to be in English language.
Hierarchy
- class \Drupal\locale\StringBase implements StringInterface
- class \Drupal\locale\SourceString
Expanded class hierarchy of SourceString
2 files declare their use of SourceString
- StringBaseTest.php in core/
modules/ locale/ tests/ src/ Unit/ StringBaseTest.php - TranslateEditForm.php in core/
modules/ locale/ src/ Form/ TranslateEditForm.php
File
- core/
modules/ locale/ src/ SourceString.php, line 12
Namespace
Drupal\localeView source
class SourceString extends StringBase {
/**
* {@inheritdoc}
*/
public function isSource() {
return isset($this->source);
}
/**
* {@inheritdoc}
*/
public function isTranslation() {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getString() {
return isset($this->source) ? $this->source : '';
}
/**
* {@inheritdoc}
*/
public function setString($string) {
$this->source = $string;
return $this;
}
/**
* {@inheritdoc}
*/
public function isNew() {
return empty($this->lid);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SourceString:: |
public | function |
Gets plain string contained in this object. Overrides StringInterface:: |
|
SourceString:: |
public | function |
Checks whether the object is not saved to storage yet. Overrides StringInterface:: |
|
SourceString:: |
public | function |
Checks whether the object is a source string. Overrides StringInterface:: |
|
SourceString:: |
public | function |
Checks whether the object is a translation string. Overrides StringInterface:: |
|
SourceString:: |
public | function |
Sets the string contained in this object. Overrides StringInterface:: |
|
StringBase:: |
public | property | The string context. | |
StringBase:: |
public | property | The string identifier. | |
StringBase:: |
public | property | The string locations indexed by type. | |
StringBase:: |
public | property | The source string. | |
StringBase:: |
protected | property | The locale storage this string comes from or is to be saved to. | |
StringBase:: |
public | property | The string version. | |
StringBase:: |
public | function |
Adds a location for this string. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Deletes string object from storage. Overrides StringInterface:: |
1 |
StringBase:: |
public | function |
Gets the string unique identifier. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Gets location information for this string. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Splits string to work with plural values. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Gets the string storage. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Gets field values that are set for given field names. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Gets the string version. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Checks whether the string has a given location. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Saves string object to storage. Overrides StringInterface:: |
1 |
StringBase:: |
public | function |
Sets the string unique identifier. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Sets this string using array of plural values. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Sets the string storage. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Sets an array of values as object properties. Overrides StringInterface:: |
|
StringBase:: |
public | function |
Sets the string version. Overrides StringInterface:: |
|
StringBase:: |
public | function | Constructs a new locale string object. | 1 |