Skip to content

Commit c7413d1

Browse files
authored
Fix module toolbar save buttons (#40381)
1 parent 99fadde commit c7413d1

File tree

1 file changed

+4
-21
lines changed
  • administrator/components/com_modules/src/View/Module

1 file changed

+4
-21
lines changed

administrator/components/com_modules/src/View/Module/HtmlView.php

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,9 @@ function (Toolbar $childBar) {
116116

117117
$toolbar->cancel('module.cancel', 'JTOOLBAR_CANCEL');
118118
} else {
119-
$toolbarButtons = [];
120-
121119
// Can't save the record if it's checked out.
122-
if (!$checkedOut) {
123-
// Since it's an existing record, check the edit permission.
124-
if ($canDo->get('core.edit')) {
125-
$toolbar->apply('module.apply');
126-
127-
$toolbarButtons[] = ['save', 'module.save'];
128-
129-
// We can save this record, but check the create permission to see if we can return to make a new one.
130-
if ($canDo->get('core.create')) {
131-
$toolbarButtons[] = ['save2new', 'module.save2new'];
132-
}
133-
}
134-
}
135-
136-
// If checked out, we can still save
137-
if ($canDo->get('core.create')) {
138-
$toolbarButtons[] = ['save2copy', 'module.save2copy'];
120+
if (!$checkedOut && $canDo->get('core.edit')) {
121+
$toolbar->apply('module.apply');
139122
}
140123

141124
$saveGroup = $toolbar->dropdownButton('save-group');
@@ -148,13 +131,13 @@ function (Toolbar $childBar) use ($checkedOut, $canDo) {
148131

149132
// We can save this record, but check the create permission to see if we can return to make a new one.
150133
if ($canDo->get('core.create')) {
151-
$childBar->save('module.save2new');
134+
$childBar->save2new('module.save2new');
152135
}
153136
}
154137

155138
// If checked out, we can still save
156139
if ($canDo->get('core.create')) {
157-
$childBar->save('module.save2copy');
140+
$childBar->save2copy('module.save2copy');
158141
}
159142
}
160143
);

0 commit comments

Comments
 (0)