call-out-block.php
3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
$type = get_field('type');
if(!$type || $type == 'full_width_half') {
$id = 'full-width-block-' . $block['id'] . rand(0,100);
if( !empty($block['anchor']) ) {
$id = $block['anchor'];
}
// Create class attribute allowing for custom "className" and "align" values.
$className = 'full-width-block ' . $type;
$className .= ' ' .get_field('style');
if( !empty($block['className']) ) {
$className .= ' ' . $block['className'];
}
$image = get_field('image');
$buttons = get_field('buttons');
$content = get_field('content');
$style = get_field('style');
$colour_style = get_field('colour_style');
$show_previous_impact_reports = get_field('show_previous_impact_reports');
$show_previous_financial_reports = get_field('show_previous_financial_reports');
?>
<div class="stretch no-pad <?= $className ?> <?= $colour_style ?> <?= $style ?>" id='<?= $id ?>'>
<div class='image'><figure class='wp-block-image'><img src='<?= $image['sizes']['medium_large'] ?>' alt='<?= $image['alt'] ?>' /><?php if(!empty($image['caption'])) { ?> <figcaption><?= $image['caption'] ?></figcaption><?php } ?></figure></div>
<div class='content'>
<div class='inner-content'><?= $content ?></div>
<div class='button-list'>
<?php foreach($buttons as $btn) { ?>
<a class='btn' href='<?= $btn['link']['url'] ?>'><?= $btn['link']['title'] ?></a>
<?php } ?>
</div>
<?php if($show_previous_impact_reports) { ?>
<a class='previous-reports-anchor' href='#'><?= __("VIEW PREVIOUS REPORTS AND LATEST INTERNATIONAL REPORT", 'msf') ?></a>
<div class='previous_impact_reports'>
<?php msf_get_translated_sidebar('previous-impact-report') ?>
</div>
<?php } ?>
<?php if($show_previous_financial_reports && !$show_previous_impact_reports) { ?>
<a class='previous-reports-anchor' href='#'><?= __("VIEW PREVIOUS REPORTS & LATEST INTERNATIONAL FINANCIAL REPORT", 'msf') ?></a>
<div class='previous_impact_reports'>
<?php msf_get_translated_sidebar('previous-financial-report') ?>
</div>
<?php } ?>
</div>
</div>
<?php
} else {
// Create id attribute allowing for custom "anchor" value.
$id = 'call-out-block-' . $block['id'] . rand(0,100);
if( !empty($block['anchor']) ) {
$id = $block['anchor'];
}
// Create class attribute allowing for custom "className" and "align" values.
$className = 'call-out-block ' . $type;
$className .= ' ' .get_field('style');
if( !empty($block['className']) ) {
$className .= ' ' . $block['className'];
}
$count = get_field('count');
$button = get_field('button_url');
$bg_image = get_field('background_image');
$text_content = get_field('text_content');
$pure_html = get_field('pure_html');
?>
<div class="<?= $className ?> <?= (strlen($text_content) < 250)?'small-text':'' ?>" id='<?= $id ?>' style="<?= (!empty($bg_image))?"background-image: url(".$bg_image.")":"" ?>">
<div class='content'>
<?= $text_content ?>
<?php if($type == 'newsletter_signup') { ?>
<?= get_field('signup_form', 'options') ?>
<?php } else if($type == 'html') { ?>
<?= $pure_html ?>
<?php } ?>
<?php if(!empty($button)) { ?>
<a href="<?= $button['url'] ?>" > <?= $button['title'] ?> </a>
<?php } ?>
</div>
</div>
<?php } ?>