{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/12823","repository_url":"https://api.github.com/repos/yiisoft/yii2","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/12823/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/12823/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/12823/events","html_url":"https://github.com/yiisoft/yii2/issues/12823","id":184819924,"number":12823,"title":"Passing php variables to \\yii\\web\\JsExpression()","user":{"login":"jonny7","id":6732997,"avatar_url":"https://avatars.githubusercontent.com/u/6732997?v=3","gravatar_id":"","url":"https://api.github.com/users/jonny7","html_url":"https://github.com/jonny7","followers_url":"https://api.github.com/users/jonny7/followers","following_url":"https://api.github.com/users/jonny7/following{/other_user}","gists_url":"https://api.github.com/users/jonny7/gists{/gist_id}","starred_url":"https://api.github.com/users/jonny7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonny7/subscriptions","organizations_url":"https://api.github.com/users/jonny7/orgs","repos_url":"https://api.github.com/users/jonny7/repos","events_url":"https://api.github.com/users/jonny7/events{/privacy}","received_events_url":"https://api.github.com/users/jonny7/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/question","name":"question","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-10-24T11:53:52Z","updated_at":"2016-10-27T07:54:14Z","closed_at":"2016-10-24T12:35:46Z","body":"Hi,\r\n\r\nI'm trying to use `\\yii\\web\\JsExpression()` with highcharts and building a custom tooltip, I'm struggling to be able to pass PHP parameters to the function though. I have seen https://github.com/yiisoft/yii2/issues/9609. Is there a way to pass in a php variable so it can be used with `\\yii\\web\\JsExpression()`\r\n\r\n    <?php\r\n    $var = 'hello';\r\n    'formatter' => \\yii\\web\\JsExpression('function(){\r\n           return {$var};\r\n     }')\r\n\r\n\r\n    \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/256572454","html_url":"https://github.com/yiisoft/yii2/issues/12823#issuecomment-256572454","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/12823","id":256572454,"user":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"created_at":"2016-10-27T07:54:14Z","updated_at":"2016-10-27T07:54:14Z","body":"it should be done like this:\r\n\r\n```php\r\n<?php\r\n$var = 'hello';\r\n'formatter' => \\yii\\web\\JsExpression('function(){\r\n       return ' . \\yii\\helpers\\Json::htmlEncode($var) . ';\r\n }')\r\n```\r\n"}}
{"actor":{"display_login":"cebe"}}