cheat-sheet-2.php
74 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 | // Check if serial numbers and number-circle are enabled |
| 13 | $text_alignment = $settings['text_alignment'] ?? 'left'; |
| 14 | $id = $this->get_id(); // Unique widget ID, this is usually defined by Elementor |
| 15 | $cheat_sheet_title = ! empty( $settings['cheat_sheet_title'] ) ? $settings['cheat_sheet_title'] : 'Default Title'; // Example cheat sheet title |
| 16 | $column_grid2 = $settings['column_grid2'] ?? 2; |
| 17 | |
| 18 | ?> |
| 19 | |
| 20 | <div class="cheatsheet_info"> |
| 21 | <div class="accordion cheatsheet_accordion"> |
| 22 | <div id="cheat-<?php echo esc_attr( $id ) ?>" class="card"> |
| 23 | <?php |
| 24 | if ( 'yes' === $settings['enable_cheat_sheet_title'] ) { ?> |
| 25 | <div class="card-header" id="headingAtlas-<?php echo esc_attr( $id ) ?>"> |
| 26 | <?php |
| 27 | if ( $cheat_sheet_title ) { ?> |
| 28 | <h2 class="mb-0"> |
| 29 | <button class="btn btn-link <?php echo esc_attr( $is_collapsed_class ) ?>" type="button"> |
| 30 | <?php echo esc_html( $cheat_sheet_title ) ?> |
| 31 | <span class="pluse">[+]</span><span class="minus">[-]</span> |
| 32 | </button> |
| 33 | </h2> |
| 34 | <?php |
| 35 | } |
| 36 | ?> |
| 37 | </div> |
| 38 | <?php |
| 39 | } |
| 40 | ?> |
| 41 | <div id="collapseAtlas-<?php echo esc_attr( $id ) ?>" |
| 42 | class="collapse <?php echo esc_attr( $is_show ) ?>" |
| 43 | aria-labelledby="headingAtlas-<?php echo esc_attr( $id ) ?>"> |
| 44 | <div class="ezd-grid ezd-grid-cols-12 sheet_items_gap"> |
| 45 | <?php |
| 46 | if ( $settings['cheat_sheet_contents'] ) { |
| 47 | foreach ( $settings['cheat_sheet_contents'] as $index => $item ) { |
| 48 | ?> |
| 49 | <div class="ezd-lg-col-<?php echo esc_attr( $column_grid2 ); ?>"> |
| 50 | <div class="cheat-info-box elementor-repeater-item-<?php echo esc_attr( $item['_id'] ) ?>"> |
| 51 | <div class="outline"> |
| 52 | <div class="info-box-number"> |
| 53 | <?php echo '<span class="number-circle">' . esc_html( $index + 1 ) . '</span>'; ?> |
| 54 | </div> |
| 55 | </div> |
| 56 | <div class="cheat-info-content" style="text-align: <?php echo esc_attr( $text_alignment ); ?>;"> |
| 57 | <h4 class="info-box-heading"> |
| 58 | <?php echo esc_html( $item['cs_title'] ); ?> |
| 59 | </h4> |
| 60 | <p class="info-box-description"> |
| 61 | <?php echo esc_html( $item['cs_content'] ); ?> |
| 62 | </p> |
| 63 | </div> |
| 64 | </div> |
| 65 | </div> |
| 66 | <?php |
| 67 | } |
| 68 | } |
| 69 | ?> |
| 70 | </div> |
| 71 | </div> |
| 72 | </div> |
| 73 | </div> |
| 74 | </div> |