WebformTestElementController.php in Webform 8.5
File
tests/modules/webform_test_element/src/Controller/WebformTestElementController.php
View source
<?php
namespace Drupal\webform_test_element\Controller;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Controller\ControllerBase;
class WebformTestElementController extends ControllerBase {
public function index(Request $request) {
$build = [];
$build['webform'] = [
'#type' => 'webform',
'#webform' => 'contact',
];
$properties = [
'sid',
'default_data',
'information',
'action',
];
foreach ($properties as $property) {
if ($value = $request->query
->get($property)) {
switch ($value) {
case 'false':
$value = FALSE;
break;
}
$build['webform']["#{$property}"] = $value;
}
}
return $build;
}
}