new file: olm-login.php

This commit is contained in:
Sven Steinert
2026-05-27 14:17:22 +02:00
parent 1d4cf6e727
commit e99acdce47
25 changed files with 36226 additions and 630 deletions

View File

@@ -111,7 +111,18 @@ final class PageRepository
public function findFrontendPage(string $productSlug, string $versionSlug, string $pageSlug): ?\WP_Post
{
return $this->findFrontendPageInProducts([$productSlug], $versionSlug, $pageSlug);
}
public function findFrontendPageInProducts(array $productSlugs, string $versionSlug, string $pageSlug): ?\WP_Post
{
$productSlugs = array_values(array_filter(array_map('sanitize_title', $productSlugs)));
$pageSlug = $pageSlug ?: '';
if (! $productSlugs) {
return null;
}
$query = new \WP_Query([
'post_type' => 'kb_doc_page',
'post_status' => 'publish',
@@ -119,10 +130,12 @@ final class PageRepository
'no_found_rows' => true,
'meta_query' => [
'relation' => 'AND',
['key' => '_kb_product_slug', 'value' => $productSlug],
['key' => '_kb_version_slug', 'value' => $versionSlug],
['key' => '_kb_page_slug', 'value' => $pageSlug],
],
'tax_query' => [
['taxonomy' => 'kb_product', 'field' => 'slug', 'terms' => $productSlugs],
],
]);
return $query->have_posts() ? $query->posts[0] : null;