This documentation is for a version that has reached its End Of Life. Such versions are no longer supported and don't receive security updates. Consider updating to a newer version.
Ancestor Criterion¶
The Ancestor Search Criterion searches for content that is an ancestor of the provided location, including this location.
Arguments¶
value- array of location pathStrings
Example¶
PHP¶
1 | |
REST API¶
1 2 3 4 5 | |
1 2 3 4 5 | |
Use case¶
You can use the Ancestor Search Criterion to create a list of breadcrumbs leading to the Location:
``` php {skip-validation} hl_lines="2" $query = new LocationQuery(); query->query = new Criterion\Ancestor([this->locationService->loadLocation($locationId)->pathString]);
$results = this->searchService->findLocations(query); breadcrumbs = []; foreach (results->searchHits as $searchHit) { $breadcrumbs[] = $searchHit; }
return $this->render('parts/breadcrumbs.html.twig', [ 'breadcrumbs' => $breadcrumbs, ]);
1 2 3 4 5 6 7 8 9 | |