. */ 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\Validator; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; 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 = Validator::attributes($request)->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, ])); } }