Files

35 lines
1.0 KiB
PHP

<?php
/**
* Project Meta Row Component
*
* Renders one row of the Repository Details table on the project detail
* page. Reads $label, $value, and optional $icon from get_query_var(),
* because get_template_part() does not forward its $args parameter into
* the partial's local scope.
*
* @package KsPortfolio
*/
namespace KsPortfolio;
$row_label = get_query_var( 'label' );
$row_value = get_query_var( 'value' );
$icon = get_query_var( 'icon' );
if ( ! isset( $row_label ) || ! isset( $row_value ) ) {
return;
}
$row_label = (string) $row_label;
$row_value = (string) $row_value;
?>
<div class="meta-row">
<span class="meta-row__label">
<?php if ( ! empty( $icon ) ) : ?>
<span class="meta-row__icon" aria-hidden="true"><?php echo $icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- icon is hardcoded decorative SVG in callers. ?></span>
<?php endif; ?>
<?php echo esc_html( $row_label ); ?>
</span>
<span class="meta-row__value"><?php echo esc_html( $row_value ); ?></span>
</div>