surecart
/
app
/
src
/
Controllers
/
Admin
/
ProductCollections
/
ProductCollectionsScriptsController.php
ProductCollectionsController.php
1 week ago
ProductCollectionsListTable.php
1 week ago
ProductCollectionsScriptsController.php
1 week ago
ProductCollectionsScriptsController.php
56 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Controllers\Admin\ProductCollections; |
| 4 | |
| 5 | use SureCart\Support\Scripts\AdminModelEditController; |
| 6 | |
| 7 | /** |
| 8 | * Product Collection Scripts |
| 9 | */ |
| 10 | class ProductCollectionsScriptsController extends AdminModelEditController { |
| 11 | /** |
| 12 | * Script handle. |
| 13 | * |
| 14 | * @var string |
| 15 | */ |
| 16 | protected $handle = 'surecart/scripts/admin/product_collections'; |
| 17 | |
| 18 | /** |
| 19 | * Script path. |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | protected $path = 'admin/product-collections'; |
| 24 | |
| 25 | /** |
| 26 | * Opt into the dataviews stylesheet enqueue (handled by the parent). |
| 27 | * |
| 28 | * @var bool |
| 29 | */ |
| 30 | protected $needs_dataviews_style = true; |
| 31 | |
| 32 | /** |
| 33 | * Add the api url to the data. |
| 34 | */ |
| 35 | public function __construct() { |
| 36 | $this->data['api_url'] = \SureCart::requests()->getBaseUrl(); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Enqueue the scripts. |
| 41 | * |
| 42 | * @return void |
| 43 | */ |
| 44 | public function enqueue(): void { |
| 45 | $available_templates = wp_get_theme()->get_page_templates( null, 'sc_collection' ); |
| 46 | $available_templates = array_merge( |
| 47 | $available_templates, |
| 48 | [ |
| 49 | apply_filters( 'default_page_template_title', __( 'Theme Layout', 'surecart' ), 'rest-api' ), |
| 50 | ] |
| 51 | ); |
| 52 | $this->data['availableTemplates'] = $available_templates; |
| 53 | parent::enqueue(); |
| 54 | } |
| 55 | } |
| 56 |