|
13 | 13 | <?php $_links = $block->getLinks(); ?>
|
14 | 14 | <?php $_linksLength = 0; ?>
|
15 | 15 | <?php $_isRequired = $block->getLinkSelectionRequired(); ?>
|
16 |
| - <legend class="legend links-title"><span><?= $block->escapeHtml($block->getLinksTitle()) ?></span></legend><br> |
17 |
| - <div class="field downloads<?php if ($_isRequired) echo ' required' ?><?php if (!$_linksPurchasedSeparately) echo ' downloads-no-separately' ?>"> |
18 |
| - <label class="label"><span><?= $block->escapeHtml($block->getLinksTitle()) ?></span></label> |
19 |
| - <div class="control" id="downloadable-links-list" |
20 |
| - data-mage-init='{"downloadable":{ |
21 |
| - "linkElement":"input:checkbox[value]", |
22 |
| - "allElements":"#links_all", |
23 |
| - "config":<?= /* @escapeNotVerified */ $block->getJsonConfig() ?>} |
24 |
| - }' |
25 |
| - data-container-for="downloadable-links"> |
26 |
| - <?php foreach ($_links as $_link): ?> |
27 |
| - <?php $_linksLength++;?> |
28 |
| - <div class="field choice" data-role="link"> |
29 |
| - <?php if ($_linksPurchasedSeparately): ?> |
30 |
| - <input type="checkbox" |
31 |
| - <?php if ($_isRequired): ?>data-validate="{'validate-one-checkbox-required-by-name':'downloadable-links-list'}" <?php endif; ?> |
32 |
| - name="links[]" |
33 |
| - id="links_<?= /* @escapeNotVerified */ $_link->getId() ?>" |
34 |
| - value="<?= /* @escapeNotVerified */ $_link->getId() ?>" <?= /* @escapeNotVerified */ $block->getLinkCheckedValue($_link) ?> /> |
35 |
| - <?php endif; ?> |
36 |
| - <label class="label" for="links_<?= /* @escapeNotVerified */ $_link->getId() ?>"> |
37 |
| - <span><?= $block->escapeHtml($_link->getTitle()) ?></span> |
38 |
| - <?php if ($_link->getSampleFile() || $_link->getSampleUrl()): ?> |
39 |
| - <a class="sample link" |
40 |
| - href="<?= $block->escapeUrl($block->getLinkSampleUrl($_link)) ?>" <?= $block->getIsOpenInNewWindow() ? 'target="_blank"' : '' ?>> |
41 |
| - <?= /* @escapeNotVerified */ __('sample') ?> |
42 |
| - </a> |
43 |
| - <?php endif; ?> |
44 |
| - <?php if ($_linksPurchasedSeparately): ?> |
45 |
| - <?= /* @escapeNotVerified */ $block->getLinkPrice($_link) ?> |
46 |
| - <?php endif; ?> |
47 |
| - </label> |
48 |
| - </div> |
49 |
| - <?php endforeach; ?> |
50 |
| - <?php if ($_linksPurchasedSeparately && $_linksLength > 1): ?> |
51 |
| - <div class="field choice downloads-all"> |
52 |
| - <input type="checkbox" |
53 |
| - data-notchecked="<?= /* @escapeNotVerified */ __('Select all') ?>" |
54 |
| - data-checked="<?= /* @escapeNotVerified */ __('Unselect all') ?>" |
55 |
| - id="links_all" /> |
56 |
| - <label class="label" for="links_all"><span><?= /* @escapeNotVerified */ __('Select all') ?></span></label> |
57 |
| - </div> |
58 |
| - <?php endif; ?> |
59 |
| - </div> |
60 |
| - <?php if ($_isRequired): ?> |
61 |
| - <span id="links-advice-container"></span> |
62 |
| - <?php endif;?> |
63 |
| - </div> |
| 16 | + <?php |
| 17 | +// Show links on frontend only if links are purchased separately |
| 18 | +// or only those links with samples. Otherwise there is no point to show link names |
| 19 | + $samples = false; |
| 20 | + foreach ($_links as $_link){ |
| 21 | + if ($_link->getSampleFile() || $_link->getSampleUrl()) { |
| 22 | + $samples = true; |
| 23 | + break; |
| 24 | + } |
| 25 | + } |
| 26 | + ?> |
| 27 | + <?php if ($samples === true || $_linksPurchasedSeparately): ?> |
| 28 | + <?php /* <legend class="legend links-title"><span><?= $block->escapeHtml($block->getLinksTitle()) ?></span></legend><br> */ ?> |
| 29 | + <div class="field downloads<?php if ($_isRequired) echo ' required' ?><?php if (!$_linksPurchasedSeparately) echo ' downloads-no-separately' ?>"> |
| 30 | + <label class="label"><span><?= $block->escapeHtml($block->getLinksTitle()) ?></span></label> |
| 31 | + <div class="control" id="downloadable-links-list" |
| 32 | + data-mage-init='{"downloadable":{ |
| 33 | + "linkElement":"input:checkbox[value]", |
| 34 | + "allElements":"#links_all", |
| 35 | + "config":<?= /* @escapeNotVerified */ $block->getJsonConfig() ?>} |
| 36 | + }' |
| 37 | + data-container-for="downloadable-links"> |
| 38 | + <?php foreach ($_links as $_link): ?> |
| 39 | + <?php if (($_link->getSampleFile() || $_link->getSampleUrl()) || $_linksPurchasedSeparately): ?> |
| 40 | + <?php $_linksLength++;?> |
| 41 | + <div class="field choice" data-role="link"> |
| 42 | + <?php if ($_linksPurchasedSeparately): ?> |
| 43 | + <input type="checkbox" |
| 44 | + <?php if ($_isRequired): ?>data-validate="{'validate-one-checkbox-required-by-name':'downloadable-links-list'}" <?php endif; ?> |
| 45 | + name="links[]" |
| 46 | + id="links_<?= /* @escapeNotVerified */ $_link->getId() ?>" |
| 47 | + value="<?= /* @escapeNotVerified */ $_link->getId() ?>" <?= /* @escapeNotVerified */ $block->getLinkCheckedValue($_link) ?> /> |
| 48 | + <?php endif; ?> |
| 49 | + <label class="label" for="links_<?= /* @escapeNotVerified */ $_link->getId() ?>"> |
| 50 | + <span><?= $block->escapeHtml($_link->getTitle()) ?></span> |
| 51 | + <?php if ($_link->getSampleFile() || $_link->getSampleUrl()): ?> |
| 52 | + <a class="sample link" |
| 53 | + href="<?= $block->escapeUrl($block->getLinkSampleUrl($_link)) ?>" <?= $block->getIsOpenInNewWindow() ? 'target="_blank"' : '' ?>> |
| 54 | + <?= /* @escapeNotVerified */ __('sample') ?> |
| 55 | + </a> |
| 56 | + <?php endif; ?> |
| 57 | + <?php if ($_linksPurchasedSeparately): ?> |
| 58 | + <?= /* @escapeNotVerified */ $block->getLinkPrice($_link) ?> |
| 59 | + <?php endif; ?> |
| 60 | + </label> |
| 61 | + </div> |
| 62 | + <?php endif; ?> |
| 63 | + <?php endforeach; ?> |
| 64 | + <?php if ($_linksPurchasedSeparately && $_linksLength > 1): ?> |
| 65 | + <div class="field choice downloads-all"> |
| 66 | + <input type="checkbox" |
| 67 | + data-notchecked="<?= /* @escapeNotVerified */ __('Select all') ?>" |
| 68 | + data-checked="<?= /* @escapeNotVerified */ __('Unselect all') ?>" |
| 69 | + id="links_all" /> |
| 70 | + <label class="label" for="links_all"><span><?= /* @escapeNotVerified */ __('Select all') ?></span></label> |
| 71 | + </div> |
| 72 | + <?php endif; ?> |
| 73 | + </div> |
| 74 | + <?php if ($_isRequired): ?> |
| 75 | + <span id="links-advice-container"></span> |
| 76 | + <?php endif;?> |
| 77 | + </div> |
| 78 | + <?php endif; ?> |
64 | 79 | <?php endif; ?>
|
0 commit comments