| 1 |
<?php |
| 2 |
/** |
| 3 |
* The form skeleton: a grey sketch of the form that holds its space while it loads. Rendered by |
| 4 |
* Give\DonationForms\Actions\RenderFormSkeleton, which validates the design id; the parts live in |
| 5 |
* the form-skeleton directory. The bars are decorative, so the whole sketch is hidden from |
| 6 |
* assistive tech and the element that embeds it carries the loading announcement. |
| 7 |
* |
| 8 |
* @since 4.17.0 |
| 9 |
* |
| 10 |
* @var string $design One of classic, multi-step, two-panel-steps. |
| 11 |
* @var bool $header Whether the form shows a header. |
| 12 |
* @var bool $goal Whether the header has a goal bar. |
| 13 |
* @var bool $image Whether the header has an image that takes space. |
| 14 |
* @var string[][] $sections Block names per section, in form order. |
| 15 |
* @var int $gateways Enabled gateways, one row each. |
| 16 |
* @var string[] $variants Block name to field variant, for the section part. |
| 17 |
*/ |
| 18 |
|
| 19 |
use Give\Framework\Views\View; |
| 20 |
|
| 21 |
$modifier = $design === 'two-panel-steps' ? 'two-panel' : $design; |
| 22 |
$headerHtml = $header ? View::load('DonationForms.form-skeleton/header', compact('goal', 'image')) : ''; |
| 23 |
$firstSectionHtml = View::load('DonationForms.form-skeleton/section', [ |
| 24 |
'blocks' => $sections[0] ?? [], |
| 25 |
'gateways' => $gateways, |
| 26 |
'variants' => $variants, |
| 27 |
]); |
| 28 |
?> |
| 29 |
<div class="givewp-embed-skeleton givewp-embed-skeleton--<?= esc_attr($modifier) ?>" aria-hidden="true"> |
| 30 |
<?php if ($design === 'classic') : ?> |
| 31 |
<?= $headerHtml ?> |
| 32 |
<div class="givewp-embed-skeleton__form"> |
| 33 |
<?php foreach ($sections as $blocks) : ?> |
| 34 |
<?= View::load('DonationForms.form-skeleton/section', compact('blocks', 'gateways', 'variants')) ?> |
| 35 |
<?php endforeach; ?> |
| 36 |
<div class="givewp-embed-skeleton__section"> |
| 37 |
<span class="givewp-embed-skeleton__bar givewp-embed-skeleton__button"></span> |
| 38 |
</div> |
| 39 |
</div> |
| 40 |
<?php elseif ($design === 'two-panel-steps') : ?> |
| 41 |
<?= $headerHtml ?> |
| 42 |
<?= View::load('DonationForms.form-skeleton/step', ['content' => $firstSectionHtml]) ?> |
| 43 |
<?php else : ?> |
| 44 |
<?= View::load('DonationForms.form-skeleton/step', ['content' => $header ? $headerHtml : $firstSectionHtml]) ?> |
| 45 |
<?php endif; ?> |
| 46 |
</div> |
| 47 |
|