<?php if (!$this->fatalError): ?>

    <?= Form::open(['class'=>'layout']) ?>

        <div class="layout-row">
            <div class="row">
                <div class="col-md-5" id="editorSettingsForm">
                    <div class="form-preview">
                        <?= $this->formRender() ?>
                    </div>
                </div>
                <div class="col-md-7">

                    <div
                        id="editorpreferencesCodeeditor"
                        class="field-codeeditor size-large layout-relative"
                        data-control="codeeditor"
                        data-font-size="<?= $fontSize ?>"
                        data-word-wrap="<?= $wordWrap ?>"
                        data-code-folding="<?= $codeFolding ?>"
                        data-tab-size="<?= $tabSize ?>"
                        data-theme="<?= $theme ?>"
                        data-show-invisibles="<?= $showInvisibles ?>"
                        data-highlight-active-line="<?= $highlightActiveLine ?>"
                        data-use-soft-tabs="<?= $useSoftTabs ?>"
                        data-show-gutter="<?= $showGutter ? 'true' : 'false' ?>"
                        data-language="<?= $language ?>"
                        data-margin="<?= $margin ?>"
                        data-vendor-path="<?= URL::to('/modules/backend/formwidgets/codeeditor/assets/vendor/ace') ?>/">
                        <textarea name="editorpreferences_codeeditor"><?= e($this->makePartial('example_code')) ?></textarea>
                    </div>

                </div>
            </div>
        </div>

        <div class="form-buttons">
            <div class="loading-indicator-container">
                <button
                    type="submit"
                    data-request="onSave"
                    data-request-data="redirect:0"
                    data-hotkey="ctrl+s, cmd+s"
                    data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
                    class="btn btn-primary">
                    <?= e(trans('backend::lang.form.save')) ?>
                </button>

                <span class="btn-text">
                    <?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/settings') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
                </span>
            </div>
        </div>
    <?= Form::close() ?>

<?php else: ?>
    <p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
    <p><a href="<?= Backend::url('system/settings') ?>" class="btn btn-default"><?= e(trans('system::lang.settings.return')) ?></a></p>
<?php endif ?>