Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Writable] only allow writable definitions to be saved #394

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, just found the issue with this: it is used for the Add button, it gets disabled without this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Add" button (new import/export profile) will be disabled when not in debug because it relies on this to be present.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that a problem?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because you can't add new profiles even though they're writable? You can edit existing ones.

}
}
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
Loading