block.json
1 year ago
edit.tsx
1 year ago
editor.scss
1 year ago
index.ts
1 year ago
index.tsx
1 year ago
render.php
1 year ago
render.php
28 lines
| 1 | <?php |
| 2 | |
| 3 | use Give\Campaigns\Models\Campaign; |
| 4 | use Give\Campaigns\Repositories\CampaignRepository; |
| 5 | |
| 6 | if ( ! isset($attributes['campaignId'])) { |
| 7 | return; |
| 8 | } |
| 9 | |
| 10 | /** @var Campaign $campaign */ |
| 11 | $campaign = give(CampaignRepository::class)->getById($attributes['campaignId']); |
| 12 | |
| 13 | if ( ! $campaign) { |
| 14 | return; |
| 15 | } |
| 16 | |
| 17 | $headingLevel = isset($attributes['headingLevel']) ? (int) $attributes['headingLevel'] : 1; |
| 18 | $headingTag = 'h' . min(6, max(1, $headingLevel)); |
| 19 | |
| 20 | $textAlignClass = isset($attributes['textAlign']) ? 'has-text-align-' . $attributes['textAlign'] : ''; |
| 21 | ?> |
| 22 | |
| 23 | <<?php |
| 24 | echo $headingTag; ?> <?php |
| 25 | echo wp_kses_data(get_block_wrapper_attributes(['class' => $textAlignClass])); ?>> |
| 26 | <?php echo esc_html($campaign->title); ?> |
| 27 | </<?php echo $headingTag; ?>> |
| 28 |