diff options
Diffstat (limited to 'app/Http/RequestHandlers/LocationPage.php')
| -rw-r--r-- | app/Http/RequestHandlers/LocationPage.php | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/app/Http/RequestHandlers/LocationPage.php b/app/Http/RequestHandlers/LocationPage.php index b8006e7640..4d2a9bfd87 100644 --- a/app/Http/RequestHandlers/LocationPage.php +++ b/app/Http/RequestHandlers/LocationPage.php @@ -73,42 +73,26 @@ class LocationPage implements RequestHandlerInterface $xref = $request->getAttribute('xref'); assert(is_string($xref)); - $location = Registry::locationFactory()->make($xref, $tree); - $location = Auth::checkLocationAccess($location, false); + $record = Registry::locationFactory()->make($xref, $tree); + $record = Auth::checkLocationAccess($record, false); // Redirect to correct xref/slug - $slug = Registry::slugFactory()->make($location); + $slug = Registry::slugFactory()->make($record); - if ($location->xref() !== $xref || $request->getAttribute('slug') !== $slug) { - return redirect($location->url(), StatusCodeInterface::STATUS_MOVED_PERMANENTLY); + if ($record->xref() !== $xref || $request->getAttribute('slug') !== $slug) { + return redirect($record->url(), StatusCodeInterface::STATUS_MOVED_PERMANENTLY); } - return $this->viewResponse('gedcom-record-page', [ - 'facts' => $this->facts($location), - 'families' => $location->linkedFamilies('_LOC'), - 'individuals' => $location->linkedIndividuals('_LOC'), - 'notes' => new Collection(), - 'media_objects' => new Collection(), - 'record' => $location, - 'sources' => new Collection(), - 'title' => $location->fullName(), - 'tree' => $tree, + return $this->viewResponse('record-page', [ + 'clipboard_facts' => new Collection(), + 'linked_families' => $record->linkedFamilies($record->tag()), + 'linked_individuals' => $record->linkedIndividuals($record->tag()), + 'linked_media_objects' => null, + 'linked_notes' => null, + 'linked_sources' => null, + 'record' => $record, + 'title' => $record->fullName(), + 'tree' => $tree, ]); } - - /** - * @param Location $location - * - * @return Collection<Fact> - */ - private function facts(Location $location): Collection - { - return $location->facts() - ->sort(static function (Fact $x, Fact $y): int { - $sort_x = array_search($x->tag(), self::FACT_ORDER, true) ?: PHP_INT_MAX; - $sort_y = array_search($y->tag(), self::FACT_ORDER, true) ?: PHP_INT_MAX; - - return $sort_x <=> $sort_y; - }); - } } |
