. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Validator; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use function assert; use function is_string; /** * Link a media object to a record. */ class LinkMediaToIndividualModal implements RequestHandlerInterface { /** * @param ServerRequestInterface $request * * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { $tree = Validator::attributes($request)->tree(); $xref = Validator::attributes($request)->isXref()->string('xref'); $media = Registry::mediaFactory()->make($xref, $tree); $media = Auth::checkMediaAccess($media); return response(view('modals/link-media-to-individual', [ 'media' => $media, 'tree' => $tree, ])); } }