Skip to content

Commit

Permalink
Use strings for openByDefault so boolean is in the generated JSON.
Browse files Browse the repository at this point in the history
  • Loading branch information
jffng committed Sep 3, 2024
1 parent 8bc2e95 commit 9ab8033
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/block-library/src/accordion-item/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function block_core_accordion_item_render( $attributes, $content ) {
);

if ( $p->next_tag( array( 'class_name' => 'wp-block-accordion-item' ) ) ) {
$p->set_attribute( 'data-wp-context', '{ "id": "' . $unique_id . '", "openByDefault": "' . (bool) $attributes['openByDefault'] . '" }' );
$open_by_default = $attributes['openByDefault'] ? 'true' : 'false';
$p->set_attribute( 'data-wp-context', '{ "id": "' . $unique_id . '", "openByDefault": ' . $open_by_default . ' }' );
$p->set_attribute( 'data-wp-class--is-open', 'state.isOpen' );
$p->set_attribute( 'data-wp-init', 'callbacks.initIsOpen' );

Expand Down

0 comments on commit 9ab8033

Please sign in to comment.