. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Elements\AddressLine; use Fisharebest\Webtrees\Elements\AddressWebPage; use Fisharebest\Webtrees\Elements\NameOfRepository; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Tree; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use function assert; use function response; use function view; /** * Show a form to create a new repository. */ class CreateRepositoryModal implements RequestHandlerInterface { /** * @param ServerRequestInterface $request * * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { $tree = $request->getAttribute('tree'); assert($tree instanceof Tree); $elements = [ 'name' => new NameOfRepository(I18N::translateContext('Repository', 'Name')), 'address' => new AddressLine(I18N::translate('Address')), 'url' => new AddressWebPage(I18N::translate('URL')), ]; return response(view('modals/create-repository', [ 'elements' => $elements, 'tree' => $tree, ])); } }