You are here

public static function FillPdfLinkManipulator::prepareBooleanFlags in FillPDF 8.4

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

Helper method preparing boolean flags for link generation.

@internal

Parameters

array $parameters: Array of parameters.

Return value

array An associative array of sanitized boolean flags.

1 call to FillPdfLinkManipulator::prepareBooleanFlags()
FillPdfLinkManipulator::generateLink in src/Service/FillPdfLinkManipulator.php
Generates a FillPdf Url from the given parameters.

File

src/Service/FillPdfLinkManipulator.php, line 207

Class

FillPdfLinkManipulator

Namespace

Drupal\fillpdf\Service

Code

public static function prepareBooleanFlags(array $parameters) {

  // @todo: Create a value object for FillPdfMergeContext and get the defaults
  // here from that.
  $query = [];
  if (!empty($parameters['force_download'])) {
    $query['download'] = TRUE;
  }
  if (isset($parameters['flatten']) && $parameters['flatten'] == FALSE) {
    $query['flatten'] = FALSE;
  }
  if (!empty($parameters['sample'])) {
    $query['sample'] = TRUE;
  }
  return $query;
}