class SourceString
Same name in other branches
- 9 core/modules/locale/src/SourceString.php \Drupal\locale\SourceString
- 8.9.x core/modules/locale/src/SourceString.php \Drupal\locale\SourceString
- 11.x 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 \Drupal\locale\StringInterface
- class \Drupal\locale\SourceString extends \Drupal\locale\StringBase
Expanded class hierarchy of SourceString
3 files declare their use of SourceString
- DisplayTest.php in core/
modules/ views_ui/ tests/ src/ FunctionalJavascript/ DisplayTest.php - 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 $this->source ?? '';
}
/**
* {@inheritdoc}
*/
public function setString($string) {
$this->source = $string;
return $this;
}
/**
* {@inheritdoc}
*/
public function isNew() {
return empty($this->lid);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
SourceString::getString | public | function | Gets plain string contained in this object. | Overrides StringInterface::getString | |
SourceString::isNew | public | function | Checks whether the object is not saved to storage yet. | Overrides StringInterface::isNew | |
SourceString::isSource | public | function | Checks whether the object is a source string. | Overrides StringInterface::isSource | |
SourceString::isTranslation | public | function | Checks whether the object is a translation string. | Overrides StringInterface::isTranslation | |
SourceString::setString | public | function | Sets the string contained in this object. | Overrides StringInterface::setString | |
StringBase::$context | public | property | The string context. | ||
StringBase::$lid | public | property | The string identifier. | ||
StringBase::$locations | public | property | The string locations indexed by type. | ||
StringBase::$source | public | property | The source string. | ||
StringBase::$storage | protected | property | The locale storage this string comes from or is to be saved to. | ||
StringBase::$version | public | property | The string version. | ||
StringBase::addLocation | public | function | Adds a location for this string. | Overrides StringInterface::addLocation | |
StringBase::delete | public | function | Deletes string object from storage. | Overrides StringInterface::delete | 1 |
StringBase::getId | public | function | Gets the string unique identifier. | Overrides StringInterface::getId | |
StringBase::getLocations | public | function | Gets location information for this string. | Overrides StringInterface::getLocations | |
StringBase::getPlurals | public | function | Splits string to work with plural values. | Overrides StringInterface::getPlurals | |
StringBase::getStorage | public | function | Gets the string storage. | Overrides StringInterface::getStorage | |
StringBase::getValues | public | function | Gets field values that are set for given field names. | Overrides StringInterface::getValues | |
StringBase::getVersion | public | function | Gets the string version. | Overrides StringInterface::getVersion | |
StringBase::hasLocation | public | function | Checks whether the string has a given location. | Overrides StringInterface::hasLocation | |
StringBase::save | public | function | Saves string object to storage. | Overrides StringInterface::save | 1 |
StringBase::setId | public | function | Sets the string unique identifier. | Overrides StringInterface::setId | |
StringBase::setPlurals | public | function | Sets this string using array of plural values. | Overrides StringInterface::setPlurals | |
StringBase::setStorage | public | function | Sets the string storage. | Overrides StringInterface::setStorage | |
StringBase::setValues | public | function | Sets an array of values as object properties. | Overrides StringInterface::setValues | |
StringBase::setVersion | public | function | Sets the string version. | Overrides StringInterface::setVersion | |
StringBase::__construct | public | function | Constructs a new locale string object. | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.