xref: /webtrees/resources/views/search-advanced-field.phtml (revision ca1e6d47754d1d3667ac160664ddb033e3d5755e)
153e12c6bSGreg Roach<?php
253e12c6bSGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
553e12c6bSGreg Roach/**
609482a55SGreg Roach * @var array<string> $date_options
76f922bb8SGreg Roach * @var string        $field_label
853e12c6bSGreg Roach * @var string        $field_name
953e12c6bSGreg Roach * @var string        $field_value
1053e12c6bSGreg Roach * @var string        $modifier
1109482a55SGreg Roach * @var array<string> $name_options
12*ca1e6d47SGreg Roach * @var Tree          $tree
1353e12c6bSGreg Roach */
1453e12c6bSGreg Roach
15*ca1e6d47SGreg Roachuse Fisharebest\Webtrees\Place;
16*ca1e6d47SGreg Roachuse Fisharebest\Webtrees\Tree;
17*ca1e6d47SGreg Roach
1853e12c6bSGreg Roach?>
19dd6b2bfcSGreg Roach
209e3c2cf9SGreg Roach<div class="row">
21dd6b2bfcSGreg Roach    <label class="col-sm-3 col-form-label wt-page-options-label" for="fields[<?= e($field_name) ?>]">
226f922bb8SGreg Roach        <?= $field_label ?>
23dd6b2bfcSGreg Roach    </label>
24dd6b2bfcSGreg Roach
25dd6b2bfcSGreg Roach    <div class="col-sm-6 wt-page-options-value">
26*ca1e6d47SGreg Roach        <?php if (str_ends_with($field_name, ':PLAC')) : ?>
27*ca1e6d47SGreg Roach            <?= view('components/select-place', ['name' => 'fields[' . $field_name . ']', 'id' => 'fields-' . $field_name, 'tree' => $tree, 'place' => Place::find((int) $field_value, $tree)]) ?>
28*ca1e6d47SGreg Roach        <?php elseif (str_ends_with($field_name, ':DATE')) : ?>
29*ca1e6d47SGreg Roach            <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*ca1e6d47SGreg Roach        <?php else : ?>
31*ca1e6d47SGreg Roach            <input class="form-control form-control" type="text" id="fields[<?= e($field_name) ?>]" name="fields[<?= e($field_name) ?>]" value="<?= e($field_value) ?>">
32*ca1e6d47SGreg Roach        <?php endif ?>
33dd6b2bfcSGreg Roach    </div>
34dd6b2bfcSGreg Roach
35dd6b2bfcSGreg Roach    <div class="col-sm-3 wt-page-options-value">
36bd29d468SGreg Roach        <?php if (preg_match('/(GIVN|SURN)$/', $field_name) === 1) : ?>
37c9e11c2aSGreg Roach            <?= view('components/select', ['name' => 'modifiers[' . $field_name . ']', 'id' => 'modifiers-' . $field_name, 'selected' => $modifier, 'options' => $name_options]) ?>
38dd6b2bfcSGreg Roach        <?php endif ?>
39dd6b2bfcSGreg Roach
40bd29d468SGreg Roach        <?php if (preg_match('/(DATE)$/', $field_name) === 1) : ?>
41c9e11c2aSGreg Roach            <?= view('components/select', ['name' => 'modifiers[' . $field_name . ']', 'id' => 'modifiers-' . $field_name, 'selected' => $modifier, 'options' => $date_options]) ?>
42dd6b2bfcSGreg Roach        <?php endif ?>
43dd6b2bfcSGreg Roach    </div>
44dd6b2bfcSGreg Roach</div>
45