private function getMedia(Individual $individual): array
    {
        if ($this->media_list === null) {
            // Use facts from this individual and all their spouses
            $facts = $individual->facts();
            foreach ($individual->spouseFamilies() as $family) {
                foreach ($family->facts() as $fact) {
                    $facts->push($fact);
                }
            }
            // Use all media from each fact
            $this->media_list = [];
            foreach ($facts as $fact) {
                // Don't show pending edits, as the user just sees duplicates
                if (!$fact->isPendingDeletion()) {
                    preg_match_all('/(?:^1|\n\d) OBJE @(' . Gedcom::REGEX_XREF . ')@/', $fact->gedcom(), $matches);
                    foreach ($matches[1] as $match) {
                        $media = Media::getInstance($match, $individual->tree());
                        if ($media && $media->canShow()) {
                            $this->media_list[] = $media;
                        }
                    }
                }
            }
            // If a media object is linked twice, only show it once
            $this->media_list = array_unique($this->media_list);
            // Sort these using _WT_OBJE_SORT
            $wt_obje_sort = [];
            foreach ($individual->facts(['_WT_OBJE_SORT']) as $fact) {
                $wt_obje_sort[] = trim($fact->value(), '@');
            }
            usort($this->media_list, static function (Media $x, Media $y) use ($wt_obje_sort): int {
                return array_search($x->xref(), $wt_obje_sort, true) - array_search($y->xref(), $wt_obje_sort, true);
            });
        }

        return $this->media_list;
    }