You are here

public function Serializer::importFormFieldsByKey in FillPDF 8.4

Same name and namespace in other branches
  1. 5.0.x src/Serializer.php \Drupal\fillpdf\Serializer::importFormFieldsByKey()

Overwrites empty new field values with previous existing values.

Parameters

\Drupal\fillpdf\FillPdfFormFieldInterface[] $form_fields: Associative array of saved FillPdfFormField objects keyed by entity ID.

string[] $existing_fields: (optional) Array of existing PDF keys.

Return value

string[] Array of unmatched PDF keys.

Deprecated

in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Field lists are already keyed by pdf_key now, so rekeying them is unnecessary. Use ::importFormFields instead.

See also

https://www.drupal.org/project/fillpdf/issues/3055097

\Drupal\fillpdf\SerializerInterface::importFormFields()

File

src/Serializer.php, line 145

Class

Serializer
Class Serializer.

Namespace

Drupal\fillpdf

Code

public function importFormFieldsByKey(array $form_fields, array $existing_fields = []) {
  @trigger_error('SerializerInterface::importFormFieldsByKey() is deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Use \\Drupal\\fillpdf\\SerializerInterface::importFormFields() instead. See https://www.drupal.org/project/fillpdf/issues/3055097', E_USER_DEPRECATED);
  $keyed_fields = [];
  foreach ($form_fields as $form_field) {
    $keyed_fields[$form_field->pdf_key->value] = $form_field;
  }
  return $this
    ->importFormFields($keyed_fields, $existing_fields);
}