{"action":"created","issue":{"url":"https://api.github.com/repos/aristath/kirki/issues/1719","repository_url":"https://api.github.com/repos/aristath/kirki","labels_url":"https://api.github.com/repos/aristath/kirki/issues/1719/labels{/name}","comments_url":"https://api.github.com/repos/aristath/kirki/issues/1719/comments","events_url":"https://api.github.com/repos/aristath/kirki/issues/1719/events","html_url":"https://github.com/aristath/kirki/issues/1719","id":283486800,"number":1719,"title":"active_callback doesn't work with custom controls anymore","user":{"login":"janisf","id":15192506,"avatar_url":"https://avatars2.githubusercontent.com/u/15192506?v=4","gravatar_id":"","url":"https://api.github.com/users/janisf","html_url":"https://github.com/janisf","followers_url":"https://api.github.com/users/janisf/followers","following_url":"https://api.github.com/users/janisf/following{/other_user}","gists_url":"https://api.github.com/users/janisf/gists{/gist_id}","starred_url":"https://api.github.com/users/janisf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janisf/subscriptions","organizations_url":"https://api.github.com/users/janisf/orgs","repos_url":"https://api.github.com/users/janisf/repos","events_url":"https://api.github.com/users/janisf/events{/privacy}","received_events_url":"https://api.github.com/users/janisf/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-12-20T08:39:09Z","updated_at":"2018-03-11T12:27:17Z","closed_at":"2018-03-11T12:27:17Z","author_association":"NONE","body":"### Issue description:\r\nAfter updating Kirki to 3.0.19, active_callback doesn't work anymore for custom controls that are dependent on values of Kirki controls.\r\n\r\n### Version used:\r\n3.0.19\r\n\r\n### Using theme_mods or options?\r\ntheme_mod\r\n\r\n### Code to reproduce the issue (config + field(s))\r\n\r\n```\r\nKirki::add_field( 'my-config-1', array(\r\n    'type'     => 'toggle',\r\n    'settings' => 'my_config_1',\r\n    'label'    => __( 'Show?' ),\r\n    'section'  => 'section',\r\n    'transport' => 'auto',\r\n) );\r\nKirki::add_field( 'my-config-2', array(\r\n    'type'     => 'my_custom_control',\r\n    'settings' => 'my_config_2',\r\n    'label'    => __( 'My Custom Control' ),\r\n    'section'  => 'section',\r\n    'transport' => 'postMessage',\r\n    'output'    => array(\r\n        array(\r\n            'element'       => 'body',\r\n            'property'      => 'font',\r\n        ),\r\n    ),\r\n    'active_callback' => array(\r\n        array(\r\n            'setting' => 'my_config_1',\r\n            'operator' => '==',\r\n            'value' => 1\r\n        )\r\n    )\r\n) );\r\n```"},"comment":{"url":"https://api.github.com/repos/aristath/kirki/issues/comments/372111585","html_url":"https://github.com/aristath/kirki/issues/1719#issuecomment-372111585","issue_url":"https://api.github.com/repos/aristath/kirki/issues/1719","id":372111585,"user":{"login":"aristath","id":588688,"avatar_url":"https://avatars0.githubusercontent.com/u/588688?v=4","gravatar_id":"","url":"https://api.github.com/users/aristath","html_url":"https://github.com/aristath","followers_url":"https://api.github.com/users/aristath/followers","following_url":"https://api.github.com/users/aristath/following{/other_user}","gists_url":"https://api.github.com/users/aristath/gists{/gist_id}","starred_url":"https://api.github.com/users/aristath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aristath/subscriptions","organizations_url":"https://api.github.com/users/aristath/orgs","repos_url":"https://api.github.com/users/aristath/repos","events_url":"https://api.github.com/users/aristath/events{/privacy}","received_events_url":"https://api.github.com/users/aristath/received_events","type":"User","site_admin":false},"created_at":"2018-03-11T12:27:17Z","updated_at":"2018-03-11T12:27:17Z","author_association":"OWNER","body":"Diagnosis/Cause:\r\nThe problem is that the custom control doesn't whitelist `required`, and also throws an error because i's doing `$this->json['output'] = $this->output;` but with `output not being whitelisted as well.\r\n\r\nSolution:\r\nIt's actually a pretty easy fix...\r\n2 ways to do it.\r\n1st solution: Your control instead of extending `WP_Customize_Control` can extend `Kirki_Control_Base`.\r\n\r\n2nd solution:\r\nwhitelist `output` and `required`.\r\nYou currently have this:\r\n```php\r\nclass My_Custom_Control extends \\Kirki_Control_Base {\r\n\tpublic $type = 'my_custom_control';\r\n\t.......\r\n\t......\r\n}\r\n```\r\njust add 2 more lines:\r\n```php\r\n```php\r\nclass My_Custom_Control extends \\Kirki_Control_Base {\r\n\tpublic $type = 'my_custom_control';\r\n\tpublic $output = array();\r\n\tpublic $required = array();\r\n\t.......\r\n\t......\r\n}\r\n```\r\n\r\n`public $output = array();` in only necessary because it's being called in the `to_json()` method, so if you don't need it you can remove that as well :+1:"}}
{"actor":{"display_login":"aristath"}}