public static function FillPdfLinkManipulator::parseBooleanFlags in FillPDF 8.4
Same name and namespace in other branches
- 5.0.x src/Service/FillPdfLinkManipulator.php \Drupal\fillpdf\Service\FillPdfLinkManipulator::parseBooleanFlags()
Helper method parsing boolean flags.
@internal
Parameters
array $query: Array of query parameters.
Return value
array An associative array representing the request context.
2 calls to FillPdfLinkManipulator::parseBooleanFlags()
- FillPdfLinkManipulator::parseLink in src/
Service/ FillPdfLinkManipulator.php - Parses a Url object.
- ParseBooleanFlagsTest::testBooleanFlags in tests/
src/ Unit/ LinkManipulator/ ParseBooleanFlagsTest.php - Tests &sample=, &download= and &flatten= query parameters.
File
- src/
Service/ FillPdfLinkManipulator.php, line 114
Class
Namespace
Drupal\fillpdf\ServiceCode
public static function parseBooleanFlags(array $query) {
$context = [
'force_download' => FALSE,
'flatten' => TRUE,
'sample' => FALSE,
];
if (isset($query['download']) && filter_var($query['download'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) === TRUE) {
$context['force_download'] = TRUE;
}
if (isset($query['flatten']) && $query['flatten'] !== '' && filter_var($query['flatten'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) === FALSE) {
$context['flatten'] = FALSE;
}
if (isset($query['sample']) && filter_var($query['sample'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) === TRUE) {
$context['sample'] = TRUE;
}
return $context;
}