<?php
/**
 * CPT Builder - Taxonomy REST API tab.
 *
 * @package CptBuilder
 *
 * @var array<string, mixed> $definition
 */

namespace CptBuilder;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$cptb_key    = isset( $definition['key'] ) ? (string) $definition['key'] : '';
$cptb_key_ph = $cptb_key !== '' ? $cptb_key : __( 'e.g. genre', 'wp-powersuite' );
?>
<h2><?php esc_html_e( 'REST API', 'wp-powersuite' ); ?></h2>
<p class="description"><?php esc_html_e( 'REST API support is required for the block editor and for headless or JavaScript-driven front ends.', 'wp-powersuite' ); ?></p>

<table class="form-table" role="presentation">
	<tbody>
		<?php
		cptb_tax_arg_checkbox( $definition, 'show_in_rest', __( 'Show in REST API', 'wp-powersuite' ), __( 'Expose this taxonomy in the REST API and the block editor.', 'wp-powersuite' ) );
		cptb_tax_arg_text( $definition, 'rest_base', __( 'REST base', 'wp-powersuite' ), __( 'Custom base URL segment for REST routes. Defaults to the taxonomy key.', 'wp-powersuite' ), $cptb_key_ph, 'data-cptb-key-placeholder' );
		cptb_tax_arg_text( $definition, 'rest_namespace', __( 'REST namespace', 'wp-powersuite' ), __( 'Custom REST namespace. Defaults to wp/v2.', 'wp-powersuite' ), 'wp/v2' );
		?>
	</tbody>
</table>
