ActionBoxGenerator.php
1 year ago
AnnouncementsGenerator.php
1 year ago
CourseMetaGenerator.php
1 year ago
CourseThumbnailGenerator.php
1 year ago
ElementGenerator.php
1 year ago
GradebookGenerator.php
1 year ago
InstructorGenerator.php
1 year ago
LessonGenerator.php
1 year ago
Preview.php
1 year ago
QnAGenerator.php
1 year ago
RatingGenerator.php
1 year ago
ResourcesGenerator.php
1 year ago
ShareGenerator.php
1 year ago
TopicsGenerator.php
1 year ago
WishListGenerator.php
1 year ago
CourseThumbnailGenerator.php
46 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Preview script for html markup generator |
| 4 | * |
| 5 | * @package tutor-droip-elements |
| 6 | */ |
| 7 | |
| 8 | namespace TutorLMSDroip\ElementGenerator; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; // Exit if accessed directly. |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Class CourseThumbnailGenerator |
| 16 | * This class is used to define all helper functions. |
| 17 | */ |
| 18 | trait CourseThumbnailGenerator { |
| 19 | /** |
| 20 | * Generate course thumbnail elements |
| 21 | * |
| 22 | * @return string |
| 23 | */ |
| 24 | private function generate_course_thumbnail_elements() { |
| 25 | switch ( $this->element['name'] ) { |
| 26 | case TDE_APP_PREFIX . '-course-thumbnail-image': |
| 27 | $has_video = tutor_utils()->has_video_in_single(); |
| 28 | if ( $has_video ) { |
| 29 | return ''; |
| 30 | } |
| 31 | $tutor_course_img = get_tutor_course_thumbnail_src(); |
| 32 | return "<img src='$tutor_course_img' $this->attributes />"; |
| 33 | |
| 34 | case TDE_APP_PREFIX . '-course-thumbnail-video': |
| 35 | $has_video = tutor_utils()->has_video_in_single(); |
| 36 | if ( ! $has_video ) { |
| 37 | return ''; |
| 38 | } |
| 39 | |
| 40 | $child = tutor_course_video( false ); |
| 41 | return "<figure $this->attributes>$child</figure>"; |
| 42 | |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 |