Commit d3adf5c2 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(templates): Add dialog support to creation by template

This allows to use properly DialogAttributes like group members

issue #5626
Showing with 20 additions and 1 deletion
+20 -1
...@@ -171,6 +171,11 @@ class template ...@@ -171,6 +171,11 @@ class template
} }
} }
public function dialogOpened ()
{
return $this->tabObject->dialogOpened();
}
function execute() function execute()
{ {
$smarty = get_smarty(); $smarty = get_smarty();
...@@ -181,6 +186,15 @@ class template ...@@ -181,6 +186,15 @@ class template
if (!isset($this->attributes[$class])) { if (!isset($this->attributes[$class])) {
continue; continue;
} }
if ($plugin->is_modal_dialog()) {
$dialogResult = $plugin->dialog->execute();
if ($dialogResult === FALSE) {
$plugin->closeDialog();
} else {
$this->tabObject->current = $class;
return $dialogResult;
}
}
$attributes = array(); $attributes = array();
foreach ($this->attributes[$class] as $attr) { foreach ($this->attributes[$class] as $attr) {
if ($plugin->attributesAccess[$attr]->getAclInfo() !== FALSE) { if ($plugin->attributesAccess[$attr]->getAclInfo() !== FALSE) {
......
...@@ -92,7 +92,12 @@ class templateDialog ...@@ -92,7 +92,12 @@ class templateDialog
{ {
$smarty = get_smarty(); $smarty = get_smarty();
if (is_object($this->template)) { if (is_object($this->template)) {
$smarty->assign('template_dialog', $this->template->execute()); $templateOutput = $this->template->execute();
if ($this->template->dialogOpened()) {
return $templateOutput;
} else {
$smarty->assign('template_dialog', $templateOutput);
}
} else { } else {
$smarty->assign('templates', $this->templates); $smarty->assign('templates', $this->templates);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment