<?php
/**
 * Template part for displaying the job application link block
 *
 * @link        https://matadorjobs.com/
 *
 * @since       3.90
 *
 * @package     Matador Jobs
 * @subpackage  Blocks
 * @author      Matador Software LLC, Jeremy Scott, Paul Bearne
 * @copyright   (c) 2017-2025, Matador Software, LLC
 *
 * @license     https://opensource.org/licenses/GPL-3.0 GNU General Public License version 3
 */

$job_id = isset( $attributes['postId'] ) ? $attributes['postId'] : null;

$wrapper_attributes = get_block_wrapper_attributes();

$url = matador_get_the_job_apply_link( $job_id );

$display_text = isset( $attributes['displayText'] ) ? $attributes['displayText'] : 'Apply Now';

printf(
	'<div %1$s><a href="%2$s" >%3$s</a></div>',
	$wrapper_attributes,
	$url,
	wp_kses( $display_text, 'post' )
);
