You are here

public function FillPdfLinkManipulator::generateLink in FillPDF 8.4

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

Generates a FillPdf Url from the given parameters.

Parameters

array $parameters: The array of parameters to be converted into a URL and query string.

Return value

\Drupal\Core\Url Url object.

Overrides FillPdfLinkManipulatorInterface::generateLink

File

src/Service/FillPdfLinkManipulator.php, line 176

Class

FillPdfLinkManipulator

Namespace

Drupal\fillpdf\Service

Code

public function generateLink(array $parameters) {
  if (!isset($parameters['fid'])) {
    throw new \InvalidArgumentException("The \$parameters argument must contain the fid key (the FillPDF Form's ID).");
  }
  $query = [
    'fid' => $parameters['fid'],
  ];
  $query += static::prepareBooleanFlags($parameters);
  $query += static::prepareEntityIds($parameters);
  $fillpdf_link = Url::fromRoute('fillpdf.populate_pdf', [], [
    'query' => $query,
  ]);
  return $fillpdf_link;
}