blueprints
This commit is contained in:
parent
b35bee4fe3
commit
b8cb77c0e5
52 changed files with 752 additions and 6 deletions
40
public/site/snippets/blocks/image.php
Normal file
40
public/site/snippets/blocks/image.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/** @var \Kirby\Cms\Block $block */
|
||||
$alt = $block->alt();
|
||||
$caption = $block->caption();
|
||||
$link = $block->link();
|
||||
$width = $block->width()->or('100%');
|
||||
$position = $block->position()->or('auto');
|
||||
$src = null;
|
||||
|
||||
if ($block->location() == 'web') {
|
||||
$src = $block->src()->esc();
|
||||
} elseif ($image = $block->image()->toFile()) {
|
||||
$alt = $alt->or($image->alt());
|
||||
$src = $image->url();
|
||||
}
|
||||
|
||||
?>
|
||||
<?php if ($src): ?>
|
||||
<figure style="width:<?= $width ?>; min-width:225px; margin:<?= $position ?>; margin-bottom:1.5em;">
|
||||
<?php if ($link->isNotEmpty()): ?>
|
||||
<a href="<?= Str::esc($link->toUrl()) ?>">
|
||||
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>" loading="lazy">
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a href="<?= $src ?>" class="glightbox" <?php if($caption->isNotEmpty()):?>
|
||||
data-glightbox="title: <?= $caption ?>"
|
||||
<?php endif?>>
|
||||
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>" loading="lazy">
|
||||
</a>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($caption->isNotEmpty()): ?>
|
||||
<figcaption>
|
||||
<?= $caption ?>
|
||||
</figcaption>
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
<?php endif ?>
|
||||
|
||||
40
public/site/snippets/blocks/map.php
Normal file
40
public/site/snippets/blocks/map.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/** @var \Kirby\Cms\Block $block */
|
||||
$alt = $block->alt();
|
||||
$caption = $block->caption();
|
||||
$link = $block->link();
|
||||
$width = $block->width()->or('100%');
|
||||
$position = $block->position()->or('auto');
|
||||
$src = null;
|
||||
|
||||
if ($block->location() == 'web') {
|
||||
$src = $block->src()->esc();
|
||||
} elseif ($image = $block->image()->toFile()) {
|
||||
$alt = $alt->or($image->alt());
|
||||
$src = $image->url();
|
||||
}
|
||||
|
||||
?>
|
||||
<?php if ($src): ?>
|
||||
<figure style="width:<?= $width ?>; min-width:225px; margin:<?= $position ?>; margin-bottom:1.5em;">
|
||||
<?php if ($link->isNotEmpty()): ?>
|
||||
<a href="<?= Str::esc($link->toUrl()) ?>">
|
||||
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>" loading="lazy">
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a href="<?= $src ?>" class="glightbox" <?php if($caption->isNotEmpty()):?>
|
||||
data-glightbox="title: <?= $caption ?>"
|
||||
<?php endif?>>
|
||||
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>" loading="lazy">
|
||||
</a>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($caption->isNotEmpty()): ?>
|
||||
<figcaption>
|
||||
<?= $caption ?>
|
||||
</figcaption>
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
<?php endif ?>
|
||||
|
||||
3
public/site/snippets/blocks/text.php
Normal file
3
public/site/snippets/blocks/text.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php /** @var \Kirby\Cms\Block $block */ ?>
|
||||
|
||||
<?= $block->text()->kt()->smartypants();?>
|
||||
30
public/site/snippets/blocks/video.php
Normal file
30
public/site/snippets/blocks/video.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
use Kirby\Cms\Html;
|
||||
|
||||
/** @var \Kirby\Cms\Block $block */
|
||||
$caption = $block->caption();
|
||||
$url = null;
|
||||
$class = null;
|
||||
|
||||
if ($block->location() == 'web') {
|
||||
$url = $block->url()->esc();
|
||||
$class = "video-from-web";
|
||||
} elseif ($video = $block->video()->toFile()) {
|
||||
$url = $video->url();
|
||||
$class = "video-from-local";
|
||||
}
|
||||
|
||||
?>
|
||||
<?php if ($video = Html::video($url)): ?>
|
||||
<figure class="<?= $class ?>">
|
||||
<?php if ($block->location() == 'web'):?>
|
||||
<?= $video ?>
|
||||
<?php else:?>
|
||||
<video src="<?= $url ?>" controls></video>
|
||||
<?php endif;?>
|
||||
|
||||
<?php if ($caption->isNotEmpty()): ?>
|
||||
<figcaption><?= $caption ?></figcaption>
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
<?php endif ?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue