Repository navigation
Expand file tree
/
Copy pathProvider.php
More file actions
40 lines (32 loc) · 1.64 KB
/
Copy pathProvider.php
File metadata and controls
40 lines (32 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Provides everything needed for the Extension
*/
$config = file_get_contents(__DIR__.'/gp247.json');
$config = json_decode($config, true);
$extensionPath = $config['configGroup'].'/'.$config['configKey'];
$this->loadTranslationsFrom(__DIR__.'/Lang', $extensionPath);
if (gp247_extension_check_active($config['configGroup'], $config['configKey'])) {
// WHY: declare this plugin's admin config screen as store-scoped so the MultiStore
// Pro StoreFence lets a store-admin reach the config of their own store (registry
// idiom, ADR plugin-manager_per-store-plugin-config). No-op without the Pro fence.
config(['gp247-config.admin.store_scoped_segments' => array_values(array_unique(array_merge(
(array) config('gp247-config.admin.store_scoped_segments', []),
['shippingstandard']
)))]);
$this->loadViewsFrom(__DIR__.'/Views', $extensionPath);
if (file_exists(__DIR__.'/config.php')) {
$this->mergeConfigFrom(__DIR__.'/config.php', $extensionPath);
}
if (file_exists(__DIR__.'/function.php')) {
require_once __DIR__.'/function.php';
}
// Standard shipping layer of gp247/shop: a rates-only provider (US-shipping-standard-provider-contract).
// WHY guarded: on an older shop the plugin keeps serving the old getInfo() contract.
if (interface_exists(\GP247\Shop\Shipping\Contracts\ShippingProvider::class)) {
config(['gp247-config.shop.shipping_providers.ShippingStandard' => [
'driver' => \App\GP247\Plugins\ShippingStandard\Services\StandardShippingProvider::class,
'capabilities' => ['rates'],
]]);
}
}