base.html.php
3 years ago
checkbox.html.php
4 years ago
file.html.php
4 years ago
hidden.html.php
4 years ago
html.html.php
4 years ago
label-content.html.php
4 years ago
label.html.php
4 years ago
radio.html.php
4 years ago
select.html.php
4 years ago
textarea.html.php
4 years ago
radio.html.php
41 lines
| 1 | <?php |
| 2 | /** @var Give\Framework\FieldsAPI\Radio $field */ ?> |
| 3 | <?php |
| 4 | /** @var string $fieldIdAttribute */ ?> |
| 5 | <?php |
| 6 | /* Fieldsets + legends are terrible to style, so we just use the semantic markup and style something else. */ ?> |
| 7 | <fieldset> |
| 8 | <legend class="screen-reader-text"> |
| 9 | <?php |
| 10 | include plugin_dir_path(__FILE__) . 'label-content.html.php'; ?> |
| 11 | </legend> |
| 12 | <div class="give-label" aria-hidden="true"> |
| 13 | <?php |
| 14 | include plugin_dir_path(__FILE__) . 'label-content.html.php'; ?> |
| 15 | </div> |
| 16 | <?php |
| 17 | foreach ($field->getOptions() as $index => $option) : ?> |
| 18 | <?php |
| 19 | $id = $fieldIdAttribute . '-' . $index; ?> |
| 20 | <label for="<?php |
| 21 | echo $id; ?>"> |
| 22 | <input |
| 23 | type="radio" |
| 24 | name="<?php |
| 25 | echo $field->getName(); ?>" |
| 26 | id="<?php |
| 27 | echo $id; ?>" |
| 28 | <?php |
| 29 | echo $field->isRequired() ? 'required' : ''; ?> |
| 30 | <?php |
| 31 | echo $option->getValue() === $field->getDefaultValue() ? 'checked' : ''; ?> |
| 32 | value="<?php |
| 33 | echo $option->getValue(); ?>" |
| 34 | > |
| 35 | <?php |
| 36 | echo $option->getLabel() ?: $option->getValue(); ?> |
| 37 | </label> |
| 38 | <?php |
| 39 | endforeach; ?> |
| 40 | </fieldset> |
| 41 |