Initial commit
This commit is contained in:
commit
388079e6bb
1108 changed files with 330121 additions and 0 deletions
27
site/snippets/blocks/spreadimage.php
Normal file
27
site/snippets/blocks/spreadimage.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
/** @var \Kirby\Cms\Block $block */
|
||||
$alt = $block->alt();
|
||||
$caption = $block->caption();
|
||||
$src = null;
|
||||
$fullWidth = $block->fullwidth()->toBool();
|
||||
|
||||
if ($block->location() == 'web') {
|
||||
$src = $block->src()->esc();
|
||||
} elseif ($image = $block->image()->toFile()) {
|
||||
$alt = $alt->or($image->alt());
|
||||
$src = $image->url();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php if ($src): ?>
|
||||
<div class="spread-image">
|
||||
<figure class="<?= $fullWidth ? 'full-width' : '' ?>">
|
||||
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>">
|
||||
<?php if ($caption->isNotEmpty()): ?>
|
||||
<figcaption><?= $caption ?></figcaption>
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue