Skip to content

Commit a5ca4d6

Browse files
committed
Handled webforms now allowing multiple categories
1 parent af518d8 commit a5ca4d6

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/Controller/WebformController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function index(): array {
184184
'#type' => 'container',
185185
'#attributes' => [
186186
'class' => ['category'],
187-
'data-indexed' => strip_tags($attributes['category']),
187+
'data-indexed' => implode(', ', json_decode($attributes['categories'])),
188188
],
189189

190190
'label' => [
@@ -199,7 +199,7 @@ public function index(): array {
199199
'#attributes' => [
200200
'class' => ['value'],
201201
],
202-
'#value' => $attributes['category'],
202+
'#value' => implode(', ', json_decode($attributes['categories'])),
203203
],
204204
],
205205

src/Helper/JsonAPISerializer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,15 @@ static function ($key) {
8080
return in_array($key, [
8181
'title',
8282
'description',
83-
'category',
83+
'categories',
8484
'elements',
8585
]);
8686
},
8787
ARRAY_FILTER_USE_KEY
8888
);
8989

90+
$attributes['categories'] = json_encode($attributes['categories']);
91+
9092
$attributes = array_map('html_entity_decode', $attributes);
9193

9294
if (isset($attributes['elements'])) {

0 commit comments

Comments
 (0)