Skip to content

Commit fa7356e

Browse files
committed
feat: restrict configuration to all saleschannels
Closes #51
1 parent b81d76d commit fa7356e

File tree

9 files changed

+67
-9
lines changed

9 files changed

+67
-9
lines changed

CHANGELOG_de-DE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.28
2+
3+
* Beschränke Konfiguration auf "Alle Saleschannel"
4+
15
# 1.0.27
26

37
* Behebe Probleme ab Shopware 6.4.10

CHANGELOG_en-GB.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.28
2+
3+
* Restrict configuration to "All Saleschannels"
4+
15
# 1.0.27
26

37
* Fix problems from Shopware 6.4.10

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"thumbnail"
1212
],
1313
"description": "This plugins allows you to use variable thumbnails, without having them on storage.",
14-
"version": "1.0.27",
14+
"version": "1.0.28",
1515
"type": "shopware-platform-plugin",
1616
"license": "mit",
1717
"authors": [
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const {Component, Mixin} = Shopware;
2+
3+
Component.register('frosh-thumbnail-processor-config-restriction', {
4+
template: ' ', // we need content to be created
5+
6+
created() {
7+
this.checkAndHideSetting();
8+
},
9+
10+
updated() {
11+
this.checkAndHideSetting();
12+
},
13+
14+
methods: {
15+
checkAndHideSetting() {
16+
const fields = document.querySelectorAll('input[name^="FroshPlatformThumbnailProcessor.config"],.sw-plugin-config__save-action');
17+
18+
if (this.pluginConfigData().currentSalesChannelId) {
19+
fields.forEach(el => {
20+
el.setAttribute('disabled', 'disabled');
21+
});
22+
} else {
23+
fields.forEach(el => {
24+
el.removeAttribute('disabled');
25+
});
26+
}
27+
},
28+
29+
pluginConfigData() {
30+
let config = this.$parent.$parent.$parent.actualConfigData;
31+
if (config) {
32+
return this.$parent.$parent.$parent;
33+
}
34+
35+
config = this.$parent.$parent.$parent.$parent.actualConfigData;
36+
if (config) {
37+
return this.$parent.$parent.$parent.$parent;
38+
}
39+
40+
return this.$parent.$parent.$parent.$parent.$parent;
41+
}
42+
},
43+
44+
})
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import template from './frosh-thumbnail-processor-info-texts.html.twig';
2+
import './frosh-thumbnail-processor-info-texts.scss'
3+
4+
const {Component} = Shopware;
5+
6+
Component.register('frosh-thumbnail-processor-info-texts', {
7+
template,
8+
});
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
1-
import template from './frosh-thumbnail-processor-info-texts.html.twig';
2-
import './frosh-thumbnail-processor-info-texts.scss'
3-
4-
const {Component} = Shopware;
5-
6-
Component.register('frosh-thumbnail-processor-info-texts', {
7-
template,
8-
});
1+
import './frosh-thumbnail-processor-info-texts';
2+
import './frosh-thumbnail-processor-config-restriction';

src/Resources/config/config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,9 @@
3535
<component name="frosh-thumbnail-processor-info-texts">
3636
<name>froshthumbnailprocessorinfotexts</name>
3737
</component>
38+
39+
<component name="frosh-thumbnail-processor-config-restriction">
40+
<name>configRestriction</name>
41+
</component>
3842
</card>
3943
</config>

0 commit comments

Comments
 (0)