Merge pull request #20145 from atm-GregM/Fix_dolGetButtonAction
FIX: function dolGetButtonAction change title if html not set
This commit is contained in:
commit
32711e5f1f
@ -10142,7 +10142,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
|
|||||||
$class = 'butAction';
|
$class = 'butAction';
|
||||||
if ($actionType == 'danger' || $actionType == 'delete') {
|
if ($actionType == 'danger' || $actionType == 'delete') {
|
||||||
$class = 'butActionDelete';
|
$class = 'butActionDelete';
|
||||||
if (strpos($url, 'token=') === false) $url .= '&token='.newToken();
|
if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
$attr = array(
|
$attr = array(
|
||||||
@ -10153,6 +10153,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
|
|||||||
|
|
||||||
if (empty($html)) {
|
if (empty($html)) {
|
||||||
$html = $label;
|
$html = $label;
|
||||||
|
$attr['title'] = ''; // if html not set, leave label on title is redundant
|
||||||
} else {
|
} else {
|
||||||
$attr['aria-label'] = $label;
|
$attr['aria-label'] = $label;
|
||||||
}
|
}
|
||||||
@ -10166,6 +10167,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
|
|||||||
$attr['id'] = $id;
|
$attr['id'] = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Override attr
|
// Override attr
|
||||||
if (!empty($params['attr']) && is_array($params['attr'])) {
|
if (!empty($params['attr']) && is_array($params['attr'])) {
|
||||||
foreach ($params['attr'] as $key => $value) {
|
foreach ($params['attr'] as $key => $value) {
|
||||||
@ -10179,6 +10181,11 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// automatic add tooltip when title is detected
|
||||||
|
if (!empty($attr['title']) && !empty($attr['class']) && strpos($attr['class'], 'classfortooltip') === false) {
|
||||||
|
$attr['class'].= ' classfortooltip';
|
||||||
|
}
|
||||||
|
|
||||||
// Js Confirm button
|
// Js Confirm button
|
||||||
if ($userRight && !empty($params['confirm'])) {
|
if ($userRight && !empty($params['confirm'])) {
|
||||||
if (!is_array($params['confirm'])) {
|
if (!is_array($params['confirm'])) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user