check in controller if form was submited in this session
This commit is contained in:
parent
4ea79bca79
commit
e6f0cbb190
|
@ -20,6 +20,10 @@ class QRController extends ControllerBase {
|
||||||
public function getfile($ref) {
|
public function getfile($ref) {
|
||||||
//? https://drupal.stackexchange.com/questions/255216/how-to-do-a-redirectresponse-with-a-destination-query-parameter
|
//? https://drupal.stackexchange.com/questions/255216/how-to-do-a-redirectresponse-with-a-destination-query-parameter
|
||||||
|
|
||||||
|
//* check if email cookie is present (form submitted)
|
||||||
|
$session = \Drupal::request()->getSession();
|
||||||
|
$alreadysetemail = $session->get('materio_expo_email');
|
||||||
|
if($alreadysetemail){
|
||||||
//* get node from ref
|
//* get node from ref
|
||||||
$entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
$entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
||||||
$query = $entity_storage->getQuery()
|
$query = $entity_storage->getQuery()
|
||||||
|
@ -36,10 +40,12 @@ class QRController extends ControllerBase {
|
||||||
//* redirect to file
|
//* redirect to file
|
||||||
return new RedirectResponse($file->createFileUrl());
|
return new RedirectResponse($file->createFileUrl());
|
||||||
|
|
||||||
// return [
|
} else {
|
||||||
// '#type' => 'markup',
|
return [
|
||||||
// '#markup' => $this->t("Implement method: getfile with parameter(s): $ref"),
|
'#type' => 'markup',
|
||||||
// ];
|
'#markup' => $this->t("Error, email not provided"),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue