You are here

protected function PdfWebformPopulationTest::mapFillPdfFieldsToWebformFields in FillPDF 8.4

Same name and namespace in other branches
  1. 5.0.x tests/src/Functional/PdfWebformPopulationTest.php \Drupal\Tests\fillpdf\Functional\PdfWebformPopulationTest::mapFillPdfFieldsToWebformFields()

Maps FillPdf fields to node fields.

Parameters

\Drupal\fillpdf\Entity\FillPdfFormField[] $fields: Array of FillPdfFormFields.

Throws

\Drupal\Core\Entity\EntityStorageException

1 call to PdfWebformPopulationTest::mapFillPdfFieldsToWebformFields()
PdfWebformPopulationTest::testPdfPopulation in tests/src/Functional/PdfWebformPopulationTest.php
Tests Webform population and image stamping.

File

tests/src/Functional/PdfWebformPopulationTest.php, line 168

Class

PdfWebformPopulationTest
Tests Webform population and image stamping.

Namespace

Drupal\Tests\fillpdf\Functional

Code

protected function mapFillPdfFieldsToWebformFields(array $fields) {
  foreach ($fields as $pdf_key => $field) {
    switch ($pdf_key) {
      case 'ImageField':
        $field->value = '[webform_submission:values:image]';
        break;
      case 'TextField1':
        $field->value = '[webform_submission:webform:title]';
        break;
      case 'TestButton':
        $field->value = '[webform_submission:values:test_signature]';
        break;
    }
    $field
      ->save();
  }
}