Template_Tag_Text_Field::render_single_input( mixed $current_value )

Renders a single input for the field.

Description

Parameters

$current_value

(mixed) (Required) Current field value.

Source

File: src/components/template-tag-text-field.php

	protected function render_single_input( $current_value ) {
		$id = $this->get_id_attribute();

		$input_attrs = array(
			'type'  => $this->type,
			'value' => $current_value,
		);
		?>
		<input<?php echo $this->get_input_attrs( $input_attrs ); ?>>
		<div class="template-tag-list-wrap">
			<button type="button" class="template-tag-list-toggle button" aria-controls="<?php echo esc_attr( $id . '-template-tag-list' ); ?>" aria-expanded="false">
				<span aria-hidden="true">+</span>
				<span class="screen-reader-text"><?php _e( 'Insert template tag', 'torro-forms' ); ?></span>
			</button>
			<ul id="<?php echo esc_attr( $id . '-template-tag-list' ); ?>" class="template-tag-list" role="region" tabindex="-1">
				<?php foreach ( $this->template_tag_handler->get_groups() as $group_slug => $group_label ) : ?>
					<li class="template-tag-list-group <?php echo esc_attr( 'template-tag-list-group-' . $group_slug ); ?>">
						<span><?php echo esc_html( $group_label ); ?></span>
						<ul>
							<?php foreach ( $this->template_tag_handler->get_tag_labels( $group_slug ) as $tag_slug => $tag_label ) : ?>
								<li class="template-tag <?php echo esc_attr( 'template-tag-' . $tag_slug ); ?>">
									<button type="button" class="template-tag-button" data-tag="<?php echo esc_attr( $tag_slug ); ?>">
										<?php echo esc_html( $tag_label ); ?>
									</button>
								</li>
							<?php endforeach; ?>
						</ul>
					</li>
				<?php endforeach; ?>
			</ul>
		</div>
		<?php
		$this->render_repeatable_remove_button();
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.