Asset
1 month ago
Banner
1 month ago
Colors
1 month ago
MenuGroupFactory
1 month ago
MenuPageFactory
1 month ago
Notice
1 month ago
Page
1 month ago
PageFactory
1 month ago
Preference
1 month ago
Type
1 month ago
View
1 month ago
Admin.php
1 month ago
AdminLoader.php
1 month ago
AdminNetwork.php
1 month ago
AdminScripts.php
1 month ago
HelpTab.php
1 month ago
Helpable.php
1 month ago
Menu.php
1 month ago
MenuFactory.php
1 month ago
MenuFactoryInterface.php
1 month ago
MenuGroupFactory.php
1 month ago
MenuListFactory.php
1 month ago
MenuListItems.php
1 month ago
MenuPageFactory.php
1 month ago
PageFactoryInterface.php
1 month ago
PageNetworkRequestHandler.php
1 month ago
PageNetworkRequestHandlers.php
1 month ago
PageRequestHandler.php
1 month ago
PageRequestHandlers.php
1 month ago
RenderableHead.php
1 month ago
RequestHandlerInterface.php
1 month ago
ScreenOption.php
1 month ago
ScreenOptions.php
1 month ago
Scripts.php
1 month ago
Tooltip.php
1 month ago
UninitializedScreens.php
1 month ago
Scripts.php
48 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Admin; |
| 4 | |
| 5 | use AC\AdminColumns; |
| 6 | use AC\Asset\Location; |
| 7 | use AC\Asset\Script; |
| 8 | use AC\Asset\Style; |
| 9 | use AC\Registerable; |
| 10 | |
| 11 | class Scripts implements Registerable |
| 12 | { |
| 13 | |
| 14 | private Location $location; |
| 15 | |
| 16 | public function __construct(AdminColumns $plugin) |
| 17 | { |
| 18 | $this->location = $plugin->get_location(); |
| 19 | } |
| 20 | |
| 21 | public function register(): void |
| 22 | { |
| 23 | add_action('init', [$this, 'register_scripts']); |
| 24 | } |
| 25 | |
| 26 | public function register_scripts(): void |
| 27 | { |
| 28 | $assets = [ |
| 29 | new Script('ac-select2-core', $this->location->with_suffix('assets/js/select2.js')), |
| 30 | new Script( |
| 31 | 'ac-select2', |
| 32 | $this->location->with_suffix('assets/js/select2_conflict_fix.js'), |
| 33 | ['jquery', 'ac-select2-core'] |
| 34 | ), |
| 35 | new Style('ac-select2', $this->location->with_suffix('assets/css/select2.css')), |
| 36 | new Style('ac-jquery-ui', $this->location->with_suffix('assets/css/ac-jquery-ui.css')), |
| 37 | |
| 38 | // Notices |
| 39 | new Style('ac-message', $this->location->with_suffix('assets/css/notice.css')), |
| 40 | new Script('ac-message', $this->location->with_suffix('assets/js/notice-dismissible.js')), |
| 41 | ]; |
| 42 | |
| 43 | foreach ($assets as $asset) { |
| 44 | $asset->register(); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | } |