initial commit on forge variable

This commit is contained in:
sarahgarcin1 2026-02-21 17:52:13 +01:00
parent 388079e6bb
commit 581d60f883
63 changed files with 518 additions and 34500 deletions

View file

@ -2,14 +2,6 @@ name: field.blocks.image.name
icon: image
preview: image
fields:
location:
label: field.blocks.image.location
type: radio
columns: 2
default: "kirby"
options:
kirby: "{{ t('field.blocks.image.location.internal') }}"
web: "{{ t('field.blocks.image.location.external') }}"
image:
label: field.blocks.image.name
type: files
@ -19,13 +11,33 @@ fields:
back: black
uploads:
template: blocks/image
when:
location: kirby
src:
label: field.blocks.image.url
type: url
when:
location: web
imagered:
label: Image (couche rouge)
type: files
query: model.images
multiple: false
image:
back: black
uploads:
template: blocks/image
imagegreen:
label: Image (couche verte)
type: files
query: model.images
multiple: false
image:
back: black
uploads:
template: blocks/image
imageblue:
label: Image (couche bleu)
type: files
query: model.images
multiple: false
image:
back: black
uploads:
template: blocks/image
alt:
label: field.blocks.image.alt
type: text
@ -35,26 +47,3 @@ fields:
type: writer
icon: text
inline: true
link:
label: field.blocks.image.link
type: text
icon: url
width:
label: Largeur de l'image
type: select
width: 1/2
options:
16.666%: "16.666%"
20%: "20%"
25%: "25%"
33.333%: "33.333%"
50%: "50%"
66.666%: "66.666%"
100%: "100%"
position:
label: Position de l'image
type: select
width: 1/2
options:
auto: "Centrée"
0: "Alignée à gauche"

View file

@ -3,32 +3,39 @@
/** @var \Kirby\Cms\Block $block */
$alt = $block->alt();
$caption = $block->caption();
$crop = $block->crop()->toBool();
$link = $block->link();
$ratio = $block->ratio()->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();
}
$src = $block->image()->toFile()->url();
?>
<?php if ($src): ?>
<figure
data-crop="<?= $crop ? 'true' : 'false' ?>"
data-ratio="<?= $ratio ?>"
style="--ratio: <?= $ratio ?>;"
>
<?php if ($link->isNotEmpty()): ?>
<a href="<?= Str::esc($link->toUrl()) ?>">
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>">
</a>
<?php else: ?>
<figure class="web-image">
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>">
<?php if ($caption->isNotEmpty()): ?>
<figcaption>
<?= $caption->kt() ?>
</figcaption>
<?php endif ?>
</figure>
<figure class="print-image full-page" style="height:<?= $block->image()->toFile()->height()?>px">
<?php if($srcred = $block->imagered()->toFile()):?>
<div class="print-red red-layer">
<img src="<?= $srcred->url() ?>" alt="<?= $alt->esc() ?>">
</div>
<?php endif ?>
<?php if($srcgreen = $block->imagegreen()->toFile()):?>
<div class="print-green green-layer">
<img src="<?= $srcgreen->url() ?>" alt="<?= $alt->esc() ?>">
</div>
<?php endif ?>
<?php if($srcblue = $block->imageblue()->toFile()):?>
<div class="print-blue blue-layer">
<img src="<?= $srcblue->url() ?>" alt="<?= $alt->esc() ?>">
</div>
<?php endif ?>
<?php if ($caption->isNotEmpty()): ?>
<figcaption>

View file

@ -23,6 +23,7 @@
<?php foreach($site->index()->filterBy('intendedTemplate', 'chapitre') as $chapitre):?>
<section class="chapter">
<h2><?= $chapitre->title()->html()->smartypants() ?></h2>
<div class="chapeau"><?= $chapitre->chapeau()->kt()->smartypants() ?></div>
<?php foreach ($chapitre->text()->toBlocks() as $block): ?>
<div id="<?= $block->id() ?>" class="block block-type-<?= $block->type() ?>">
<?= $block ?>