<?php
/**
 * ITSWEBER CMS – Page Builder Admin Form: Gallery Preview
 * Loaded via AJAX into section cards.
 *
 * @author  Benny Weber
 * @copyright ITSWEBER, www.itsweber.de
 *
 * @var array $data    Decoded JSON content
 * @var array $section DB row (id, section_type, instance_label, ...)
 */
?>

<?php admin_field('text', 'title', __('admin.section.heading'), $data['title'] ?? '', [
    'placeholder' => __('admin.section.gallery_ph_title'),
]) ?>

<?php admin_field('text', 'subtitle', __('admin.section.subtitle'), $data['subtitle'] ?? '', [
    'placeholder' => __('admin.section.gallery_ph_subtitle'),
    'hint'        => __('admin.section.optional'),
]) ?>

<?php admin_field('number', 'count', __('admin.section.preview_count'), (int)($data['count'] ?? 6), [
    'hint'  => __('admin.section.preview_hint_count'),
    'attrs' => 'min="1" max="24" style="width:100px;"',
]) ?>

<?php admin_field('text', 'cta_text', __('admin.section.cta_text'), $data['cta_text'] ?? '', [
    'placeholder' => __('admin.section.gallery_ph_cta'),
    'hint'        => __('admin.section.leave_blank_to_hide'),
]) ?>

<?php admin_field('text', 'cta_url', __('admin.section.cta_url'), $data['cta_url'] ?? '', [
    'placeholder' => '/gallery',
]) ?>

<?php admin_field('checkbox', 'show_image_count', __('admin.section.gallery_show_count'), !empty($data['show_image_count']), [
    'checkbox_label' => __('admin.section.gallery_show_count'),
]) ?>

<p class="form-hint">
    <?= __('admin.section.gallery_hint_manage') ?> <a href="/admin/gallery" target="_blank">Gallery &rarr;</a>
</p>

<?php admin_section_separator() ?>

<?php admin_field_grid_open(2) ?>
    <?php admin_color_scheme_field($data['color_scheme'] ?? '', true) ?>
    <?php render_section_text_color_field($data) ?>
    <?php admin_field('select', 'text_align', __('admin.section.text_align'), $data['text_align'] ?? '', [
        'options'    => ['' => __('admin.section.align_default'), 'left' => __('admin.section.align_left')],
        'wrap_style' => 'margin:0;',
    ]) ?>
<?php admin_field_grid_close() ?>
