<?php $this->extend('form_row'); ?>

<?php $this->block('field'); ?>
<?php if ($this->hasErrors()): ?>
  <span class="errortip" title="<?= htmlspecialchars($this->getErrorsAsString()); ?>" data-tooltip="position: top; offsetY: 10; theme: tooltipster-error; contentAsHTML: true;">?</span>
<?php endif; ?>
  <fieldset id="ctrl_<?= $this->id; ?>" class="checkbox_container<?php if ($this->class) echo ' ' . $this->class; ?>">

    <?php if ($this->label): ?>
      <legend>
        <?php if ($this->mandatory): ?>
          <span class="invisible"><?= $this->mandatoryField; ?></span> <?php echo $this->label; ?><span class="mandatory">*</span>
        <?php else: ?>
          <?= $this->label; ?>
        <?php endif; ?>
      </legend>
    <?php endif; ?>

    <input type="hidden" name="<?= $this->name; ?>" value="">

    <?php foreach ($this->getOptions() as $option): ?>
      <span><input type="checkbox" name="<?= $option['name']; ?>" id="opt_<?php echo $option['id']; ?>" class="checkbox" value="<?php echo $option['value']; ?>"<?php echo $option['checked']; ?><?php echo $option['attributes']; ?>> <label id="lbl_<?php echo $option['id']; ?>" for="opt_<?php echo $option['id']; ?>"><?php echo $option['label']; ?></label></span>
    <?php endforeach; ?>

  </fieldset>
<?php $this->endblock(); ?>