You are here

public function Serializer::getFormExportCode in FillPDF 5.0.x

Same name and namespace in other branches
  1. 8.4 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;
}