Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden construction of context attribute with wp_json_encode & escaping #41

Merged
merged 1 commit into from
Mar 27, 2023

Conversation

westonruter
Copy link
Member

No description provided.

@michalczaplinski
Copy link
Collaborator

Nice, thanks Weston!

@michalczaplinski michalczaplinski merged commit 9aa902e into main Mar 27, 2023
@michalczaplinski michalczaplinski deleted the fix/context-attr-json-escaping branch March 27, 2023 20:15
@luisherranz
Copy link
Member

luisherranz commented Mar 28, 2023

We were thinking about adding a function helper for that. Something like this:

<?php
$context = array( 
  'videoId' => $trailer_id
);
?>

<div 
  <?php echo $wrapper_attributes; ?>
  data-wp-context=<?php echo wp_context( $context ); ?>
>
   ...
</div>

I'll open an issue to discuss 🙂

@luisherranz
Copy link
Member

Issue added here: WordPress/block-interactivity-experiments#198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants