public function YamlFormRequest::getRouteParameters in YAML Form 8
Get the route parameters for a form/submission and source entity.
Parameters
\Drupal\Core\Entity\EntityInterface $yamlform_entity: A form or form submission.
\Drupal\Core\Entity\EntityInterface|null $source_entity: A form submission's source entity.
Return value
array An array of route parameters.
Overrides YamlFormRequestInterface::getRouteParameters
File
- src/
YamlFormRequest.php, line 134
Class
- YamlFormRequest
- Handles form requests.
Namespace
Drupal\yamlformCode
public function getRouteParameters(EntityInterface $yamlform_entity, EntityInterface $source_entity = NULL) {
if (self::isValidSourceEntity($yamlform_entity, $source_entity)) {
if ($yamlform_entity instanceof YamlFormSubmissionInterface) {
return [
'yamlform_submission' => $yamlform_entity
->id(),
$source_entity
->getEntityTypeId() => $source_entity
->id(),
];
}
else {
return [
$source_entity
->getEntityTypeId() => $source_entity
->id(),
];
}
}
elseif ($yamlform_entity instanceof YamlFormSubmissionInterface) {
return [
'yamlform_submission' => $yamlform_entity
->id(),
'yamlform' => $yamlform_entity
->getYamlForm()
->id(),
];
}
else {
return [
$yamlform_entity
->getEntityTypeId() => $yamlform_entity
->id(),
];
}
}