Skip to content

Commit

Permalink
Decode entities in select
Browse files Browse the repository at this point in the history
  • Loading branch information
takayukister committed Mar 9, 2024
1 parent 1f7f591 commit 8a9cade
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions modules/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,21 @@ function ( $values, $tag ) {
);

foreach ( $values as $field => $field_values ) {
$field_values = array_map(
static function ( $value ) {
return html_entity_decode(
(string) $value,
ENT_QUOTES | ENT_HTML5,
'UTF-8'
);
},
$field_values
);

$field_values = array_filter(
array_unique( $field_values ),
function ( $value ) {
return is_string( $value ) && '' !== $value;
static function ( $value ) {
return '' !== $value;
}
);

Expand Down

0 comments on commit 8a9cade

Please sign in to comment.