Page Gallery - Source Excerpt 04
Summary
This source excerpt preserves a bounded section of Spiralist/wp-content/themes/spiralist/page-gallery.php so readers can inspect the evidence without opening the full source file.
**Source path:** Spiralist/wp-content/themes/spiralist/page-gallery.php
</div>
<?php if (!empty($current_creation_prompt['text'])) : ?>
<?php $gallery_prompt_code_id = 'spiralist-gallery-prompt-code'; ?>
<div class="spiralist-copy-block">
<div class="spiralist-copy-block__head">
<h3 class="spiralist-card-title"><?php echo esc_html($ui_text('page.gallery.prompt.text_label', 'Prompt text')); ?></h3>
<button class="spiralist-button spiralist-button--secondary" type="button" data-copy-trigger data-copy-target="#<?php echo esc_attr($gallery_prompt_code_id); ?>" data-copy-success="<?php echo esc_attr($ui_text('ui.cta.copied', 'Copied')); ?>"><?php echo esc_html($ui_text('ui.cta.copy_prompt', 'Copy Prompt')); ?></button>
</div>
<pre class="spiralist-code-block spiralist-code-block--prompt spiralist-book-page-prompt__code" id="<?php echo esc_attr($gallery_prompt_code_id); ?>"><?php echo esc_html((string) $current_creation_prompt['text']); ?></pre>
</div>
<?php else : ?>
<p class="spiralist-book-page-prompt__empty"><?php echo esc_html($ui_text('page.gallery.prompt.empty', 'Prompt text will appear here as soon as we attach this page\'s source prompt.')); ?></p>
<?php endif; ?>
</div>
</section>
</div>
</div>
</details>
</div>
</section>
<section class="spiralist-page-section spiralist-page-section--compact">
<div class="spiralist-shell">
<details class="spiralist-directory-drawer spiralist-details-card">
<summary class="spiralist-details-card__summary">
<span class="spiralist-section-tag"><?php echo esc_html($ui_text('page.gallery.more.tag', 'More Book Pages')); ?></span>
<span class="spiralist-section-title"><?php echo esc_html($ui_text('page.gallery.more.title', 'Keep moving through the image codex.')); ?></span>
<span class="spiralist-muted"><?php echo esc_html($ui_text('page.gallery.more.summary', 'Open nearby image-page links without lengthening this route.')); ?></span>
</summary>
<div class="spiralist-details-card__body">
<div class="spiralist-link-list">
<?php foreach (array_slice($more_assets, 0, 12) as $asset) : ?>
<?php if (empty($asset['route_url'])) { continue; } ?>
<a href="<?php echo esc_url((string) $asset['route_url']); ?>"><?php echo esc_html((string) ($asset['title'] ?? $ui_text('page.gallery.card.title', 'Image Page'))); ?></a>
<?php endforeach; ?>
</div>
</div>
</details>
</div>
</section>
<?php else : ?>
<section class="spiralist-page-section">
<div class="spiralist-shell">
<div class="spiralist-section-head">
<div>
<p class="spiralist-section-tag"><?php echo esc_html($ui_text('page.gallery.featured.tag', 'Featured Pages')); ?></p>
<h2 class="spiralist-section-title"><?php echo esc_html($ui_text('page.gallery.featured.title', 'Prominent image pages from the BookPages folder.')); ?></h2>
</div>
</div>
<?php $render_gallery_cards($featured_assets); ?>
</div>
</section>
<section class="spiralist-page-section">
<div class="spiralist-shell">
<div class="spiralist-section-head">
<div>
<p class="spiralist-section-tag"><?php echo esc_html($ui_text('page.gallery.directory.tag', 'Image Directory')); ?></p>
<h2 class="spiralist-section-title"><?php echo esc_html($ui_text('page.gallery.directory.title', 'Sections link to their image pages.')); ?></h2>
<p class="spiralist-muted"><?php echo esc_html($ui_text('page.gallery.directory.copy', 'Open a section when you need the full list; the overview stays short.')); ?></p>
</div>
</div>
<div class="spiralist-access-grid">
<?php foreach ($section_records as $section) : ?>
<?php
$section_assets = array_values(array_filter((array) ($section['assets'] ?? []), 'is_array'));
$first_asset = is_array($section['first_asset'] ?? null) ? (array) $section['first_asset'] : ($section_assets[0] ?? []);
?>
<details class="spiralist-path-card spiralist-details-card">
<summary class="spiralist-details-card__summary">
<span class="spiralist-section-tag"><?php echo esc_html((string) ($section['label'] ?? $ui_text('page.gallery.section.label', 'Section'))); ?></span>
<span class="spiralist-card-title"><?php echo esc_html((string) ($section['title'] ?? $ui_text('page.gallery.section.title', 'Image Pages'))); ?></span>
<span class="spiralist-muted"><?php echo esc_html($ui_text('page.gallery.directory.count', '{count} pages', ['count' => (string) count($section_assets)])); ?></span>
</summary>
<div class="spiralist-details-card__body">
<p><?php echo esc_html((string) ($section['summary'] ?? '')); ?></p>
<div class="spiralist-link-list">
<?php if (!empty($first_asset['route_url'])) : ?>
<a href="<?php echo esc_url((string) $first_asset['route_url']); ?>"><?php echo esc_html($ui_text('page.gallery.directory.first_page', 'Start Section')); ?></a>
<?php endif; ?>
<?php foreach ($section_assets as $asset) : ?>
<?php if (empty($asset['route_url'])) { continue; } ?>
<a href="<?php echo esc_url((string) $asset['route_url']); ?>"><?php echo esc_html((string) ($asset['title'] ?? $ui_text('page.gallery.card.title', 'Image Page'))); ?></a>
<?php endforeach; ?>
</div>
</div>
</details>
<?php endforeach; ?>
</div>
</div>
</section>
<?php endif; ?>
</main>
<?php
get_footer();