
<?php
/**
 * Template: Jobs Search Form Reset Button Block
 *
 * @link        https://matadorjobs.com/
 * @since       3.9.0
 *
 * @package     Matador Jobs
 * @subpackage  Blocks
 * @author      Matador Software LLC, Jeremy Scott, Paul Bearne
 * @copyright   (c) 2018-2025, Matador Software, LLC
 *
 * @license     https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
 */

use matador\MatadorJobs\Editors\Blocks\Blocks;

/**
 * @var array  $attributes - associative array of block attributes
 * @var WP_Block  $block - all the block settings and attributes
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

$css_var_mappings = [
	'matador-jobs/searchFieldInputsPadding' => [
		'top'    => '--matador-search-input-padding-top',
		'bottom' => '--matador-search-input-padding-bottom',
		'left'   => '--matador-search-input-padding-left',
		'right'  => '--matador-search-input-padding-right',
	],
	'matador-jobs/searchFieldInputsMargin' => [
		'top'    => '--matador-search-input-margin-top',
		'bottom' => '--matador-search-input-margin-bottom',
		'left'   => '--matador-search-input-margin-left',
		'right'  => '--matador-search-input-margin-right',
	],
];

$style = Blocks::generate_css_variables( $css_var_mappings, $block );

/**
 * Action: Matador Search Reset Button Class
 *
 * Filters the class attribute of the submit button for the Matador Search form.
 *
 * @since 3.3.0
 * @deprecated 3.6.0. Please use 'matador_template_button_classes' in combination with the ID
 *
 * @param string $class
 *
 * @return string $class
 */
$button_class = apply_filters( 'matador_search_form_reset_button_class', 'matador-search-reset' );
?>

<div <?php echo get_block_wrapper_attributes( [ 'class' => 'matador-search-form-field-group matador-search-form-field-reset', 'style' => $style ] ); ?>>

	<button type="submit" id="matador-search-reset" class="<?php matador_button_classes( [ $button_class, 'matador-button wp-element-button', 'matador-button-secondary' ], 'secondary' ); ?>">
		<?php
		/**
		 * Filter: Matador Search From Reset Label
		 *
		 * Modifies the text of the Submit button
		 *
		 * @since 3.3.0
		 */
		echo wp_kses_post( apply_filters( 'matador_search_form_reset_label', __( 'Clear', 'matador-jobs' ) ) );
		?>
	</button>

</div>
