You are here

public function StringTranslationTrait::setStringTranslation in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php \Drupal\Core\StringTranslation\StringTranslationTrait::setStringTranslation()
  2. 10 core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php \Drupal\Core\StringTranslation\StringTranslationTrait::setStringTranslation()

Sets the string translation service to use.

Parameters

\Drupal\Core\StringTranslation\TranslationInterface $translation: The string translation service.

Return value

$this

3 calls to StringTranslationTrait::setStringTranslation()
BreakpointManager::__construct in core/modules/breakpoint/src/BreakpointManager.php
Constructs a new BreakpointManager instance.
EntityViewsData::__construct in core/modules/views/src/EntityViewsData.php
Constructs an EntityViewsData object.
ForumBreadcrumbBuilderBase::__construct in core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
Constructs a forum breadcrumb builder object.
2 methods override StringTranslationTrait::setStringTranslation()
TestMigrateExecutable::setStringTranslation in core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php
Sets the string translation service.
TestPathBasedBreadcrumbBuilder::setStringTranslation in core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
Sets the string translation service to use.

File

core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php, line 118

Class

StringTranslationTrait
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.

Namespace

Drupal\Core\StringTranslation

Code

public function setStringTranslation(TranslationInterface $translation) {
  $this->stringTranslation = $translation;
  return $this;
}