diff --git a/js/advanced_search.entityFields.js b/js/advanced_search.entityFields.js
index a12f3cf..93c2817 100644
--- a/js/advanced_search.entityFields.js
+++ b/js/advanced_search.entityFields.js
@@ -1,26 +1,69 @@
(function ($, Drupal, drupalSettings) {
+
+ function toDropdown(field) {
+ let $inputElement = $('#edit-terms-0-value');
+ $inputElement.replaceWith('');
+
+ }
+
Drupal.behaviors.advanceSearchEntityFields = {
attach: function attach(context, settings) {
let $searchSelectElement = $('#edit-terms-0-search');
let originalSearchSelectOptions = $searchSelectElement.find('option').clone();
- $(document).on('change', '.advanced-search-form-entity', function() {
- console.log('change');
+ $(document).on('change', '.advanced-search-form--entity', function() {
let id = $(this).attr('id');
let i = id.substring(11, 12);
let $select = $('#' + id);
let searchSelectId = 'edit-terms-' + i + '-search';
- console.log(searchSelectId);
let selector = "[id^='" + searchSelectId + "']";
- console.log(selector);
let $searchSelect = $(selector);
- console.log($searchSelect);
- if ($select.val() === 'ba419826c9014f40126565bf413f7a59') { // Auktion
+ if ($select.val() === 'b48556e79962e0a3c8d0041317c853b9') { // Archivalie
+ $searchSelect.empty();
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ $searchSelect.append('');
+ }
+ else if ($select.val() === 'ba419826c9014f40126565bf413f7a59') { // Auktion
$searchSelect.empty();
- $searchSelect.append('');
$searchSelect.append('');
$searchSelect.append('');
$searchSelect.append('');
$searchSelect.append('');
+ $searchSelect.append('');
} else if ($select.val() === 'b1d559f7b6af224a3f6f3b9a12e6b161') { // Institution
$searchSelect.empty();
$searchSelect.append('');
@@ -33,6 +76,11 @@
});
}
});
+
+ $(document).on('change', '.advanced-search-form--select-field', function () {
+ console.log('change select field');
+ //let dropdown = toDropdown('#edit-terms-0-value');
+ });
}
};
diff --git a/src/Form/AdvancedSearchForm.php b/src/Form/AdvancedSearchForm.php
index 2bf2d66..e2d9ed3 100644
--- a/src/Form/AdvancedSearchForm.php
+++ b/src/Form/AdvancedSearchForm.php
@@ -303,7 +303,7 @@ class AdvancedSearchForm extends FormBase {
'#type' => 'select',
'#attributes' => [
'aria-label' => $this->t("Select Entity"),
- 'class' => [$block_class_prefix . '-entity'],
+ 'class' => [$block_class_prefix . '--entity'],
],
'#options' => [
'alles' => $this->t('Alles'),
@@ -319,6 +319,7 @@ class AdvancedSearchForm extends FormBase {
'#type' => 'select',
'#attributes' => [
'aria-label' => $this->t("Select search field"),
+ 'class' => [$block_class_prefix . '--select-field'],
],
'#options' => $options,
'#default_value' => $term_value[self::SEARCH_FORM_FIELD],