<?php
/**
 * Echo the structural markup that wraps around comments. It also calls the comments action hooks.
 *
 * This template will return empty if the post which is called is password protected.
 *
 * @package SplendorStudio\Framework\Templates\Structure
 *
 * @since   1.0.0
 */
// Stop here if the post is password protected.
if (post_password_required()) {
	return;
}

fancify_lite_open_markup_e(
	'fancify_lite_comments',
	'div',
	array(
		'id'    => 'comments',
		'class' => 'fancify-comments' . (current_theme_supports('fancify-default-styling') ? ' fancify-panel-box' : null),
	)
);
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact -- Code structure mirrors HTML markup.
if (comments_open() || get_comments_number()):

	if (have_comments()):
		fancify_lite_open_markup_e('fancify_lite_comments_list', 'ul', array('class' => 'fancify-comment-list'));

		wp_list_comments(
			array(
				'avatar_size' => 85,
				'callback'    => 'Fancify_Lite_Templates::fancify_lite_comment_callback',
			)
		);

		fancify_lite_close_markup_e('fancify_lite_comments_list', 'ul');
	else:

		/**
		 * Fires if no comments exist.
		 *
		 * This hook only fires if comments are open.
		 *
		 * @since 1.0.0
		 */
		do_action('fancify_lite_no_comment');
	endif;

	/**
	 * Fires after the comments list.
	 *
	 * This hook only fires if comments are open.
	 *
	 * @since 1.0.0
	 */
	do_action('fancify_lite_after_open_comments');
endif;

if (!comments_open()):

	/**
	 * Fires if comments are closed.
	 *
	 * @since 1.0.0
	 */
	do_action('fancify_lite_comments_closed');
endif;

fancify_lite_close_markup_e('fancify_lite_comments', 'div');
//phpcs:enable Generic.WhiteSpace.ScopeIndent.IncorrectExact -- Code structure mirrors HTML markup.