Skip to content

Commit 1b017df

Browse files
committed
Included webform title in search
1 parent 2250bc3 commit 1b017df

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

assets/js/webform-index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ document.addEventListener('DOMContentLoaded', () => {
1919
const query = searchInput.value.toLowerCase()
2020
webforms.forEach(webform => {
2121
if (!webform.indexed) {
22-
webform.indexed = index(webform).toLowerCase()
22+
webform.indexed = [...webform.querySelectorAll('[data-indexed]')]
23+
.map(e => e.dataset.indexed)
24+
.join(' ')
25+
.toLowerCase()
2326
}
2427
webform.hidden = !webform.indexed.includes(query)
2528
})

src/Controller/WebformController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,19 @@ public function index(): array {
146146
$sourceUrl = $webform->sourceUrl;
147147
$importedWebform = $importedWebforms[$sourceUrl] ?? NULL;
148148

149+
$title = $attributes['title'] ?? $webform->id;
149150
$item = [
150151
'#type' => 'fieldset',
151-
'#title' => $attributes['title'] ?? 'xxx',
152-
'#attributes' => ['class' => ['os2forms-sync-webform']],
152+
'#title' => $title,
153+
'#attributes' => [
154+
'class' => ['os2forms-sync-webform'],
155+
],
153156

154157
'description' => [
155158
'#type' => 'container',
156159
'#attributes' => [
157160
'class' => ['description'],
158-
'data-indexed' => strip_tags($attributes['description']),
161+
'data-indexed' => strip_tags($title . ' ' . $attributes['description']),
159162
],
160163
'#markup' => Markup::create($attributes['description']),
161164
],

0 commit comments

Comments
 (0)