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

Dead (or broken?) code in VersionedGridFieldItemRequest #347

Open
kinglozzer opened this issue Nov 25, 2021 · 0 comments
Open

Dead (or broken?) code in VersionedGridFieldItemRequest #347

kinglozzer opened this issue Nov 25, 2021 · 0 comments

Comments

@kinglozzer
Copy link
Member

protected function addUnversionedButtons(DataObject $record, FieldList $actions)
{
if (!$record->canEdit()) {
return;
}
$saveAction = $actions->fieldByName('action_doSave');
if (!$saveAction) {
return;
}
if (!$this->record->ID) {
return;
}
$saveAction->setTitle(_t(
__CLASS__ . '.BUTTONAPPLYCHANGES',
'Apply changes'
))->addExtraClass('btn-primary font-icon-save');
}
}

If an un-versioned object has $owns set, the above method is called. However, $saveAction is always null because the action is contained in a CompositeField, so it can’t be found like this.

The button should say “Apply changes” instead of “Save”, which I remember it used to but doesn’t anymore. I tried using the approach in addVersionedButtons() below, but this results in a broken button (invisible text, disappears when changes are made) any I don’t have time to debug that right now!

$majorActions = $actions->fieldByName('MajorActions');
$saveAction = ($majorActions) ? $majorActions->fieldByName('action_doSave') : null;

I’m not sure if we should just remove this, or “fix” it so the button says “Apply Changes” again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants