Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Encodage du tableau JSON passer via data attribute
// UPDATE::AxelRoche
$var_modal = array(
'id' => $_product->getId(),
'title' => $_product->getName(),
'price' => $_product->getPrice(),
'image' => $_product->getImageUrl(),
'qty' => 1,
$jsonModalProduct = htmlspecialchars(json_encode($var_modal), ENT_QUOTES, 'UTF-8');
<button data-modal-product="<?php echo $jsonModalProduct; ?>">My button</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment