<?php
/**
 *
 *
 * @var int         $form_id            Which form we are dealing with.
 * @var int         $field_id           Which field ID we are dealing with.
 * @var array       $entries            Which entries we are modifying.
 * @var array       $selected_fields    Which fields were selected.
 * @var string      $view               Which view are in.
 * @var mixed       $form               Form settings.
 * @var EmailAction $bulk_action_object Action we are handling here
 */

use \GravityKit\GravityActions\Actions\EmailAction;


$html_id = sanitize_html_class( "gk-gravityactions-email-field-{$field->id}" );
$field_class = null;
if ( ! empty( $field->class ) ) {
	$field_class = $field->class;
}
?>
<tr class="gk-gravityactions-email-field-row <?php echo esc_attr( $field_class ); ?>">
	<th scope="row">
		<label
			for="<?php echo $html_id; ?>"
		>
			<?php echo esc_html( $field->label ); ?>
			<?php
			if ( isset( $field->required ) && $field->required ) {
				echo '<span class="gk-required">*</span>';
			}
			?>
		</label>

		<!-- Tooltip -->
		<?php
		if ( ! empty( $field->tooltip ) ) {
			gform_tooltip( $field->tooltip );
		}
		?>
	</th>
	<td>
		<?php
		$template = $bulk_action_object->get_field_template( $field );
		$this->render( $template, [
			'field'   => $field,
			'input'   => null, // Here to reset internal input for every field.
			'html_id' => $html_id,
		] );
		?>
	</td>
</tr>