Skip to content

Commit

Permalink
[Writable] only allow writable definitions to be saved
Browse files Browse the repository at this point in the history
  • Loading branch information
dpfaffenbauer committed Sep 27, 2023
1 parent 4fe7a56 commit 79370b5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class PimcoreSettingsListener
{
public function indexSettings(IndexActionSettingsEvent $settingsEvent): void
{
$settingsEvent->addSetting('data-definitions-import-definition-writeable', (new ImportDefinition())->isWriteable());
$settingsEvent->addSetting('data-definitions-export-definition-writeable', (new ExportDefinition())->isWriteable());

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ Wvision\Bundle\DataDefinitionsBundle\Model\ExportDefinition:
expose: true
type: boolean
groups: [ Detailed ]
virtual_properties:
isWriteable:
exp: object.isWriteable()
type: boolean
serialized_name: isWriteable
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ Wvision\Bundle\DataDefinitionsBundle\Model\ImportDefinition:
expose: true
type: boolean
groups: [ Detailed ]
virtual_properties:
isWriteable:
exp: object.isWriteable()
type: boolean
serialized_name: isWriteable
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pimcore.plugin.datadefinitions.export.item = Class.create(pimcore.plugin.datadef
providers: [],

saveDisabled: function () {
return !pimcore.settings['data-definitions-export-definition-writeable'];
return !this.data.isWriteable;
},

getSettings: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pimcore.plugin.datadefinitions.import.item = Class.create(pimcore.plugin.datadef
providers: [],

saveDisabled: function () {
return !pimcore.settings['data-definitions-import-definition-writeable'];
return !this.data.isWriteable;
},

getSettings: function () {
Expand Down

0 comments on commit 79370b5

Please sign in to comment.