You are here

protected function SmartlingTranslator::filterDirectives in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 src/Plugin/tmgmt/Translator/SmartlingTranslator.php \Drupal\tmgmt_smartling\Plugin\tmgmt\Translator\SmartlingTranslator::filterDirectives()

Parameters

array $directives:

Return value

array

2 calls to SmartlingTranslator::filterDirectives()
SmartlingTranslator::addSmartlingDirectives in src/Plugin/tmgmt/Translator/SmartlingTranslator.php
Adds smartling directives to upload parameters.
SmartlingTranslatorBeingTested::filterDirectives in tests/src/Kernel/SmartlingTranslatorTest.php
1 method overrides SmartlingTranslator::filterDirectives()
SmartlingTranslatorBeingTested::filterDirectives in tests/src/Kernel/SmartlingTranslatorTest.php

File

src/Plugin/tmgmt/Translator/SmartlingTranslator.php, line 385
Contains \Drupal\tmgmt_smartling\Plugin\tmgmt\Translator\SmartlingTranslator.

Class

SmartlingTranslator
Smartling translator plugin.

Namespace

Drupal\tmgmt_smartling\Plugin\tmgmt\Translator

Code

protected function filterDirectives(array $directives) {
  $allowed_directives_for_xml_file = [
    'smartling.entity_escaping',
    'smartling.variants_enabled',
    'smartling.translate_paths',
    'smartling.string_format_paths',
    'smartling.placeholder_format_custom',
    'smartling.placeholder_format',
    'smartling.sltrans',
    'smartling.source_key_paths',
    'smartling.pseudo_inflation',
    'smartling.instruction_paths',
    'smartling.character_limit_paths',
    'smartling.force_inline_for_tags',
  ];
  $result = [];
  foreach ($directives as $directive_name => $directive_value) {
    if (in_array($directive_name, $allowed_directives_for_xml_file)) {
      $result[$directive_name] = $directive_value;
    }
  }
  return $result;
}