<?php
$embedCount = $this->getEmbedCount();
$suffix = $this->getSuffix(); // Allow us to set a $suffix to prevent duplicate consent ID's

if (!empty($consents)):
    ?>
    <?php foreach ($consents as $consent):
    $id = $consent->getCookieId();
    $extraClasses = \apply_filters('gdprc_consent_'.$id.'_classes', \apply_filters('gdprc_consent_classes', ($consent->isRequired()) ? 'gdprc_required gdprc_preselected' : 'gdprc_optional'));
    ?>
	<div class="gdprc_item <?php echo $extraClasses; ?>" gdprc-item-id="<?php echo $id; ?>">
        <?php echo \apply_filters('gdprc_consent_'.$id.'_before', \apply_filters('gdprc_consent_before', '')); ?>
		<label for="gdprc_input_<?php echo $id.(\strlen($embedCount) ? '-'.$embedCount : '').(\strlen($suffix) ? '_'.$suffix : ''); ?>" class="gdprc_item__label">
            <?php if (!$this->getSetting('gdprc_section_consent_no_icons') && $icon = $consent->getIcon()): ?>
				<i class="gdprc_item__icon <?php echo \apply_filters('gdprc_consent_'.$id.'_iconclass', \apply_filters('gdprc_consent_iconclass', 'gdpricons gdpri gdpri-2x '.\esc_attr($icon))); ?>"></i>
            <?php endif; ?>
            <?php echo \apply_filters('gdprc_consent_'.$id.'_title', \apply_filters('gdprc_consent_title', $consent->getTitle())); ?>
		</label>

        <?php $checkerClass = $this->getSetting('gdprc_consent_interface_use_toggles') ? 'gdprc_item__toggle' : 'gdprc_item__checkbox'; ?>
		<a name="<?php echo $consent->getHashTag(); ?>" class="gdprc_content__anchor">
			<div class="<?php echo $checkerClass; ?>__wrapper">
				<input id="gdprc_input_<?php echo $id.(\strlen($embedCount) ? '-'.$embedCount : '').(\strlen($suffix) ? '_'.$suffix : ''); ?>" data-gdprconsent="<?php echo $id; ?>" class="<?php echo $checkerClass; ?> gdprc_consent_option <?php echo $extraClasses; ?>" <?php echo $consent->isRequired() ? 'disabled checked="checked"' : ''; ?> type="checkbox" />
				<label for="gdprc_input_<?php echo $id.(\strlen($embedCount) ? '-'.$embedCount : '').(\strlen($suffix) ? '_'.$suffix : ''); ?>"></label>
			</div>
		</a>
		<p class="gdprc_item__desc"><?php echo \apply_filters('gdprc_consent_'.$id.'_description', \apply_filters('gdprc_consent_description', $consent->getContent())); ?></p>
        <?php echo \apply_filters('gdprc_consent_'.$id.'_details_link', \apply_filters('gdprc_consent_details_link', ' <a href="#" class="gdprc_item__link gdprc_link">'.$this->getSetting('gdprc_consent_interface_view_details').'</a>')); ?>
        <?php echo \apply_filters('gdprc_consent_'.$id.'_after', \apply_filters('gdprc_consent_after', '')); ?>
	</div>
	<?php endforeach; ?>
<?php endif; ?>
