{"action":"opened","issue":{"url":"https://api.github.com/repos/iddqdidkfa/yii2-knob/issues/1","labels_url":"https://api.github.com/repos/iddqdidkfa/yii2-knob/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/iddqdidkfa/yii2-knob/issues/1/comments","events_url":"https://api.github.com/repos/iddqdidkfa/yii2-knob/issues/1/events","html_url":"https://github.com/iddqdidkfa/yii2-knob/issues/1","id":60576877,"number":1,"title":"Improvement to fully support the format function","user":{"login":"synatree","id":7294077,"avatar_url":"https://avatars.githubusercontent.com/u/7294077?v=3","gravatar_id":"","url":"https://api.github.com/users/synatree","html_url":"https://github.com/synatree","followers_url":"https://api.github.com/users/synatree/followers","following_url":"https://api.github.com/users/synatree/following{/other_user}","gists_url":"https://api.github.com/users/synatree/gists{/gist_id}","starred_url":"https://api.github.com/users/synatree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synatree/subscriptions","organizations_url":"https://api.github.com/users/synatree/orgs","repos_url":"https://api.github.com/users/synatree/repos","events_url":"https://api.github.com/users/synatree/events{/privacy}","received_events_url":"https://api.github.com/users/synatree/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-10T22:02:34Z","updated_at":"2015-03-10T22:02:34Z","closed_at":null,"body":"I made a small change in Knob.php in order to support the format function option.  Because all knobOptions get sent to JSON, the format option has to be protected from this process and then mixed back into the options.\r\n\r\n```php\r\nif( $this->knobOptions['format'] )\r\n        {\r\n                $format = $this->knobOptions['format'];\r\n                unset( $this->knobOptions['format'] );\r\n        }\r\n        else\r\n        {\r\n                $format = false;\r\n        }\r\n\r\n        $knobOptions = empty($this->knobOptions) ? '' : Json::encode($this->knobOptions);\r\n        $js = !$format ? \"jQuery('#{$this->options['id']}').knob({$knobOptions});\\n\" : \"jQuery('#{$this->options['id']}').knob( jQuery.extend({$knobOptions},{format: {$format}}));\\n\";\r\n```"}}