You are here

protected function TestSource::replacePlaceholders in Translation Management Tool 8

Will replace placeholders in the #text offsets.

Parameters

array $data: Data structures where to replace placeholders.

$variables: Key value pairs.

1 call to TestSource::replacePlaceholders()
TestSource::getData in tmgmt_test/src/Plugin/tmgmt/Source/TestSource.php
Returns an array with the data structured for translation.

File

tmgmt_test/src/Plugin/tmgmt/Source/TestSource.php, line 87

Class

TestSource
Test source plugin implementation.

Namespace

Drupal\tmgmt_test\Plugin\tmgmt\Source

Code

protected function replacePlaceholders(&$data, $variables) {
  foreach (Element::children($data) as $key) {
    if (isset($data[$key]['#text'])) {
      $data[$key]['#text'] = (string) new FormattableMarkup($data[$key]['#text'], $variables);
    }
    else {
      $this
        ->replacePlaceholders($data[$key], $variables);
    }
  }
}