<?php $this->layout(
    'system::layout/default',
    [
        'title'      => __('Edit message'),
        'page_title' => __('Edit message'),
    ]
) ?>

<h4><?= __('Edit message') ?></h4>
<?php if (! empty($errors['csrf_token'])): ?>
    <div class="alert alert-danger"><?= implode(', ', $errors['csrf_token']) ?></div>
<?php endif ?>
<form action="/guestbook/edit?id=<?= $id ?>" method="post">
    <input type="hidden" name="csrf_token" value="<?= $csrf_token ?>"/>
    <p>
        <b><?= __('Author') ?>:</b> <?= $message->name ?>
    <p>
    <div class="form-group">
        <label for="message"><?= __('Message') ?></label>
        <div><?= $bbcode ?></div>
        <textarea rows="<?= $user->config->fieldHeight ?>" name="message" id="message" required
                  class="form-control <?= ! empty($errors['message']) ? 'is-invalid' : '' ?>"><?= $text ?></textarea>
        <?php if (! empty($errors['message'])): ?>
            <div class="invalid-feedback d-block"><?= implode(', ', $errors['message']) ?></div>
        <?php endif ?>
    </div>
    <div>
        <button type="submit" name="submit" value="submit" class="btn btn-primary mr-2"><?= __('Save') ?></button>
        <a href="/guestbook/" class="btn btn-outline-primary"><?= __('Back') ?></a>
    </div>
</form>
