public static function init(): void { // Hooks immer registrieren — TEC-Prüfung erfolgt in add_menu(), // wo der admin_menu-Hook nach init() feuert und CPTs garantiert registriert sind. add_action( 'admin_menu', [ __CLASS__, 'add_menu' ] ); add_action( 'admin_enqueue_scripts', [ __CLASS__, 'enqueue' ] ); // Template-Download (GET, sehr früh) add_action( 'admin_init', [ __CLASS__, 'maybe_send_template' ] ); // Form-Handler via admin-post add_action( 'admin_post_tcci_upload', [ __CLASS__, 'handle_upload' ] ); add_action( 'admin_post_tcci_import', [ __CLASS__, 'handle_import' ] ); } public static function add_menu(): void { // Hier (admin_menu) sind CPTs bereits registriert → Prüfung ist zuverlässig. if ( ! post_type_exists( 'tribe_events' ) ) { add_action( 'admin_notices', [ __CLASS__, 'notice_missing_tec' ] ); return; } add_submenu_page( 'edit.php?post_type=tribe_events', 'CSV Import — The Events Calendar', 'CSV Import', 'manage_options', self::PAGE_SLUG, [ __CLASS__, 'render_page' ] ); }