You are here

public function Serializer::getFormExportCode in FillPDF 8.4

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

Serializes a FillPDF form for export.

Parameters

\Drupal\fillpdf\FillPdfFormInterface $fillpdf_form: The FillPDF Form to serialize.

Return value

string The serialized FillPDF form.

Overrides SerializerInterface::getFormExportCode

File

src/Serializer.php, line 45

Class

Serializer
Class Serializer.

Namespace

Drupal\fillpdf

Code

public function getFormExportCode(FillPdfFormInterface $fillpdf_form) {
  $fields = $fillpdf_form
    ->getFormFields();
  $form_config = [
    'form' => $this->serializer
      ->normalize($fillpdf_form),
    'fields' => $this->serializer
      ->normalize($fields),
  ];
  $code = $this->serializer
    ->serialize($form_config, 'json');
  return $code;
}