xref: /webtrees/resources/views/search-advanced-field.phtml (revision 9db3b8943e3966b447e01b7f009c5d279f21439d)
1<?php
2
3declare(strict_types=1);
4
5/**
6 * @var array<string> $date_options
7 * @var string        $field_label
8 * @var string        $field_name
9 * @var string        $field_value
10 * @var string        $modifier
11 * @var array<string> $name_options
12 * @var Tree          $tree
13 */
14
15use Fisharebest\Webtrees\Place;
16use Fisharebest\Webtrees\Tree;
17
18?>
19
20<div class="row">
21    <label class="col-sm-3 col-form-label wt-page-options-label" for="fields[<?= e($field_name) ?>]">
22        <?= $field_label ?>
23    </label>
24
25    <div class="col-sm-6 wt-page-options-value">
26        <?php if (str_ends_with($field_name, ':PLAC')) : ?>
27            <?= view('components/select-place', ['name' => 'fields[' . $field_name . ']', 'id' => 'fields-' . $field_name, 'tree' => $tree, 'place' => Place::find((int) $field_value, $tree)]) ?>
28        <?php elseif (str_ends_with($field_name, ':DATE')) : ?>
29            <input class="form-control form-control" type="text" id="fields[<?= e($field_name) ?>]" name="fields[<?= e($field_name) ?>]" value="<?= e($field_value) ?>" onchange="webtrees.reformatDate(this, 'dmy')">
30        <?php else : ?>
31            <input class="form-control form-control" type="text" id="fields[<?= e($field_name) ?>]" name="fields[<?= e($field_name) ?>]" value="<?= e($field_value) ?>">
32        <?php endif ?>
33    </div>
34
35    <div class="col-sm-3 wt-page-options-value">
36        <?php if (preg_match('/(GIVN|SURN)$/', $field_name) === 1) : ?>
37            <?= view('components/select', ['name' => 'modifiers[' . $field_name . ']', 'id' => 'modifiers-' . $field_name, 'selected' => $modifier, 'options' => $name_options]) ?>
38        <?php endif ?>
39
40        <?php if (preg_match('/(DATE)$/', $field_name) === 1) : ?>
41            <?= view('components/select', ['name' => 'modifiers[' . $field_name . ']', 'id' => 'modifiers-' . $field_name, 'selected' => $modifier, 'options' => $date_options]) ?>
42        <?php endif ?>
43    </div>
44</div>
45