Consolidates the `peptide` CPT under PR Core ownership, dropping the `pr_peptide` slug-collision that was 404ing all 89 peptide detail pages. - POST_TYPE: pr_peptide -> peptide - TAX_CATEGORY: pr_peptide_category -> peptide_category - TAX_FAMILY + pr_peptide_family taxonomy removed - Defensive post_type_exists/taxonomy_exists guards on both registrations - Args harmonized as superset of PSA + prior PR Core (adds thumbnail support) - Activation hook + init:999 version-change flush handler - Uninstall scoped to _pr_core_authored flag (PSA-authored posts survive) - Plugin version 0.1.1 -> 0.2.0, CHANGELOG in same commit - ARCHITECTURE.md + CONVENTIONS.md updated with CPT ownership rule QA gate verdict: PASS (qa-reviews/peptide-repo-core/2026-04-22-874f93b.md) Sibling release: peptiderepo/peptide-search-ai#15 (PSA v4.5.0) Known follow-up: manage_peptide_content capability is not granted to any role as of v0.2.0. No current UI/theme reads or writes PR Core-defined meta keys, so no regression. Follow-up thread to decide role assignment.
64 lines
1.8 KiB
PHP
64 lines
1.8 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Custom admin list-table columns for the peptide CPT.
|
|
*
|
|
* What: Adds evidence strength, editorial status, and dosing count columns.
|
|
* Who calls it: PR_Core_Admin via manage_posts_columns and custom_column hooks.
|
|
* Dependencies: PR_Core_Dosing_Repository for row counts.
|
|
*
|
|
* @see admin/class-pr-core-admin.php — Registers column hooks.
|
|
*/
|
|
class PR_Core_Admin_Columns {
|
|
|
|
/**
|
|
* Add custom columns to the peptide list table.
|
|
*
|
|
* @param array<string, string> $columns Existing columns.
|
|
* @return array<string, string> Modified columns.
|
|
*/
|
|
public function add_columns( array $columns ): array {
|
|
$new = [];
|
|
foreach ( $columns as $key => $label ) {
|
|
$new[ $key ] = $label;
|
|
|
|
// Insert custom columns after the title column.
|
|
if ( 'title' === $key ) {
|
|
$new['pr_evidence'] = __( 'Evidence', 'peptide-repo-core' );
|
|
$new['pr_editorial'] = __( 'Editorial', 'peptide-repo-core' );
|
|
$new['pr_dosing'] = __( 'Dosing Rows', 'peptide-repo-core' );
|
|
}
|
|
}
|
|
|
|
return $new;
|
|
}
|
|
|
|
/**
|
|
* Render custom column content for a peptide row.
|
|
*
|
|
* @param string $column Column key.
|
|
* @param int $post_id Post ID.
|
|
* @return void
|
|
*/
|
|
public function render_column( string $column, int $post_id ): void {
|
|
switch ( $column ) {
|
|
case 'pr_evidence':
|
|
$strength = get_post_meta( $post_id, 'evidence_strength', true ) ?: 'preclinical';
|
|
$label = apply_filters( 'pr_core_evidence_strength_label', $strength, $strength );
|
|
echo esc_html( $label );
|
|
break;
|
|
|
|
case 'pr_editorial':
|
|
$status = get_post_meta( $post_id, 'editorial_review_status', true ) ?: 'draft';
|
|
echo esc_html( ucfirst( str_replace( '-', ' ', $status ) ) );
|
|
break;
|
|
|
|
case 'pr_dosing':
|
|
$count = ( new PR_Core_Dosing_Repository() )->count_by_peptide( $post_id );
|
|
echo esc_html( (string) $count );
|
|
break;
|
|
}
|
|
}
|
|
}
|