<?php
/**
 * CPT Builder - Taxonomy Permalinks 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( 'Permalinks', 'wp-powersuite' ); ?></h2>
<p class="description"><?php esc_html_e( 'Control the term archive URLs. Rewrite rules are flushed automatically when you save changes.', 'wp-powersuite' ); ?></p>

<table class="form-table" role="presentation">
	<tbody>
		<?php
		cptb_tax_arg_checkbox( $definition, 'rewrite', __( 'Enable pretty permalinks', 'wp-powersuite' ), __( 'Generate clean term archive URLs.', 'wp-powersuite' ) );
		cptb_tax_arg_text( $definition, 'rewrite_slug', __( 'URL slug', 'wp-powersuite' ), __( 'Base slug for term URLs. Defaults to the taxonomy key.', 'wp-powersuite' ), $cptb_key_ph, 'data-cptb-key-placeholder' );
		cptb_tax_arg_checkbox( $definition, 'rewrite_with_front', __( 'Prepend permalink front', 'wp-powersuite' ), __( 'Prepend the site permalink base (e.g. /blog) to term URLs.', 'wp-powersuite' ) );
		cptb_tax_arg_checkbox( $definition, 'rewrite_hierarchical', __( 'Hierarchical URLs', 'wp-powersuite' ), __( 'Include parent terms in child term URLs.', 'wp-powersuite' ) );
		cptb_tax_arg_checkbox( $definition, 'query_var', __( 'Enable query var', 'wp-powersuite' ), __( 'Allow querying terms via a query variable.', 'wp-powersuite' ) );
		cptb_tax_arg_text( $definition, 'query_var_slug', __( 'Custom query var', 'wp-powersuite' ), __( 'Custom query variable name. Defaults to the taxonomy key.', 'wp-powersuite' ), $cptb_key_ph, 'data-cptb-key-placeholder' );
		?>
	</tbody>
</table>
