Skip to content

Commit e030ece

Browse files
committed
Move settings from the composer.json “extra” to the plugin main class
Signed-off-by: Andrew Welch <andrew@nystudio107.com>
1 parent 8eb75b6 commit e030ece

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

composer.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,7 @@
4040
"extra": {
4141
"name": "Transcoder",
4242
"handle": "transcoder",
43-
"schemaVersion": "1.0.0",
44-
"hasCpSettings": false,
45-
"hasCpSection": false,
4643
"changelogUrl": "https://raw.githubusercontent.com/nystudio107/craft-transcoder/v1/CHANGELOG.md",
47-
"components": {
48-
"transcode": "nystudio107\\transcoder\\services\\Transcode"
49-
},
5044
"class": "nystudio107\\transcoder\\Transcoder"
5145
}
5246
}

src/Transcoder.php

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,46 @@ class Transcoder extends Plugin
6464
*/
6565
public static $settings;
6666

67+
// Static Methods
68+
// =========================================================================
69+
70+
/**
71+
* @inheritdoc
72+
*/
73+
public function __construct($id, $parent = null, array $config = [])
74+
{
75+
$config['components'] = [
76+
'transcode' => Transcode::class,
77+
// Register the manifest service
78+
'manifest' => [
79+
'class' => ManifestService::class,
80+
'assetClass' => TranscoderAsset::class,
81+
'devServerManifestPath' => 'http://craft-transcoder-buildchain:8080/',
82+
'devServerPublicPath' => 'http://craft-transcoder-buildchain:8080/',
83+
],
84+
];
85+
86+
parent::__construct($id, $parent, $config);
87+
}
88+
89+
// Public Properties
90+
// =========================================================================
91+
92+
/**
93+
* @var string
94+
*/
95+
public $schemaVersion = '1.0.0';
96+
97+
/**
98+
* @var bool
99+
*/
100+
public $hasCpSection = false;
101+
102+
/**
103+
* @var bool
104+
*/
105+
public $hasCpSettings = false;
106+
67107
// Public Methods
68108
// =========================================================================
69109

@@ -137,14 +177,6 @@ protected function createSettingsModel()
137177
*/
138178
protected function addComponents()
139179
{
140-
// Register the manifest service
141-
$this->set('manifest', [
142-
'class' => ManifestService::class,
143-
'assetClass' => TranscoderAsset::class,
144-
'devServerManifestPath' => 'http://craft-transcoder-buildchain:8080/',
145-
'devServerPublicPath' => 'http://craft-transcoder-buildchain:8080/',
146-
]);
147-
148180
// Register our variables
149181
Event::on(
150182
CraftVariable::class,
@@ -250,8 +282,6 @@ function (RegisterUrlRulesEvent $event) {
250282
protected function customFrontendRoutes(): array
251283
{
252284
return [
253-
// Make webpack async bundle loading work out of published AssetBundles
254-
'/cpresources/transcoder/<resourceType:{handle}>/<fileName>' => 'transcoder/manifest/resource',
255285
];
256286
}
257287
}

0 commit comments

Comments
 (0)