LearnScriptsController.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Controllers\Admin\Learn; |
| 4 | |
| 5 | use SureCart\Models\Processor; |
| 6 | use SureCart\Support\Scripts\AdminModelEditController; |
| 7 | |
| 8 | /** |
| 9 | * Learn page scripts. |
| 10 | */ |
| 11 | class LearnScriptsController extends AdminModelEditController { |
| 12 | /** |
| 13 | * What types of data to add the the page. |
| 14 | * |
| 15 | * @var array |
| 16 | */ |
| 17 | protected $with_data = [ 'currency', 'supported_currencies' ]; |
| 18 | |
| 19 | /** |
| 20 | * Script handle. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | protected $handle = 'surecart/scripts/admin/learn'; |
| 25 | |
| 26 | /** |
| 27 | * Script path. |
| 28 | * |
| 29 | * @var string |
| 30 | */ |
| 31 | protected $path = 'admin/settings/learn'; |
| 32 | |
| 33 | /** |
| 34 | * Enqueue scripts with additional learn-specific data. |
| 35 | * |
| 36 | * @return void |
| 37 | */ |
| 38 | public function enqueue() { |
| 39 | $this->data['processors'] = Processor::get(); |
| 40 | $this->data['brand_logo_url'] = \SureCart::account()->brand->logo_url ?? null; |
| 41 | $this->data['brand_color'] = \SureCart::account()->brand->color ?? null; |
| 42 | $this->data['shop_page_edit_url'] = \SureCart::pages()->getId( 'shop' ) |
| 43 | ? admin_url( 'post.php?post=' . \SureCart::pages()->getId( 'shop' ) . '&action=edit' ) |
| 44 | : ''; |
| 45 | $this->data['dashboard_page_edit_url'] = \SureCart::pages()->getId( 'dashboard' ) |
| 46 | ? admin_url( 'post.php?post=' . \SureCart::pages()->getId( 'dashboard' ) . '&action=edit' ) |
| 47 | : ''; |
| 48 | parent::enqueue(); |
| 49 | } |
| 50 | } |
| 51 |