Skip to content
wiki.fftac.org

Virtual Pages - Source Excerpt 79

Back to Virtual Pages

Summary

This source excerpt preserves a bounded section of 2IA.org/wp-content/themes/twoia-intelligence/inc/virtual-pages.php so readers can inspect the evidence without opening the full source file.

**Source path:** 2IA.org/wp-content/themes/twoia-intelligence/inc/virtual-pages.php

/**
 * Render a compact in-page map for long detail pages.
 */
function twoia_render_virtual_dossier_page_map() {
	$items = array(
		'twoia-records-worth-pulling' => __( 'Records Worth Pulling', 'two-identities-anonymous' ),
		'twoia-verify-further'        => __( 'Verify And Read Further', 'two-identities-anonymous' ),
		'twoia-how-to-read-record'    => __( 'How To Read The Record', 'two-identities-anonymous' ),
		'twoia-the-failure'           => __( 'The Failure', 'two-identities-anonymous' ),
		'twoia-what-to-demand'        => __( 'What To Demand', 'two-identities-anonymous' ),
		'twoia-record-trail'          => __( 'The Record Trail', 'two-identities-anonymous' ),
		'twoia-prove-us-wrong'        => __( 'What Would Prove Us Wrong', 'two-identities-anonymous' ),
		'twoia-source-notes'          => __( 'Receipts And Limits', 'two-identities-anonymous' ),
	);
	?>
	<section class="twoia-brief-section twoia-brief-section--map" aria-labelledby="twoia-page-map-title">
		<h2 id="twoia-page-map-title"><?php esc_html_e( 'Keep Reading', 'two-identities-anonymous' ); ?></h2>
		<div class="twoia-page-map" aria-label="<?php esc_attr_e( 'Dossier section links', 'two-identities-anonymous' ); ?>">
			<?php foreach ( $items as $target => $label ) : ?>
				<a href="#<?php echo esc_attr( $target ); ?>"><?php echo esc_html( $label ); ?></a>
			<?php endforeach; ?>
		</div>
	</section>
	<?php
}

/**
 * Render route-specific record reading notes.
 *
 * @param array $notes Record reading note cards.
 */
function twoia_render_virtual_dossier_record_reading_notes( $notes ) {
	if ( empty( $notes ) || ! is_array( $notes ) ) {
		return;
	}
	?>
	<section id="twoia-how-to-read-record" class="twoia-brief-section twoia-brief-section--record-reading">
		<h2><?php esc_html_e( 'How To Read The Record', 'two-identities-anonymous' ); ?></h2>
		<div class="twoia-record-reading-notes">
			<?php foreach ( $notes as $note ) : ?>
				<article class="twoia-record-reading-note">
					<strong><?php echo esc_html( $note['label'] ?? '' ); ?></strong>
					<p><?php echo esc_html( $note['text'] ?? '' ); ?></p>
				</article>
			<?php endforeach; ?>
		</div>
	</section>
	<?php
}

/**
 * Render compact reference notes for returning readers.
 *
 * @param array $notes Reference note cards.
 */
function twoia_render_virtual_dossier_reference_notes( $notes ) {
	if ( empty( $notes ) || ! is_array( $notes ) ) {
		return;
	}
	?>
	<section id="twoia-reference-notes" class="twoia-brief-section twoia-brief-section--reference-notes">
		<h2><?php esc_html_e( 'Reference Notes', 'two-identities-anonymous' ); ?></h2>
		<div class="twoia-reference-notes">
			<?php foreach ( $notes as $note ) : ?>
				<div class="twoia-reference-note">
					<strong><?php echo esc_html( $note['label'] ?? '' ); ?></strong>
					<span><?php echo esc_html( $note['text'] ?? '' ); ?></span>
				</div>
			<?php endforeach; ?>
		</div>
	</section>
	<?php
}

/**
 * Render concrete records worth pulling near the top of a detail page.
 *
 * @param array $targets Record target cards.
 */
function twoia_render_virtual_dossier_record_targets( $targets ) {
	if ( empty( $targets ) || ! is_array( $targets ) ) {
		return;
	}
	?>
	<section id="twoia-records-worth-pulling" class="twoia-brief-section twoia-brief-section--record-targets">
		<h2><?php esc_html_e( 'Records Worth Pulling', 'two-identities-anonymous' ); ?></h2>
		<div class="twoia-record-targets">
			<?php foreach ( $targets as $target ) : ?>
				<article class="twoia-record-target">
					<strong><?php echo esc_html( $target['label'] ?? '' ); ?></strong>
					<p><?php echo esc_html( $target['text'] ?? '' ); ?></p>
				</article>
			<?php endforeach; ?>
		</div>
	</section>
	<?php
}

/**
 * Render the story-first content body for child detail routes.
 *
 * @param array $page    Section-backed child route definition.
 * @param array $section Section definition.
 * @param array $dossier Dossier payload.
 */
