Skip to main content

fields/radio.php

This snippet renders a group of radio buttons for forms, enabling users to select one option from a predefined set.

Default

You can overwrite this snippet by placing a custom version in site/snippets/email-manager/fields/radio.php.

Modify the CSS classes or structure to match your project’s requirements.

<?php foreach ($options as $key => $label): ?>
    <div class="radio-option">
        <input type="radio" id="<?= $key ?>" name="<?= $field->name() ?>" value="<?= $key ?>" <?= $field->value() === $key ? 'checked' : '' ?>>
        <label for="<?= $key ?>"><?= $label ?></label>
    </div>
<?php endforeach; ?>