<?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', 'wppowersuite-lite' );
?>
<h2><?php esc_html_e( 'REST API', 'wppowersuite-lite' ); ?></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.', 'wppowersuite-lite' ); ?></p>

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