submenu_exists( $parent, $menu_slug ); if ( $menu_exists ) { return; } $hook = add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, array( $this, 'render_page' ), 99 ); if ( is_string( $hook ) && '' !== $hook && ! defined( 'IPSCMI_COREKIT_SYSTEM_STATUS_OWNER' ) ) { define( 'IPSCMI_COREKIT_SYSTEM_STATUS_OWNER', $this->owner_path() ); } } private function owner_path(): string { return defined( 'IPSCMI_ORDER_CART_COREKIT_PLUGIN_PATH' ) ? IPSCMI_ORDER_CART_COREKIT_PLUGIN_PATH : dirname( __DIR__ ); } private function submenu_exists( string $parent, string $slug ): bool { global $submenu; if ( empty( $submenu[ $parent ] ) || ! is_array( $submenu[ $parent ] ) ) { return false; } foreach ( $submenu[ $parent ] as $item ) { if ( isset( $item[2] ) && $item[2] === $slug ) { return true; } } return false; } /** * React mountpoint. */ public function render_page(): void { echo '