- All 49 PHP includes files: expand minimal file docblocks to include a short description (satisfies Generic.Commenting.DocComment.MissingShort) Format: <?php\n/**\n * Filename-derived description.\n *\n * @package ...\n */ - settings.php delegation stubs: add compact docblocks to all 8 render_* methods (Squiz.Commenting.FunctionComment.Missing, lines 93-231) - settings.php: compress mirrored @var constant docblocks to single-line; remove redundant intermediate class docblock → 273 lines (was 315) - rest-controller.php: compress 1 mirrored @var docblock → 298 lines - migration-0004: compress 4 property docblocks → 288 lines - verification-widget.php line 111: cast days_since to int + phpcs:ignore - verification-metabox.php line 80: phpcs:ignore on hardcoded badge_class - peptide-metaboxes.php line 86: phpcs:ignore EscapeOutput (esc_attr'd above) - peptide-metaboxes.php lines 147/148: Yoda null !== dose_min/dose_max - peptide-metaboxes.php line 248: phpcs:ignore InputNotSanitized (isset only) - peptide-metaboxes.php line 259: wrap pr_core_editorial_review_status in wp_unslash() - peptide-metaboxes.php line 262: Yoda 'published' !== old_status Agent-Session: claude-adopt-ci-20260616
76 lines
2.1 KiB
PHP
76 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* Admin Columns.
|
|
*
|
|
* @package Peptide_Repo_Core
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Adds evidence strength, editorial status, and dosing count columns
|
|
*
|
|
* @package Peptide_Repo_Core
|
|
*/
|
|
|
|
/**
|
|
* 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 = array();
|
|
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'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
|
|
$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'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
|
|
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;
|
|
}
|
|
}
|
|
}
|