| 1 |
<?php |
| 2 |
/** |
| 3 |
* Single-trip — Custom tab partial. |
| 4 |
* |
| 5 |
* Renders a user-defined "custom" frontend tab. Mirrors the structure of the |
| 6 |
* other content-* partials so the admin-chosen icon and label resolve through |
| 7 |
* the same `yatra_render_tab_icon()` pipeline (icons.json + IconPicker support). |
| 8 |
* |
| 9 |
* Expected vars: |
| 10 |
* @var object $trip Trip model. |
| 11 |
* @var object $tab Frontend-tab entry (id, label, icon, custom_content). |
| 12 |
*/ |
| 13 |
|
| 14 |
if (!defined('ABSPATH')) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
$tab_id = isset($tab->id) ? (string) $tab->id : 'custom'; |
| 19 |
$tab_label = isset($tab->label) ? (string) $tab->label : __('Section', 'yatra'); |
| 20 |
$tab_icon = $tab->icon ?? null; |
| 21 |
$custom_content = isset($tab->custom_content) ? (string) $tab->custom_content : ''; |
| 22 |
?> |
| 23 |
|
| 24 |
<section class="yatra-trip-section yatra-trip-section-custom" id="<?php echo esc_attr($tab_id); ?>"> |
| 25 |
<h2 class="yatra-trip-section-title"> |
| 26 |
<?php yatra_render_tab_icon($tab_icon, 'book', 'yatra-trip-section-title-icon', $tab_label); ?> |
| 27 |
<?php echo esc_html($tab_label); ?> |
| 28 |
</h2> |
| 29 |
<div class="yatra-custom-content"> |
| 30 |
<?php if ($custom_content !== '') : ?> |
| 31 |
<?php echo wp_kses_post($custom_content); ?> |
| 32 |
<?php else : ?> |
| 33 |
<p class="text-gray-500 text-center py-8"> |
| 34 |
<?php esc_html_e('No custom content available for this section.', 'yatra'); ?> |
| 35 |
</p> |
| 36 |
<?php endif; ?> |
| 37 |
</div> |
| 38 |
</section> |
| 39 |
|