class SourceString
Same name and namespace in other branches
- 10 core/modules/locale/src/SourceString.php \Drupal\locale\SourceString
- 11.x core/modules/locale/src/SourceString.php \Drupal\locale\SourceString
- 9 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
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);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.