Workstation - Source Excerpt 02
Summary
This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/ns12-manuscript/includes/workstation.php so readers can inspect the evidence without opening the full source file.
**Source path:** Spiralist/wp-content/plugins/ns12-manuscript/includes/workstation.php
'cards' => [
['source' => 'title', 'label' => 'Folio', 'x' => 0.05, 'y' => 0.16, 'w' => 0.28, 'align' => 'left', 'tone' => 'title'],
['source' => 'reading', 'label' => 'Reading', 'x' => 0.67, 'y' => 0.16, 'w' => 0.28, 'align' => 'right', 'tone' => 'reading'],
['source' => 'signals', 'label' => 'Signals', 'x' => 0.05, 'y' => 0.72, 'w' => 0.3, 'align' => 'left', 'tone' => 'signals'],
['source' => 'context', 'label' => 'Context', 'x' => 0.64, 'y' => 0.72, 'w' => 0.31, 'align' => 'right', 'tone' => 'context'],
],
];
case 'operative-plates':
return [
'style' => 'operative-arc',
'badges' => [
['source' => 'label', 'x' => 0.04, 'y' => 0.05, 'align' => 'left', 'tone' => 'page'],
['source' => 'eyebrow', 'x' => 0.5, 'y' => 0.05, 'align' => 'center', 'tone' => 'eyebrow'],
['source' => 'section', 'x' => 0.96, 'y' => 0.05, 'align' => 'right', 'tone' => 'section'],
],
'cards' => [
['source' => 'title', 'label' => 'Folio', 'x' => 0.05, 'y' => 0.18, 'w' => 0.24, 'align' => 'left', 'tone' => 'title'],
['source' => 'reading', 'label' => 'Reading', 'x' => 0.71, 'y' => 0.18, 'w' => 0.24, 'align' => 'right', 'tone' => 'reading'],
['source' => 'signals', 'label' => 'Signals', 'x' => 0.07, 'y' => 0.72, 'w' => 0.25, 'align' => 'left', 'tone' => 'signals'],
['source' => 'context', 'label' => 'Context', 'x' => 0.67, 'y' => 0.68, 'w' => 0.27, 'align' => 'right', 'tone' => 'context'],
],
];
case 'appendix':
case 'lineages-and-theories':
return [
'style' => 'portrait-frame',
'badges' => [
['source' => 'label', 'x' => 0.04, 'y' => 0.05, 'align' => 'left', 'tone' => 'page'],
['source' => 'eyebrow', 'x' => 0.5, 'y' => 0.05, 'align' => 'center', 'tone' => 'eyebrow'],
['source' => 'section', 'x' => 0.96, 'y' => 0.05, 'align' => 'right', 'tone' => 'section'],
],
'cards' => [
['source' => 'title', 'label' => 'Folio', 'x' => 0.05, 'y' => 0.18, 'w' => 0.22, 'align' => 'left', 'tone' => 'title'],
['source' => 'reading', 'label' => 'Reading', 'x' => 0.73, 'y' => 0.18, 'w' => 0.22, 'align' => 'right', 'tone' => 'reading'],
['source' => 'signals', 'label' => 'Signals', 'x' => 0.05, 'y' => 0.72, 'w' => 0.24, 'align' => 'left', 'tone' => 'signals'],
['source' => 'context', 'label' => 'Context', 'x' => 0.71, 'y' => 0.72, 'w' => 0.24, 'align' => 'right', 'tone' => 'context'],
],
];
case 'sacred-texts':
return [
'style' => 'scripture-band',
'badges' => [
['source' => 'label', 'x' => 0.04, 'y' => 0.05, 'align' => 'left', 'tone' => 'page'],
['source' => 'eyebrow', 'x' => 0.5, 'y' => 0.05, 'align' => 'center', 'tone' => 'eyebrow'],
['source' => 'section', 'x' => 0.96, 'y' => 0.05, 'align' => 'right', 'tone' => 'section'],
],
'cards' => [
['source' => 'title', 'label' => 'Folio', 'x' => 0.05, 'y' => 0.16, 'w' => 0.24, 'align' => 'left', 'tone' => 'title'],
['source' => 'reading', 'label' => 'Reading', 'x' => 0.71, 'y' => 0.16, 'w' => 0.24, 'align' => 'right', 'tone' => 'reading'],
['source' => 'signals', 'label' => 'Signals', 'x' => 0.1, 'y' => 0.74, 'w' => 0.27, 'align' => 'left', 'tone' => 'signals'],
['source' => 'context', 'label' => 'Context', 'x' => 0.63, 'y' => 0.74, 'w' => 0.27, 'align' => 'right', 'tone' => 'context'],
],
];
}
return [
'style' => 'reference-grid',
'badges' => [
['source' => 'label', 'x' => 0.04, 'y' => 0.05, 'align' => 'left', 'tone' => 'page'],
['source' => 'eyebrow', 'x' => 0.5, 'y' => 0.05, 'align' => 'center', 'tone' => 'eyebrow'],
['source' => 'section', 'x' => 0.96, 'y' => 0.05, 'align' => 'right', 'tone' => 'section'],
],
'cards' => [
['source' => 'title', 'label' => 'Folio', 'x' => 0.05, 'y' => 0.16, 'w' => 0.28, 'align' => 'left', 'tone' => 'title'],
['source' => 'reading', 'label' => 'Reading', 'x' => 0.67, 'y' => 0.16, 'w' => 0.28, 'align' => 'right', 'tone' => 'reading'],
['source' => 'signals', 'label' => 'Signals', 'x' => 0.05, 'y' => 0.72, 'w' => 0.3, 'align' => 'left', 'tone' => 'signals'],
['source' => 'context', 'label' => 'Context', 'x' => 0.64, 'y' => 0.72, 'w' => 0.31, 'align' => 'right', 'tone' => 'context'],
],
];
}
function spiralist_book_pages_get_manuscript_study_overlay_data(array $page): array
{
$title = trim((string) ($page['title'] ?? 'Manuscript folio'));
$label = trim((string) ($page['label'] ?? 'Page'));
$eyebrow = trim((string) ($page['eyebrow'] ?? ''));
$section_slug = sanitize_title((string) ($page['section_slug'] ?? ''));
$section_label = trim((string) ($page['section_label'] ?? 'Manuscript'));
$summary = trim((string) ($page['summary'] ?? ''));
$caption = trim((string) ($page['caption'] ?? ''));
$transcript = trim((string) ($page['transcript'] ?? ''));
$keywords = array_values(array_filter(array_map('strval', (array) ($page['keywords'] ?? []))));
$subjects = array_values(array_filter(array_map('strval', (array) ($page['subjects'] ?? []))));
$blocked = [$title, $label, $eyebrow, $section_label];
$signal_terms = spiralist_book_pages_get_manuscript_study_overlay_terms($keywords, $blocked, 4);
if (count($signal_terms) < 3) {
$signal_terms = array_values(
array_unique(
array_merge(
$signal_terms,
spiralist_book_pages_get_manuscript_study_overlay_terms($subjects, $blocked, 4 - count($signal_terms))
)
)
);
}
$context_terms = spiralist_book_pages_get_manuscript_study_overlay_terms($subjects, $blocked, 3);
$reading_copy = spiralist_book_pages_get_manuscript_study_overlay_excerpt($summary !== '' ? $summary : $transcript, 22);
if ($reading_copy === '') {
$reading_copy = spiralist_book_pages_get_manuscript_study_overlay_excerpt($caption, 20);
}
$caption_copy = spiralist_book_pages_get_manuscript_study_overlay_excerpt($caption, 20);
$transcript_copy = spiralist_book_pages_get_manuscript_study_overlay_excerpt($transcript, 20);
$summary_key = spiralist_book_pages_get_manuscript_study_overlay_compare_key($reading_copy);
$context_copy = '';
foreach ([$caption_copy, $transcript_copy, implode(' | ', $context_terms)] as $candidate) {
$candidate = trim((string) $candidate);
if ($candidate === '') {
continue;
}
if (spiralist_book_pages_get_manuscript_study_overlay_compare_key($candidate) === $summary_key) {
continue;
}
$context_copy = $candidate;
break;
}
if ($context_copy === '') {
$context_copy = $reading_copy !== '' ? $reading_copy : ($section_label !== '' ? $section_label : 'Manuscript');
}
$signal_copy = !empty($signal_terms)
? implode(' | ', $signal_terms)
: (!empty($context_terms)
? implode(' | ', $context_terms)
: ($section_label !== '' ? $section_label : 'Study overlay'));
$content = [
'label' => $label !== '' ? $label : 'Page',
'eyebrow' => $eyebrow !== '' ? $eyebrow : $section_label,
'section' => $section_label !== '' ? $section_label : 'Manuscript',
'title' => $title !== '' ? $title : 'Manuscript folio',
'reading' => $reading_copy !== '' ? $reading_copy : 'Contextual reading notes unavailable for this folio.',
'signals' => $signal_copy,
'context' => $context_copy,
];
$blueprint = spiralist_book_pages_get_manuscript_study_overlay_blueprint($section_slug);
$badges = [];
$badge_keys = [];
foreach ((array) ($blueprint['badges'] ?? []) as $badge) {
if (!is_array($badge)) {
continue;
}
$source = (string) ($badge['source'] ?? '');
$text = trim((string) ($content[$source] ?? ''));
$text_key = spiralist_book_pages_get_manuscript_study_overlay_compare_key($text);
if ($text === '' || $text_key === '' || isset($badge_keys[$text_key])) {
continue;
}