2
0
forked from Wavyzz/dolibarr

Merge pull request #21363 from Quatadah/dolicloud-qnasdami-dropdownmenu

adding dropdown menu in case of a lot of buttons in project
This commit is contained in:
Laurent Destailleur
2022-07-27 10:15:39 +02:00
committed by GitHub
2 changed files with 28 additions and 17 deletions

View File

@@ -10411,6 +10411,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
* 'cancel-btn-label' => '', // Overide label of cancel button, if empty default label use "CloseDialog" lang key
* 'content' => '', // Overide text of content, if empty default content use "ConfirmBtnCommonContent" lang key
* 'modal' => true, // true|false to display dialog as a modal (with dark background)
* 'isDropDrown' => false, // true|false to display dialog as a dropdown (with dark background)
* ],
* ]
* // phpcs:enable
@@ -10420,12 +10421,16 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
{
global $hookmanager, $action, $object, $langs;
$class = 'butAction';
if ($actionType == 'danger' || $actionType == 'delete') {
$class = 'butActionDelete';
if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken();
//var_dump($params);
if ($params['isDropdown'])
$class = "dropdown-item";
else {
$class = 'butAction';
if ($actionType == 'danger' || $actionType == 'delete') {
$class = 'butActionDelete';
if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken();
}
}
$attr = array(
'class' => $class,
'href' => empty($url) ? '' : $url,