{"action":"created","issue":{"url":"https://api.github.com/repos/Elgg/Elgg/issues/8077","labels_url":"https://api.github.com/repos/Elgg/Elgg/issues/8077/labels{/name}","comments_url":"https://api.github.com/repos/Elgg/Elgg/issues/8077/comments","events_url":"https://api.github.com/repos/Elgg/Elgg/issues/8077/events","html_url":"https://github.com/Elgg/Elgg/issues/8077","id":62710986,"number":8077,"title":"Allow class name as event/hook handler","user":{"login":"mrclay","id":170687,"avatar_url":"https://avatars.githubusercontent.com/u/170687?v=3","gravatar_id":"","url":"https://api.github.com/users/mrclay","html_url":"https://github.com/mrclay","followers_url":"https://api.github.com/users/mrclay/followers","following_url":"https://api.github.com/users/mrclay/following{/other_user}","gists_url":"https://api.github.com/users/mrclay/gists{/gist_id}","starred_url":"https://api.github.com/users/mrclay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrclay/subscriptions","organizations_url":"https://api.github.com/users/mrclay/orgs","repos_url":"https://api.github.com/users/mrclay/repos","events_url":"https://api.github.com/users/mrclay/events{/privacy}","received_events_url":"https://api.github.com/users/mrclay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Elgg/Elgg/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"mrclay","id":170687,"avatar_url":"https://avatars.githubusercontent.com/u/170687?v=3","gravatar_id":"","url":"https://api.github.com/users/mrclay","html_url":"https://github.com/mrclay","followers_url":"https://api.github.com/users/mrclay/followers","following_url":"https://api.github.com/users/mrclay/following{/other_user}","gists_url":"https://api.github.com/users/mrclay/gists{/gist_id}","starred_url":"https://api.github.com/users/mrclay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrclay/subscriptions","organizations_url":"https://api.github.com/users/mrclay/orgs","repos_url":"https://api.github.com/users/mrclay/repos","events_url":"https://api.github.com/users/mrclay/events{/privacy}","received_events_url":"https://api.github.com/users/mrclay/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2015-03-18T14:44:27Z","updated_at":"2015-03-20T12:41:49Z","closed_at":null,"body":"Idea by @ewinslow:\r\n\r\n```php\r\nnamespace MyPlugin\\Events;\r\nclass UserLogin {\r\n  const KLASS = __CLASS__;\r\n  public function __invoke($e, $t, \\ElggUser $user) {\r\n    // logic\r\n  }\r\n}\r\n\r\nelgg_register_event_handler('login', 'user', UserLogin::KLASS, 100);\r\n\r\nelgg_unregister_event_handler('login', 'user', UserLogin::KLASS);\r\n\r\n// PHP 5.5+\r\nelgg_register_event_handler('login', 'user', UserLogin::class, 100);\r\n```\r\n\r\nInternally the handler would just be the string `MyPlugin\\Events\\UserLogin`, which could be a function name, so we would need to first check function_exists(). If that fails we ask the DI system for an object of that type."},"comment":{"url":"https://api.github.com/repos/Elgg/Elgg/issues/comments/84004644","html_url":"https://github.com/Elgg/Elgg/issues/8077#issuecomment-84004644","issue_url":"https://api.github.com/repos/Elgg/Elgg/issues/8077","id":84004644,"user":{"login":"mrclay","id":170687,"avatar_url":"https://avatars.githubusercontent.com/u/170687?v=3","gravatar_id":"","url":"https://api.github.com/users/mrclay","html_url":"https://github.com/mrclay","followers_url":"https://api.github.com/users/mrclay/followers","following_url":"https://api.github.com/users/mrclay/following{/other_user}","gists_url":"https://api.github.com/users/mrclay/gists{/gist_id}","starred_url":"https://api.github.com/users/mrclay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrclay/subscriptions","organizations_url":"https://api.github.com/users/mrclay/orgs","repos_url":"https://api.github.com/users/mrclay/repos","events_url":"https://api.github.com/users/mrclay/events{/privacy}","received_events_url":"https://api.github.com/users/mrclay/received_events","type":"User","site_admin":false},"created_at":"2015-03-20T12:41:49Z","updated_at":"2015-03-20T12:41:49Z","body":"I've never seen it before."}}