diff --git a/modules/os2forms_dawa/os2forms_dawa.routing.yml b/modules/os2forms_dawa/os2forms_dawa.routing.yml index 270d3a38..458f5e0e 100644 --- a/modules/os2forms_dawa/os2forms_dawa.routing.yml +++ b/modules/os2forms_dawa/os2forms_dawa.routing.yml @@ -1,11 +1,7 @@ os2forms_dawa.element.autocomplete: - path: '/os2forms-dawa/{webform}/autocomplete/{element_type}' + path: '/os2forms-dawa/autocomplete/{element_type}' defaults: _controller: '\Drupal\os2forms_dawa\Controller\DawaElementController::autocomplete' _format: json - options: - parameters: - webform: - type: 'entity:webform' requirements: - _entity_access: 'webform.submission_page' + _permission: 'access content' diff --git a/modules/os2forms_dawa/src/Controller/DawaElementController.php b/modules/os2forms_dawa/src/Controller/DawaElementController.php index 45fdf76e..0da4be9d 100644 --- a/modules/os2forms_dawa/src/Controller/DawaElementController.php +++ b/modules/os2forms_dawa/src/Controller/DawaElementController.php @@ -17,15 +17,13 @@ class DawaElementController extends ControllerBase { * * @param \Symfony\Component\HttpFoundation\Request $request * The current request object containing the search string. - * @param \Drupal\webform\WebformInterface $webform - * A webform. * @param string $element_type * Type of the webform element. * * @return \Symfony\Component\HttpFoundation\JsonResponse * A JSON response containing the autocomplete suggestions. */ - public function autocomplete(Request $request, WebformInterface $webform, $element_type) { + public function autocomplete(Request $request, $element_type) { // Get autocomplete query. $query = $request->query; $q = $query->get('q') ?: ''; diff --git a/modules/os2forms_dawa/src/Element/DawaElementAddressMatrikula.php b/modules/os2forms_dawa/src/Element/DawaElementAddressMatrikula.php index 5c8d092f..ab6eab2d 100644 --- a/modules/os2forms_dawa/src/Element/DawaElementAddressMatrikula.php +++ b/modules/os2forms_dawa/src/Element/DawaElementAddressMatrikula.php @@ -19,19 +19,9 @@ class DawaElementAddressMatrikula extends WebformCompositeBase { public static function getCompositeElements(array $element) { $elements = []; if ($element) { - $matrikula_wrapper_id = $element['#webform_id'] . '-matrikula-wrapper'; - $elements['address'] = [ '#type' => 'os2forms_dawa_address', '#title' => isset($element['#address_field_title']) ? $element['#address_field_title'] : t('Address'), - '#ajax' => [ - 'callback' => [DawaElementAddressMatrikula::class, 'matrikulaUpdateSelectOptions'], - 'event' => 'change', - 'wrapper' => $matrikula_wrapper_id, - 'progress' => [ - 'type' => 'none', - ], - ], '#remove_place_name' => isset($element['#remove_place_name']) ? $element['#remove_place_name'] : FALSE, '#remove_code' => isset($element['#remove_code']) ? $element['#remove_code'] : FALSE, '#limit_by_municipality' => isset($element['#limit_by_municipality']) ? $element['#limit_by_municipality'] : FALSE, @@ -40,29 +30,49 @@ public static function getCompositeElements(array $element) { $elements['matrikula'] = [ '#type' => 'select', '#title' => isset($element['#matrikula_field_title']) ? $element['#matrikula_field_title'] : t('Matrikula'), - '#prefix' => '