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
59 lines
| 1 | <?php |
| 2 | /** @var Give\Framework\FieldsAPI\Checkbox $field */ ?> |
| 3 | <?php |
| 4 | /** @var string $fieldIdAttribute */ ?> |
| 5 | |
| 6 | <?php |
| 7 | if ($field->hasOptions()): ?> |
| 8 | <fieldset> |
| 9 | <legend class="screen-reader-text"> |
| 10 | <?php |
| 11 | include plugin_dir_path(__FILE__) . 'label-content.html.php'; ?> |
| 12 | </legend> |
| 13 | <div class="give-label" aria-hidden="true"> |
| 14 | <?php |
| 15 | include plugin_dir_path(__FILE__) . 'label-content.html.php'; ?> |
| 16 | </div> |
| 17 | <?php |
| 18 | foreach ($field->getOptions() as $index => $option) : ?> |
| 19 | <?php |
| 20 | $id = $fieldIdAttribute . '-' . $index; ?> |
| 21 | <label class="give-label" for="<?php |
| 22 | echo $id; ?>"> |
| 23 | <input |
| 24 | type="checkbox" |
| 25 | name="<?php |
| 26 | echo $field->getName(); ?>[]" |
| 27 | id="<?php |
| 28 | echo $id; ?>" |
| 29 | <?php |
| 30 | echo in_array($option->getValue(), $field->getDefaultValue()) ? 'checked' : ''; ?> |
| 31 | value="<?php |
| 32 | echo $option->getValue(); ?>" |
| 33 | > |
| 34 | <?php |
| 35 | echo $option->getLabel() ?: $option->getValue(); ?> |
| 36 | </label> |
| 37 | <?php |
| 38 | endforeach; ?> |
| 39 | </fieldset> |
| 40 | <?php |
| 41 | else: ?> |
| 42 | <label class="give-label"> |
| 43 | <input |
| 44 | type="checkbox" |
| 45 | name="<?php |
| 46 | echo $field->getName(); ?>" |
| 47 | <?php |
| 48 | echo $field->isRequired() ? 'required' : ''; ?> |
| 49 | <?php |
| 50 | echo $field->isChecked() ? 'checked' : ''; ?> |
| 51 | <?php |
| 52 | echo $field->isReadOnly() ? 'readonly' : ''; ?> |
| 53 | > |
| 54 | <?php |
| 55 | echo $field->getLabel(); ?> |
| 56 | </label> |
| 57 | <?php |
| 58 | endif; ?> |
| 59 |