portfolio iyo-bisseck

This commit is contained in:
Julie Blanc 2026-04-12 16:46:06 +02:00
parent e76d9ef0eb
commit 38c510c658
13 changed files with 73 additions and 115 deletions

View file

@ -13,14 +13,11 @@ if ($block->location() == 'web') {
$src = $image->url();
}
$GLOBALS['figCount'] = ($GLOBALS['figCount'] ?? 0) + 1;
$figId = 'fig-' . Str::slug($block->parent()?->author() ?? '') . '-' . $GLOBALS['figCount'];
?>
<?php if ($src): ?>
<div class="full-bleed-image full-page">
<figure id="<?= $figId ?>" class="<?= $fullWidth ? 'full-width' : '' ?>">
<figure class="<?= $fullWidth ? 'full-width' : '' ?>">
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>">
<?php if ($caption->isNotEmpty()): ?>
<figcaption><?= $caption ?></figcaption>

View file

@ -4,10 +4,8 @@ $caption = $block->caption();
$crop = $block->crop()->isTrue();
$ratio = $block->ratio()->or('auto');
$GLOBALS['figCount'] = ($GLOBALS['figCount'] ?? 0) + 1;
$figId = 'fig-' . Str::slug($block->parent()?->author() ?? '') . '-' . $GLOBALS['figCount'];
?>
<figure id="<?= $figId ?>"<?= Html::attr(['data-ratio' => $ratio, 'data-crop' => $crop], null, ' ') ?>>
<figure<?= Html::attr(['data-ratio' => $ratio, 'data-crop' => $crop], null, ' ') ?>>
<ul>
<?php foreach ($block->images()->toFiles() as $image): ?>
<li class="<?= $image->taille()->esc()?> <?= $image->orientation()?>">

View file

@ -5,14 +5,10 @@ $alt = $block->alt();
$caption = $block->caption();
$src = $block->image()->toFile()->url();
$GLOBALS['figCount'] = ($GLOBALS['figCount'] ?? 0) + 1;
$figId = 'fig-' . Str::slug($block->parent()?->author() ?? '') . '-' . $GLOBALS['figCount'];
?>
<?php if ($src): ?>
<figure id="<?= $figId ?>">
<figure>
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>">

View file

@ -5,13 +5,10 @@ $alt = $block->alt();
$caption = $block->caption();
$src = $block->image()->toFile()->url();
$GLOBALS['figCount'] = ($GLOBALS['figCount'] ?? 0) + 1;
$figId = 'fig-' . Str::slug($block->parent()?->author() ?? '') . '-' . $GLOBALS['figCount'];
?>
<?php if ($src): ?>
<figure id="<?= $figId ?>" class="float-image">
<figure class="float-image">
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>">
<?php if ($caption->isNotEmpty()): ?>
<figcaption>

View file

@ -13,14 +13,11 @@ if ($block->location() == 'web') {
$src = $image->url();
}
$GLOBALS['figCount'] = ($GLOBALS['figCount'] ?? 0) + 1;
$figId = 'fig-' . Str::slug($block->parent()?->author() ?? '') . '-' . $GLOBALS['figCount'];
?>
<?php if ($src): ?>
<div class="spread-image">
<figure id="<?= $figId ?>" class="<?= $fullWidth ? 'full-width' : '' ?>">
<figure class="<?= $fullWidth ? 'full-width' : '' ?>">
<img src="<?= $src ?>" alt="<?= $alt->esc() ?>">
<?php if ($caption->isNotEmpty()): ?>
<figcaption><?= $caption ?></figcaption>

View file

@ -41,6 +41,7 @@
"assets/js/plugins/decor-blockquote.js",
"assets/js/plugins/decor-num-pages.js",
"assets/js/plugins/decor-subtitles.js",
"assets/js/plugins/portfolio.js",
"assets/js/plugins/toc.js",
"assets/js/handlers.js",
'@auto'

View file

@ -94,9 +94,18 @@
<div class="chapter-content">
<?php $GLOBALS['figCount'] = 0; ?>
<?php $figCount = 0; $figTypes = ['image', 'imagefloat', 'gallery', 'fullpageimage', 'spreadimage']; ?>
<?php foreach ($chapitre->text()->toBlocks() as $block): ?>
<div id="<?= $block->id() ?>" class="block block-type-<?= $block->type() ?><?= $block->classes()->isNotEmpty() ? ' ' . implode(' ', $block->classes()->split(',')) : '' ?>">
<?php
$isFig = in_array($block->type(), $figTypes);
if ($isFig) {
$figCount++;
$blockId = 'fig-' . Str::slug($chapitre->author()) . '-' . $figCount;
} else {
$blockId = $block->id();
}
?>
<div id="<?= $blockId ?>" class="block block-type-<?= $block->type() ?><?= $block->classes()->isNotEmpty() ? ' ' . implode(' ', $block->classes()->split(',')) : '' ?>">
<?= $block ?>
</div>
<?php endforeach ?>