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
checkbox.html.php
40 lines
| 1 | <?php /** @var Give\Framework\FieldsAPI\Checkbox $field */ ?> |
| 2 | <?php /** @var string $fieldIdAttribute */ ?> |
| 3 | <?php /** @var string $visibilityConditionsAttribute */ ?> |
| 4 | |
| 5 | <?php if ( $field->hasOptions() ): ?> |
| 6 | <fieldset <?php echo $visibilityConditionsAttribute ?>> |
| 7 | <legend class="screen-reader-text"> |
| 8 | <?php include plugin_dir_path( __FILE__ ) . 'label-content.html.php'; ?> |
| 9 | </legend> |
| 10 | <div class="give-label" aria-hidden="true"> |
| 11 | <?php include plugin_dir_path( __FILE__ ) . 'label-content.html.php'; ?> |
| 12 | </div> |
| 13 | <?php foreach ( $field->getOptions() as $index => $option ) : ?> |
| 14 | <?php $id = $fieldIdAttribute . '-' . $index; ?> |
| 15 | <label class="give-label" for="<?php echo $id; ?>"> |
| 16 | <input |
| 17 | type="checkbox" |
| 18 | name="<?php echo $field->getName(); ?>[]" |
| 19 | id="<?php echo $id; ?>" |
| 20 | <?php echo in_array( $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 | <?php else: ?> |
| 28 | <label class="give-label"> |
| 29 | <input |
| 30 | type="checkbox" |
| 31 | name="<?php echo $field->getName(); ?>" |
| 32 | <?php echo $field->isRequired() ? 'required' : ''; ?> |
| 33 | <?php echo $field->isChecked() ? 'checked' : ''; ?> |
| 34 | <?php echo $field->isReadOnly() ? 'readonly' : ''; ?> |
| 35 | <?php include plugin_dir_path( __FILE__ ) . 'conditional-visibility-attribute.html.php'; ?> |
| 36 | > |
| 37 | <?php echo $field->getLabel(); ?> |
| 38 | </label> |
| 39 | <?php endif; ?> |
| 40 |