Open HLeithner opened 7 months ago
Additonal the addModalToolbar()
method in the HtmlView
could be added to FormView
as well.
Example code:
/**
* Add the page title and toolbar.
*
* @return void
*/
protected function addToolbar()
{
// We don't need toolbar in the modal window.
if ($this->getLayout() === 'modal') {
$this->addModalToolbar();
return;
}
parent::addToolbar();
ToolbarHelper::inlinehelp();
}
/**
* Add the page title and toolbar.
*
* @return void
*/
protected function addModalToolbar()
{
$user = $this->getCurrentUser();
$isNew = empty($this->item->{$this->keyName});
$canDo = $this->canDo;
$toolbar = $this->document->getToolbar();
$canCreate = $isNew && (\count($user->getAuthorisedCategories($this->option, 'core.create')) > 0);
$canEdit = $canDo->get('core.edit');
if ($canCreate || $canEdit) {
$toolbar->apply('_0LC_MVC_EDIT_0_.apply');
$toolbar->save('_0LC_MVC_EDIT_0_.save');
}
$toolbar->cancel('_0LC_MVC_EDIT_0_.cancel');
}
Sounds like a good idea
Is your feature request related to a problem? Please describe.
In core we use the
layout
modal
in thecancel
task in the controller formodalselect
closing. This is implemented in several controllers. it would make sense to move this functionality to the FromControllercancel
method. This function already has similar functionality for redirection logic. Additionally in thepostSaveHook
in the same Controller is used forsave
operation redirection and should be added to the core at the same time.Describe the solution you'd like
Move selectmodal functionality to
FromController
Additional context
Something like that but a bit simplified: