<?php
/**
 * @var $select_name
 * @var $select_class
 * @var $select_id
 * @var $params
 * @var $select_multiple
 * @var $extra_params
 * @var $terms
 * @var $term_type
 */
?>

<select name="<?php echo $select_name; ?>" class="ui selection fluid search dropdown full-text-search clearable <?php echo $select_class; ?>" id="<?php echo $select_id; ?>" <?php echo $extra_params . ' ' . $select_multiple; ?>>

	<?php if ( ! empty( $include_empty_option ) ) { ?>

		<option value=""><?php echo $include_empty_option; ?></option>

	<?php }

	if ( empty( $select_value ) ) { $select_value = -1; }

	if ( $terms ) {

		foreach ( $terms as $term ) {

			$option_value = $term_type == 'slug' ? $term->slug : $term->term_id;

			if ( is_array( $select_value ) ) {
				$selected = in_array( $option_value, $select_value ) ? "selected='selected'" : "";

			} else {
				$selected = $select_value == $option_value ? "selected='selected'" : " ";

			} ?>

			<option <?php echo $selected; ?> value="<?php echo $option_value; ?>"><?php echo $term->name; ?></option>

		<?php }

	} ?>

</select>