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