NEW UIUX Category - Add category type in create form (#38206)

* UIIX - Category - Add category type in create form

* Better UX

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Alexandre SPANGARO 2026-05-13 14:30:17 +02:00 committed by GitHub
parent 4babfaf069
commit 72ac1a4877
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,12 +1,13 @@
<?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2020-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2020-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -263,6 +264,21 @@ if ($user->hasRight('categorie', 'creer')) {
print '<table class="border centpercent">';
// Type
$typeLabel = '';
if (!empty($type) && !empty(Categorie::$MAP_TYPE_TITLE_AREA[$type])) {
$typeLabel = $langs->trans(Categorie::$MAP_TYPE_TITLE_AREA[$type]);
}
if (!empty($typeLabel)) {
print '<tr>';
print '<td class="titlefieldcreate">'.$langs->trans("Type").'</td>';
print '<td>'.$typeLabel;
print '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
print '</td>';
print '</tr>';
}
// Ref
print '<tr>';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td>';