cheat-sheet-3.php
81 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; // Exit if accessed directly. |
| 4 | } |
| 5 | // Get settings for display |
| 6 | $settings = $this->get_settings_for_display(); |
| 7 | |
| 8 | // Ensure default 'collapse_state' is set to 'yes' for expanded (show) by default |
| 9 | $is_collapsed_class = $settings['collapse_state'] === 'yes' ? 'collapsed' : 'active'; |
| 10 | $is_show = $settings['collapse_state'] === 'yes' ? 'show' : ''; // Show by default |
| 11 | |
| 12 | $id = $this->get_id(); // Unique widget ID, this is usually defined by Elementor |
| 13 | $cheat_sheet_title = ! empty( $settings['cheat_sheet_title'] ) ? $settings['cheat_sheet_title'] : 'Default Title'; // Example cheat sheet title |
| 14 | $column_grid3 = $settings['column_grid3'] ?? 4; |
| 15 | |
| 16 | ?> |
| 17 | |
| 18 | <div class="cheatsheet_info"> |
| 19 | <div class="accordion cheatsheet_accordion"> |
| 20 | <div id="cheat-<?php echo esc_attr( $id ) ?>" class="card"> |
| 21 | <?php |
| 22 | if ( 'yes' === $settings['enable_cheat_sheet_title'] ) { ?> |
| 23 | <div class="card-header" id="headingAtlas-<?php echo esc_attr( $id ) ?>"> |
| 24 | <?php |
| 25 | if ( $cheat_sheet_title ) { ?> |
| 26 | <h2 class="mb-0"> |
| 27 | <button class="btn btn-link <?php echo esc_attr( $is_collapsed_class ) ?>" type="button"> |
| 28 | <?php echo esc_html( $cheat_sheet_title ) ?> |
| 29 | <span class="pluse">[+]</span><span class="minus">[-]</span> |
| 30 | </button> |
| 31 | </h2> |
| 32 | <?php |
| 33 | } |
| 34 | ?> |
| 35 | </div> |
| 36 | <?php |
| 37 | } |
| 38 | ?> |
| 39 | <div id="collapseAtlas-<?php echo esc_attr( $id ) ?>" |
| 40 | class="collapse <?php echo esc_attr( $is_show ) ?>" |
| 41 | aria-labelledby="headingAtlas-<?php echo esc_attr( $id ) ?>"> |
| 42 | <div class="ezd-grid ezd-grid-cols-12 cs-items3-gap"> |
| 43 | <?php |
| 44 | if ( $settings['cheat_sheet_contents'] ) { |
| 45 | foreach ( $settings['cheat_sheet_contents'] as $index => $item ) { |
| 46 | ?> |
| 47 | <div class="ezd-lg-col-<?php echo esc_attr( $column_grid3 ); ?>"> |
| 48 | <div class="cs-items3 elementor-repeater-item-<?php echo esc_attr( $item['_id'] ) ?>"> |
| 49 | <div class="cs-outline3"> |
| 50 | <?php echo '<span class="serial-number">' . esc_html( '#' . ( $index + 1 ) ) . '</span>'; ?> |
| 51 | <h4 class="cs3-title"> |
| 52 | <?php echo esc_html( $item['cs_title'] ); ?> |
| 53 | </h4> |
| 54 | </div> |
| 55 | |
| 56 | <?php |
| 57 | if ( ! empty( $item['cs_content'] ) ) { ?> |
| 58 | <p class="cs-info-desc"> |
| 59 | <?php echo esc_html( $item['cs_content'] ); ?> |
| 60 | </p> |
| 61 | <?php |
| 62 | } |
| 63 | ?> |
| 64 | |
| 65 | <?php |
| 66 | if ( ! empty( $item['image'] ['url'] ) ) { ?> |
| 67 | <img class="cs-img" src="<?php echo esc_url( $item['image']['url'] ); ?>"> |
| 68 | <?php |
| 69 | } |
| 70 | ?> |
| 71 | </div> |
| 72 | </div> |
| 73 | <?php |
| 74 | } |
| 75 | } |
| 76 | ?> |
| 77 | </div> |
| 78 | </div> |
| 79 | </div> |
| 80 | </div> |
| 81 | </div> |