-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProvider.php
More file actions
54 lines (45 loc) · 2.53 KB
/
Copy pathProvider.php
File metadata and controls
54 lines (45 loc) · 2.53 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?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'])) {
$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';
}
view()->share('modelNewsCategory', (new \App\GP247\Plugins\News\Models\NewsCategory));
view()->share('modelNewsContent', (new \App\GP247\Plugins\News\Models\NewsContent));
// Register this plugin's storefront page-types into the LayoutBlock "Page"
// scope registry (US-PLG-008, ADR front-admin_layout-page-enum-catalog).
// WHY: store the i18n KEY, not a pre-rendered string — the admin dropdown
// renders it via gp247_language_render() in the viewer's current locale.
// Pre-rendering here froze the label at the boot locale (latent bug).
$configLayout = config('gp247-config.front.layout_page', []);
$configLayout['news_index'] = $extensionPath.'::News.layout_block_page.news_index';
$configLayout['news_category'] = $extensionPath.'::News.layout_block_page.news_category';
$configLayout['news_detail'] = $extensionPath.'::News.layout_block_page.news_detail';
config(['gp247-config.front.layout_page' => $configLayout]);
// End add layout page for news
// Register this plugin's active categories/content into sitemap.xml
// (US-PLG-007, ADR seo_plugin-sitemap-extension, amended 20260711T135121).
// SeoController reads this registry — gp247/front never hardcodes the
// News plugin's name. 'key' also lets the admin toggle this plugin's
// whole sitemap contribution off from the "SEO" admin screen
// (seo.plugin_enabled.News); 'label' is what that screen displays,
// reusing the manifest's own "name" field so no new translation key
// is needed just for this.
$sitemapProviders = config('gp247-config.front.seo_sitemap_providers', []);
$sitemapProviders[] = [
'key' => $config['configKey'],
'label' => $config['name'],
'callback' => [\App\GP247\Plugins\News\Seo::class, 'sitemapUrls'],
];
config(['gp247-config.front.seo_sitemap_providers' => $sitemapProviders]);
}