<?php
/**
 * View: Course Accordion Lesson - Title.
 *
 * @since 4.21.0
 * @version 4.21.3
 *
 * @var bool   $has_access Whether the user has access to the course or not.
 * @var Lesson $lesson Lesson model object.
 *
 * @package LearnDash\Core
 */

use LearnDash\Core\Models\Lesson;

?>
<div
	class="ld-accordion__item-title-wrapper ld-tooltip ld-tooltip--modern"
>
	<a
		<?php if ( ! $has_access && ! $lesson->is_sample() ) : ?>
			aria-describedby="ld-accordion__tooltip--lesson-<?php echo esc_attr( (string) $lesson->get_id() ); ?>"
		<?php endif; ?>
		class="ld-accordion__item-title ld-accordion__item-title--lesson"
		href="<?php echo esc_url( $lesson->get_permalink() ); ?>"
	>
		<?php echo wp_kses_post( $lesson->get_title() ); ?>
	</a>

	<?php if ( ! $has_access && ! $lesson->is_sample() ) : ?>
		<div
			class="ld-tooltip__text"
			id="ld-accordion__tooltip--lesson-<?php echo esc_attr( (string) $lesson->get_id() ); ?>"
			role="tooltip"
		>
			<?php esc_html_e( "You don't currently have access to this content", 'learndash' ); ?>
		</div>
	<?php endif; ?>
</div>
