mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 18:11:52 -04:00
Completely type hint template functions and switch to named arguments
This commit is contained in:
parent
6108b5e53d
commit
124e8343fc
125 changed files with 542 additions and 450 deletions
|
@ -1,14 +1,13 @@
|
|||
<?
|
||||
use function Safe\session_unset;
|
||||
|
||||
session_start();
|
||||
|
||||
$exception = HttpInput::SessionObject('exception', Exceptions\AppException::class);
|
||||
$user = HttpInput::SessionObject('user', User::class);
|
||||
$generateNewUuid = HttpInput::Bool(SESSION, 'generate-new-uuid') ?? false;
|
||||
$passwordAction = HttpInput::SessionObject('password-action', Enums\PasswordActionType::class) ?? Enums\PasswordActionType::None;
|
||||
|
||||
try{
|
||||
session_start();
|
||||
$user = HttpInput::SessionObject('user', User::class);
|
||||
$exception = HttpInput::SessionObject('exception', Exceptions\AppException::class);
|
||||
$generateNewUuid = HttpInput::Bool(SESSION, 'generate-new-uuid') ?? false;
|
||||
$passwordAction = HttpInput::SessionObject('password-action', Enums\PasswordActionType::class) ?? Enums\PasswordActionType::None;
|
||||
|
||||
if($user === null){
|
||||
$user = User::GetByIdentifier(HttpInput::Str(GET, 'user-identifier'));
|
||||
}
|
||||
|
@ -38,22 +37,19 @@ catch(Exceptions\InvalidPermissionsException){
|
|||
}
|
||||
?>
|
||||
<?= Template::Header(
|
||||
[
|
||||
'title' => 'Edit user #' . $user->UserId,
|
||||
'canonicalUrl' => $user->Url . '/edit',
|
||||
'css' => ['/css/user.css'],
|
||||
'highlight' => ''
|
||||
]
|
||||
title: 'Edit user #' . $user->UserId,
|
||||
canonicalUrl: $user->Url . '/edit',
|
||||
css: ['/css/user.css']
|
||||
) ?>
|
||||
<main>
|
||||
<section class="narrow">
|
||||
<h1>Edit <?= Formatter::EscapeHtml($user->DisplayName) ?></h1>
|
||||
|
||||
<?= Template::Error(['exception' => $exception]) ?>
|
||||
<?= Template::Error(exception: $exception) ?>
|
||||
|
||||
<form class="create-update-artwork" method="<?= Enums\HttpMethod::Post->value ?>" action="<?= $user->Url ?>" autocomplete="off">
|
||||
<input type="hidden" name="_method" value="<?= Enums\HttpMethod::Patch->value ?>" />
|
||||
<?= Template::UserForm(['user' => $user, 'isEditForm' => true, 'generateNewUuid' => $generateNewUuid, 'passwordAction' => $passwordAction]) ?>
|
||||
<?= Template::UserForm(user: $user, isEditForm: true, generateNewUuid: $generateNewUuid, passwordAction: $passwordAction) ?>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue