You are here

public function FillPdfForm::getFormFields in FillPDF 8.4

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

Returns all FillPdfFormFields associated with this FillPdfForm.

Return value

\Drupal\fillpdf\FillPdfFormFieldInterface[] Associative array of FillPdfFormFields keyed by the pdf_key.

Overrides FillPdfFormInterface::getFormFields

File

src/Entity/FillPdfForm.php, line 222

Class

FillPdfForm
Defines the entity for managing uploaded FillPDF forms.

Namespace

Drupal\fillpdf\Entity

Code

public function getFormFields() {
  $field_ids = \Drupal::entityQuery('fillpdf_form_field')
    ->condition('fillpdf_form', $this
    ->id())
    ->execute();
  $field_storage = \Drupal::entityTypeManager()
    ->getStorage('fillpdf_form_field');
  $fields = $field_storage
    ->loadMultiple($field_ids);
  $keyed_fields = [];
  foreach ($fields as $field) {
    $keyed_fields[$field->pdf_key->value] = $field;
  }
  return $keyed_fields;
}