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