fix tooltip

This commit is contained in:
Frédéric FRANCE 2023-02-05 09:46:29 +01:00
parent 473690f49b
commit a501ae8961

View File

@ -5219,24 +5219,25 @@ class Product extends CommonObject
} }
$linkclose = ''; $linkclose = '';
if (empty($notooltip)) { $classfortooltip = 'classfortooltip';
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $dataparams = '';
$label = $langs->trans("ShowProduct");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [ $params = [
'id' => $this->id, 'id' => $this->id,
'objecttype' => $this->element, 'objecttype' => $this->element,
'option' => $option, 'option' => $option,
]; ];
$linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $classfortooltip = 'classforajaxtooltip';
$linkclose .= ' class="nowraponall classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; $dataparams = ' data-params='.json_encode($params);
} else { $label = $langs->trans('Loading');
$linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
$linkclose .= ' class="nowraponall classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} }
if (empty($notooltip)) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("ShowProduct");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
$linkclose .= $dataparams.' class="nowraponall '.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else { } else {
$linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"'; $linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"';
} }
@ -5269,10 +5270,10 @@ class Product extends CommonObject
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) { if ($withpicto) {
if ($this->type == Product::TYPE_PRODUCT) { if ($this->type == Product::TYPE_PRODUCT) {
$result .= (img_object(($notooltip ? '' : $label), 'product', ($notooltip ? 'class="paddingright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1)); $result .= (img_object(($notooltip ? '' : $label), 'product', ($notooltip ? 'class="paddingright"' : $dataparams.' class="paddingright '.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1));
} }
if ($this->type == Product::TYPE_SERVICE) { if ($this->type == Product::TYPE_SERVICE) {
$result .= (img_object(($notooltip ? '' : $label), 'service', ($notooltip ? 'class="paddingright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1)); $result .= (img_object(($notooltip ? '' : $label), 'service', ($notooltip ? 'class="paddingright"' : $dataparams.' class="paddingright '.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1));
} }
} }
$result .= dol_escape_htmltag($newref); $result .= dol_escape_htmltag($newref);