mirror of
https://github.com/getformwork/formwork.git
synced 2025-02-25 10:12:50 +01:00
30 lines
1.4 KiB
PHP
30 lines
1.4 KiB
PHP
<?= $this->insert('fields.label') ?>
|
|
<div <?= $this->attr([
|
|
'class' => ['array-input', $field->get('associative') ? 'array-input-associative' : ''],
|
|
'id' => $field->name(),
|
|
'data-name' => $field->formName()
|
|
]) ?>>
|
|
<?php foreach ($field->value() ?: ['' => ''] as $key => $value): ?>
|
|
<div class="array-input-row">
|
|
<span class="sort-handle"></span>
|
|
<?php if ($field->get('associative')): ?>
|
|
<input <?= $this->attr([
|
|
'type' => 'text',
|
|
'class' => 'array-input-key',
|
|
'value' => $key,
|
|
'placeholder' => $field->get('placeholder_key')
|
|
]) ?>>
|
|
<?php endif; ?>
|
|
<input <?= $this->attr([
|
|
'type' => 'text',
|
|
'class' => 'array-input-value',
|
|
'name' => $field->formName() . ($field->get('associative') ? '[' . $key . ']' : '[]'),
|
|
'value' => $value,
|
|
'placeholder' => $field->get('placeholder_value')
|
|
]) ?>>
|
|
<button type="button" class="button-link array-input-remove" title="<?= $this->label('fields.array.remove') ?>" aria-label="<?= $this->label('fields.array.remove') ?>"></button>
|
|
<button type="button" class="button-link array-input-add" title="<?= $this->label('fields.array.add') ?>" aria-label="<?= $this->label('fields.array.add') ?>"></button>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|