public static function FillPdfMappingHelper::transformString in FillPDF 5.0.x
Same name and namespace in other branches
- 8.4 src/Component/Helper/FillPdfMappingHelper.php \Drupal\fillpdf\Component\Helper\FillPdfMappingHelper::transformString()
Applies form and field level replacements to a string.
Parameters
string $value: The value to replace. Must match the key in a replacements field exactly.
array $form_replacements: A list of form-level replacements.
array $field_replacements: A list of field-level replacements. These have precedence.
Return value
string $value with any matching replacements applied.
Deprecated
in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Deprecated in core.
See also
https://www.drupal.org/project/fillpdf/issues/3044743
File
- src/
Component/ Helper/ FillPdfMappingHelper.php, line 63
Class
- FillPdfMappingHelper
- Class FillPdfMappingHelper.
Namespace
Drupal\fillpdf\Component\HelperCode
public static function transformString($value, array $form_replacements, array $field_replacements) {
@trigger_error('transformString is deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Deprecated in core. See https://www.drupal.org/project/fillpdf/issues/3044743', E_USER_DEPRECATED);
// Merge both with field-level replacements taking precedence.
$replacements = array_merge($form_replacements, $field_replacements);
return isset($replacements[$value]) ? $replacements[$value] : $value;
}