{"action":"opened","issue":{"url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/181","labels_url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/181/labels{/name}","comments_url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/181/comments","events_url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/181/events","html_url":"https://github.com/WebDevStudios/CMB2/issues/181","id":57185344,"number":181,"title":"CMB2 as a dependency - loads too late","user":{"login":"maxchirkov","id":884600,"avatar_url":"https://avatars.githubusercontent.com/u/884600?v=3","gravatar_id":"","url":"https://api.github.com/users/maxchirkov","html_url":"https://github.com/maxchirkov","followers_url":"https://api.github.com/users/maxchirkov/followers","following_url":"https://api.github.com/users/maxchirkov/following{/other_user}","gists_url":"https://api.github.com/users/maxchirkov/gists{/gist_id}","starred_url":"https://api.github.com/users/maxchirkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxchirkov/subscriptions","organizations_url":"https://api.github.com/users/maxchirkov/orgs","repos_url":"https://api.github.com/users/maxchirkov/repos","events_url":"https://api.github.com/users/maxchirkov/events{/privacy}","received_events_url":"https://api.github.com/users/maxchirkov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-10T14:59:23Z","updated_at":"2015-02-10T14:59:23Z","closed_at":null,"body":"CMB2 is initiated by a version-appended class, which changes on every version, so there is no way to consistently check if init class exists (before it was cmb2_bootstrap_200beta and now it's cmb2_bootstrap_201). The earliest consistent class that loads is CMB2, which loads on init hook with very low priority (9999). This means it executes after most plugins already ran their own init methods. In cases where one would like to use CMB2 as a dependency, it becomes very inconvenient to check if CMB2 exists, since that plugin's action hooks would have to be shifted either into the lower priority of init or even after it. This limits flexibility of the init hook to plugins that depend on CMB2.\r\n\r\nThe solution would be to make it easier to check if CMB2 exists early in the loading process: \r\n1. either stop changing the bootstrap class; \r\n2. add global flag indicating that CMB exists, \r\n3. or load CMB2 class right away so it could be detected by class_exists() early, and simply delay it's instantiation to the init hook.\r\n\r\nThoughts?"}}