From 9ec8051a378980cf4d7b156428debae1607f47d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Jun 2020 02:56:48 +0200 Subject: [PATCH] NEW Add param to not show links when output tags --- htdocs/categories/class/categorie.class.php | 6 +++++- htdocs/core/class/html.form.class.php | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 3076b9ecacd..748a9501101 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1347,7 +1347,7 @@ class Categorie extends CommonObject * separated by $sep (" >> " by default) * * @param string $sep Separator - * @param string $url Url + * @param string $url Url ('', 'none' or 'urltouse') * @param int $nocolor 0 * @param string $addpicto Add picto into link * @return array @@ -1386,6 +1386,10 @@ class Categorie extends CommonObject $link = ''; $linkend = ''; $w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; + } elseif ($url == 'none') { + $link = ''; + $linkend = ''; + $w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } else { $w[] = "".($addpicto ? img_object('', 'category') : '').$cat->label.""; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 289b92f84ae..efae43e02ee 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6554,9 +6554,10 @@ class Form * @param int $id Id of object * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. * @param int $rendermode 0=Default, use multiselect. 1=Emulate multiselect (recommended) + * @param int $nolink 1=Do not add html links * @return string String with categories */ - public function showCategories($id, $type, $rendermode = 0) + public function showCategories($id, $type, $rendermode = 0, $nolink = 0) { global $db; @@ -6570,7 +6571,7 @@ class Form $toprint = array(); foreach ($categories as $c) { - $ways = $c->print_all_ways(' >> ', '', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text + $ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text foreach ($ways as $way) { $toprint[] = '
  • color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.$way.'
  • ';