function twoia_render_virtual_dossier_story_content( $page, $section, $dossier ) {
	$parent        = $page['parent_page'];
	$title         = isset( $section['title'] ) ? $section['title'] : $page['title'];
	$parent_title  = isset( $parent['title'] ) ? $parent['title'] : '';
	$parent_intro  = isset( $parent['summary'] ) ? $parent['summary'] : '';
	$parent_slug   = isset( $page['parent_slug'] ) ? $page['parent_slug'] : '';
	$section_body  = isset( $section['body'] ) ? $section['body'] : '';
	$dossier_intro = isset( $dossier['summary'] ) ? $dossier['summary'] : $section_body;
	$context       = twoia_virtual_text_items( $dossier['full_context'] ?? array() );
	$evidence      = twoia_virtual_text_items( $dossier['evidence'] ?? array() );
	$use_items     = twoia_get_virtual_dossier_front_actions( $page, $section );
	$questions     = twoia_virtual_text_items( $dossier['review_questions'] ?? array() );
	$fast_brief = twoia_get_virtual_dossier_fast_brief( $page, $section, $dossier );
	$core_issue = twoia_get_virtual_dossier_core_issue( $page, $section );
	$reference_notes = twoia_get_virtual_dossier_reference_notes( $page, $section, $dossier );
	$record_targets = twoia_get_virtual_dossier_record_targets( $page, $section, $dossier );
	$reading_notes = twoia_get_virtual_dossier_record_reading_notes( $page, $section, $dossier );
	$public_questions = twoia_get_virtual_dossier_public_questions( $page, $section, $dossier );
	$failure_brief = twoia_get_virtual_dossier_failure_brief( $page, $section, $dossier, ! empty( $evidence ) ? $evidence[0] : __( 'Public records, policies, source notes, correction logs, and reviewable claims.', 'two-identities-anonymous' ) );
	?>
	<section class="twoia-brief-section twoia-brief-section--story">
		<h2><?php esc_html_e( 'The story', 'two-identities-anonymous' ); ?></h2>
		<p class="twoia-story-lede"><?php echo esc_html( $failure_brief['broken'] ); ?></p>
		<?php if ( $dossier_intro && $dossier_intro !== $section_body ) : ?>
			<p><?php echo esc_html( $dossier_intro ); ?></p>
		<?php endif; ?>
		<?php if ( $section_body ) : ?>
			<p><?php echo esc_html( $section_body ); ?></p>
		<?php else : ?>
			<p><?php echo esc_html( $core_issue ); ?></p>
		<?php endif; ?>
		<p><?php echo esc_html( $failure_brief['action'] ); ?></p>
	</section>

	<section class="twoia-brief-section twoia-brief-section--fast">
		<h2><?php esc_html_e( 'Fast Brief', 'two-identities-anonymous' ); ?></h2>
		<div class="twoia-fast-brief" aria-label="<?php esc_attr_e( 'Fast brief', 'two-identities-anonymous' ); ?>">
			<?php foreach ( $fast_brief as $item ) : ?>
				<div class="twoia-fast-brief__item">
					<strong><?php echo esc_html( $item['label'] ); ?></strong>
					<span><?php echo esc_html( $item['text'] ); ?></span>
				</div>
			<?php endforeach; ?>
		</div>
	</section>

	<section class="twoia-brief-section twoia-brief-section--action">
		<h2><?php esc_html_e( 'What To Check Next', 'two-identities-anonymous' ); ?></h2>
		<p><?php esc_html_e( 'Do not ask what the institution meant. Ask what the institution can prove.', 'two-identities-anonymous' ); ?></p>
		<ul>
			<?php foreach ( array_slice( $use_items, 0, 3 ) as $item ) : ?>
				<li><?php echo esc_html( $item ); ?></li>
			<?php endforeach; ?>
		</ul>
	</section>

	<?php twoia_render_virtual_dossier_record_targets( $record_targets ); ?>

	<?php twoia_render_virtual_dossier_external_resources( twoia_get_virtual_dossier_external_resources( $page, $section ) ); ?>

	<?php twoia_render_virtual_dossier_record_reading_notes( $reading_notes ); ?>

	<?php twoia_render_virtual_dossier_page_map(); ?>

	<section id="twoia-the-failure" class="twoia-brief-section">
		<h2><?php esc_html_e( 'The Failure', 'two-identities-anonymous' ); ?></h2>
		<p><?php echo esc_html( $failure_brief['broken'] ); ?></p>
		<p><strong><?php esc_html_e( 'Who benefits:', 'two-identities-anonymous' ); ?></strong> <?php echo esc_html( $failure_brief['profits'] ); ?></p>
		<p><strong><?php esc_html_e( 'Who gets hurt:', 'two-identities-anonymous' ); ?></strong> <?php echo esc_html( $failure_brief['hurt'] ); ?></p>
		<?php foreach ( array_slice( $context, 0, 2 ) as $item ) : ?>
			<?php if ( $item === $section_body || $item === $parent_intro ) : ?>
				<?php continue; ?>
			<?php endif; ?>
			<p><?php echo esc_html( $item ); ?></p>
		<?php endforeach; ?>
	</section>

	<section id="twoia-what-to-demand" class="twoia-brief-section">
		<h2><?php esc_html_e( 'What To Demand', 'two-identities-anonymous' ); ?></h2>
		<p><?php esc_html_e( 'Do not settle for reassurance. Ask for the document that turns authority into something the public can inspect.', 'two-identities-anonymous' ); ?></p>
		<ul>
			<?php foreach ( array_slice( array_merge( $public_questions, $use_items ), 0, 5 ) as $item ) : ?>
				<li><?php echo esc_html( $item ); ?></li>
			<?php endforeach; ?>
		</ul>
	</section>