-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
@set directive cannot have value with commas. #28
Comments
I experienced this recently myself when trying to do I will make it so |
I've pushed a If you're at all interested in doing a PR later on, that'd be awesome. |
* feature(image): allow passing `raw` as the second parameter to return an attachment URL (Fixes #24) * bugfix(set): allow the second parameter to accept a value containing commas (e.g. an array) (Fixes #28) * enhancement(utilities): add `limit` param to the `parse` method to allow passing a limit to `explode()` (#28) docs(update): add `@image` example for `raw` * chore(deps): Bump lock files
You want me to PR for future issues? or for this issue? (i'm new to PR's,
so i don't quite know how it works)
Looked at your solution and that should work fine.
…On Mon, Dec 2, 2019 at 3:53 PM Brandon ***@***.***> wrote:
Closed #28 <#28>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#28?email_source=notifications&email_token=AB6N64UO7ITOL4DOIW6HG6TQWUONPA5CNFSM4JTVVIXKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOVGRCUDY#event-2845977103>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB6N64TUMAAPF2VHBLXEBDLQWUONPANCNFSM4JTVVIXA>
.
--
Mvh Jan-Thore Skjelfjord
*E-post:* [email protected]
*Mobil:* 0738-26 37 45
|
When using the @set with a value that contains commas, like the following examples...
@set($product_name, apply_filters('woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key))
or...
@set($product_name, "string, with, commas")
will result in....
<?php $_product = apply_filters('woocommerce_cart_item_product'; ?>
...which has unfinished/unclosed parenthesis and all $args missing.
or like this...
<?php $product_name = "string; ?>
...which is missing the last double quote and the rest of the string.
My suggestion would be to add a third parameter in
explode()
forUtil::parse()
function like this...Adding
2
as the third parameter forexplode()
will make it so that it only explodes on the first comma.Can confirm that this works with the two examples provided above.
Alternatively make a new second util method to prevent issues with existing directives that requires explode on all commas.
The text was updated successfully, but these errors were encountered: