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

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