| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Yatra\Core\Assets; |
| 6 |
|
| 7 |
/** |
| 8 |
* Listing Page Asset Manager |
| 9 |
*/ |
| 10 |
class ListingAssetManager extends BaseAssetManager |
| 11 |
{ |
| 12 |
private string $listing_type; |
| 13 |
|
| 14 |
public function __construct(string $listing_type) |
| 15 |
{ |
| 16 |
parent::__construct('listing'); |
| 17 |
|
| 18 |
$this->listing_type = $listing_type; |
| 19 |
|
| 20 |
$this->addStyle('yatra-listing'); |
| 21 |
$this->addScript('yatra-listing'); |
| 22 |
|
| 23 |
$data = [ |
| 24 |
'type' => $listing_type, |
| 25 |
'ajaxUrl' => admin_url('admin-ajax.php'), |
| 26 |
'nonce' => wp_create_nonce('yatra_listing_nonce'), |
| 27 |
]; |
| 28 |
|
| 29 |
if ($listing_type === 'trip' && function_exists('yatra_get_trip_listing_url')) { |
| 30 |
$data['tripListingUrl'] = \yatra_get_trip_listing_url(); |
| 31 |
} |
| 32 |
|
| 33 |
$this->addLocalization('yatra-listing', 'yatraListing', $data); |
| 34 |
} |
| 35 |
} |
| 36 |
|