mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 18:48:22 +01:00
Add new conf and update dolGetButtonAction function to display action buttons inline instead of into a dropdown (#29629)
This commit is contained in:
@@ -12095,7 +12095,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
||||
{
|
||||
global $hookmanager, $action, $object, $langs;
|
||||
|
||||
// If $url is an array, we must build a dropdown button
|
||||
// If $url is an array, we must build a dropdown button or recursively iterate over each value
|
||||
if (is_array($url)) {
|
||||
// Loop on $url array to remove entries of disabled modules
|
||||
foreach ($url as $key => $subbutton) {
|
||||
@@ -12106,6 +12106,24 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
||||
|
||||
$out = '';
|
||||
|
||||
if (isset($params["areDropdownButtons"]) && $params["areDropdownButtons"] === false) {
|
||||
foreach ($url as $button) {
|
||||
if (!empty($button['lang'])) {
|
||||
$langs->load($button['lang']);
|
||||
}
|
||||
$label = $langs->trans($button['label']);
|
||||
$text = $button['text'] ?? '';
|
||||
$actionType = $button['actionType'] ?? '';
|
||||
$tmpUrl = DOL_URL_ROOT.$button['url'].(empty($params['backtopage']) ? '' : '&backtopage='.urlencode($params['backtopage']));
|
||||
$id = $button['$id'] ?? '';
|
||||
$userRight = $button['perm'] ?? 1;
|
||||
$params = $button['$params'] ?? [];
|
||||
|
||||
$out .= dolGetButtonAction($label, $text, $actionType, $tmpUrl, $id, $userRight, $params);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
if (count($url) > 1) {
|
||||
$out .= '<div class="dropdown inline-block dropdown-holder">';
|
||||
$out .= '<a style="margin-right: auto;" class="dropdown-toggle classfortooltip butAction'.($userRight ? '' : 'Refused').'" title="'.dol_escape_htmltag($label).'" data-toggle="dropdown">'.($text ? $text : $label).'</a>';
|
||||
|
||||
Reference in New Issue
Block a user