FormView adds the versions button to form views with the following code:
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $itemEditable) {
$toolbar->versions(
$this->option . '.' . $viewName,
$this->item->{$this->keyName}
);
}
The issue that we have is that it assumes that when there is a component parameter 'save_history' and that is set to yes, that all views of that component have version history implemented.
This is not correct as it will display the Versions button on views for which there is no and there should not be version history.
The workaround here is to before calling parent::addToolbar, first do a $this->state->get('params')->set('save_history', 0);
The fix should however be in the FormView where e.g. is also checked if the model is implementing VersionableModelInterface
| Labels |
Removed:
?
|
||
| Labels |
Added:
No Code Attached Yet
|
||
The fix should however be in the FormView where e.g. is also checked if the model is implementing VersionableModelInterface
Check model implements VersionableModelInterface is not enough. We still support legacy version history, mean need to also fallback to check if table implements VersionableTableInterface. Would be great if you can make a PR to fix this :)
Hi @joomdonation , good point!
Btw. I can't :)
Should be fixed with this PR: #47659