. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Http\ViewResponseTrait; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Tree; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use function assert; /** * Edit note objects. */ class EditNotePage implements RequestHandlerInterface { use ViewResponseTrait; /** * Show a form to create a new note object. * * @param ServerRequestInterface $request * * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { $tree = $request->getAttribute('tree'); assert($tree instanceof Tree); $xref = $request->getAttribute('xref'); $note = Registry::noteFactory()->make($xref, $tree); $note = Auth::checkNoteAccess($note, true); return $this->viewResponse('edit/shared-note', [ 'note' => $note, 'title' => I18N::translate('Edit the shared note'), 'tree' => $tree, ]); } }