array( 'label' => __( 'Course', 'rooster-lms' ), 'kind' => 'single', 'post_types' => array( PostTypes::COURSE ), 'default' => 'single-' . PostTypes::COURSE, 'matches' => array( 'object', 'term', 'org', 'role', 'lang' ), 'resolve' => array( self::class, 'resolve_course' ), 'capability' => $cap, ), 'rooster-lms/course-archive' => array( 'label' => __( 'Course catalogue', 'rooster-lms' ), 'kind' => 'archive', 'post_types' => array( PostTypes::COURSE ), 'default' => 'archive-' . PostTypes::COURSE, 'matches' => array( 'org', 'role', 'lang' ), 'capability' => $cap, 'icon' => 'library', ), 'rooster-lms/course-category' => array( 'label' => __( 'Course category', 'rooster-lms' ), 'kind' => 'taxonomy', 'taxonomies' => array( Taxonomies::COURSE_CATEGORY ), 'default' => 'taxonomy-' . Taxonomies::COURSE_CATEGORY, 'matches' => array( 'term', 'org', 'role', 'lang' ), 'resolve' => array( self::class, 'resolve_category' ), 'capability' => $cap, ), 'rooster-lms/lesson' => array( 'label' => __( 'Lesson', 'rooster-lms' ), 'kind' => 'single', 'post_types' => array( PostTypes::LESSON ), 'default' => 'single-' . PostTypes::LESSON, 'matches' => array( 'object', 'term', 'org', 'role', 'lang' ), 'capability' => $cap, ), 'rooster-lms/quiz' => array( 'label' => __( 'Quiz', 'rooster-lms' ), 'kind' => 'single', 'post_types' => array( PostTypes::QUIZ ), 'default' => 'single-' . PostTypes::QUIZ, 'matches' => array( 'object', 'term', 'org', 'role', 'lang' ), 'capability' => $cap, ), 'rooster-lms/lesson-category' => array( 'label' => __( 'Lesson category', 'rooster-lms' ), 'kind' => 'taxonomy', 'taxonomies' => array( Taxonomies::LESSON_CATEGORY ), 'default' => 'taxonomy-' . Taxonomies::LESSON_CATEGORY, 'matches' => array( 'term', 'lang' ), 'capability' => $cap, ), 'rooster-lms/person' => array( 'label' => __( 'Person', 'rooster-lms' ), 'kind' => 'single', 'post_types' => array( PersonsModule::POST_TYPE ), 'default' => 'single-' . PersonsModule::POST_TYPE, 'matches' => array( 'object', 'org', 'lang' ), 'capability' => $cap, ), 'rooster-lms/account' => array( 'label' => __( 'Learner account', 'rooster-lms' ), 'kind' => 'page', 'default' => 'page', 'matches' => array( 'role', 'lang' ), 'page_option' => 'account_page_id', 'page_id' => array( \RoosterLMS\Account\AccountUrls::class, 'page_id' ), 'capability' => $cap, ), 'rooster-lms/register' => array( 'label' => __( 'Registration', 'rooster-lms' ), 'kind' => 'page', 'default' => 'page', 'matches' => array( 'lang' ), 'page_option' => 'registration_page_id', 'page_id' => array( \RoosterLMS\Registration\Front\Urls::class, 'page_id' ), 'capability' => $cap, ), 'rooster-lms/org-portal' => array( 'label' => __( 'Organisation portal', 'rooster-lms' ), 'kind' => 'page', 'default' => 'page', 'matches' => array( 'org', 'role', 'lang' ), 'page_option' => 'portal_page_id', 'capability' => $cap, ), ); } public static function register_slots( $slots ): void { if ( ! is_object( $slots ) || ! method_exists( $slots, 'register' ) ) { return; } foreach ( self::definitions() as $slot => $args ) { $slots->register( $slot, $args ); } } public static function resolve_course( string $slot, array $context ): string { unset( $slot ); $post_id = (int) ( $context['object'] ?? $context['post_id'] ?? 0 ); if ( $post_id <= 0 ) { return ''; } $course_id = Services::courses()->resolve_post( $post_id ); $key = $course_id > 0 ? PageTemplates::resolve( $course_id ) : ''; return str_starts_with( $key, 'elementor-' ) ? '' : $key; } public static function resolve_category( string $slot, array $context ): string { unset( $slot ); $term_id = (int) ( $context['term'] ?? $context['object'] ?? 0 ); if ( $term_id <= 0 ) { return ''; } $category = Services::category_repo()->for_term( $term_id ); $key = null === $category ? '' : PageTemplates::of_category( $category->id ); return str_starts_with( $key, 'elementor-' ) ? '' : $key; } }