<?php
/**
 * Single action link row in admin settings.
 *
 * @package MacaHold
 *
 * @var int                 $maca_hold_link_index
 * @var array<string, mixed> $maca_hold_link_row
 * @var bool                $maca_hold_link_removable
 */

defined( 'ABSPATH' ) || exit;

$maca_hold_link_removable = ! empty( $maca_hold_link_removable );
?>
<tr class="maca-hold-link-row">
	<td>
		<input
			type="text"
			class="regular-text"
			name="links[<?php echo esc_attr( (string) $maca_hold_link_index ); ?>][label]"
			value="<?php echo esc_attr( $maca_hold_link_row['label'] ); ?>"
			placeholder="<?php echo esc_attr__( 'Contact us', 'maca-hold' ); ?>"
		/>
	</td>
	<td>
		<input
			type="url"
			class="regular-text code"
			name="links[<?php echo esc_attr( (string) $maca_hold_link_index ); ?>][url]"
			value="<?php echo esc_url( $maca_hold_link_row['url'] ); ?>"
			placeholder="<?php echo esc_attr__( 'https://example.com/contact', 'maca-hold' ); ?>"
		/>
	</td>
	<td class="maca-hold-link-row-actions">
		<label>
			<span class="screen-reader-text"><?php echo esc_html__( 'Open in new tab', 'maca-hold' ); ?></span>
			<input
				type="checkbox"
				name="links[<?php echo esc_attr( (string) $maca_hold_link_index ); ?>][new_tab]"
				value="1"
				<?php checked( ! empty( $maca_hold_link_row['new_tab'] ) ); ?>
			/>
		</label>
		<button
			type="button"
			class="button-link maca-hold-remove-link"
			<?php echo $maca_hold_link_removable ? '' : 'hidden'; ?>
			aria-label="<?php echo esc_attr__( 'Remove link', 'maca-hold' ); ?>"
		>
			<span aria-hidden="true">&times;</span>
		</button>
	</td>
</tr>
