HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //home/globfdxw/www/wp-content/plugins/wpforms-surveys-polls/templates/entries/question.php
<?php
/**
 * Survey Results question card container.
 *
 * Pre-renders a question wrapper with title, badge, and a placeholder where
 * JS injects dynamic content (chart/table/stats) after AJAX fetch.
 *
 * @since 1.18.0
 *
 * @var int    $field_id     Field ID.
 * @var string $field_type   Field type slug.
 * @var int    $question_num Question sequence number.
 * @var string $label        Question label.
 * @var string $badge        Field type badge HTML.
 * @var bool   $has_chart    Whether a chart is supported for this field.
 * @var bool   $is_survey    Whether we are on the Survey results page.
 * @var bool   $show_toggle  Whether to show print preview toggle buttons.
 * @var bool   $is_hidden    Whether to render this question container hidden initially.
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$classes = [ 'question', 'wpforms-survey-question', 'wpforms-survey-graph-preview' ];

if ( ! empty( $is_hidden ) ) {
	$classes[] = 'wpforms-hidden';
}

$data = [
	'field-id'   => (string) $field_id,
	'field-type' => $field_type,
];

?>
<div <?php echo wpforms_html_attributes( '', $classes, $data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
	<div class="wpforms-survey-graph-header">
		<div class="wpforms-survey-graph-header-left">
			<div class="title-area">
				<span class="q-num q-num-<?php echo esc_attr( $field_type ); ?>"></span>
				<?php if ( ! empty( $badge ) ) : ?>
					<?php echo $badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
				<?php endif; ?>
				<h3 class="title">
					<?php echo esc_html( $label ); ?>
				</h3>
				<?php if ( ! empty( $show_toggle ) ) : ?>
					<a href="#" class="question-toggle"><i class="fa fa-chevron-down" aria-hidden="true"></i></a>
				<?php endif; ?>
			</div>
		</div>
		<div class="wpforms-survey-graph-header-right">
			<?php
			// Reuse the same controls template structure as the Entries list preview (export + settings).
			echo wpforms_render( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
				WPFORMS_SURVEYS_POLLS_PATH . 'templates/entries/controls',
				[
					'field_id'          => $field_id,
					// Allow passing filter settings so Filters button can be rendered on the first question regardless of type.
					'filter_settings'   => $filter_settings ?? [ 'enabled' => false ],
					// Show Settings only if this field supports charts.
					'show_settings'     => ! empty( $has_chart ),
					// Show Export Scope radios on the Survey Results page for all question types.
					'show_export_scope' => ! empty( $is_list ),
					'has_chart'         => ! empty( $has_chart ),
				],
				true
			);
			?>
		</div>
	</div>

	<div class="wpforms-survey-graph-content-wrapper">
		<div class="wpforms-survey-graph-content">
			<div class="wpforms-survey-question-content">
				<!-- Dynamic content (chart/table/stats) will be injected here by JS -->
			</div>
		</div>
	</div>
</div>