You are not logged in.
Pages: 1
Hi,
I am making a modification to the "badges" module.
I added a ...accessdetails table:
DROP TABLE IF EXISTS `glpi_plugin_badges_badgeaccessdetails`;
CREATE TABLE `glpi_plugin_badges_badgeaccessdetails` (
`id` int unsigned NOT NULL auto_increment,
`name` varchar(255) collate utf8mb4_unicode_ci default NULL,
`plugin_badges_badgeaccesses_id` int unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `plugin_badges_badgeaccesses_id` (`plugin_badges_badgeaccesses_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
The form is automatically generated but does not display the "plugin_badges_badgeaccesses_id" field
Does anyone know how to do this?
CODE: (inspired by badgetype)
badgeaccessdetail.class.php
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access directly to this file");
}
/**
* Class PluginBadgesBadgeAccessDetail
*/
class PluginBadgesBadgeAccessDetail extends CommonDropdown {
static $rightname = "dropdown";
var $can_be_translated = true;
/**
* @param int $nb
*
* @return translated
*/
static function getTypeName($nb = 0) {
return _n("Liste d'accès par site", "Liste d'accès par site", $nb, 'badges');
}
badgeaccessdetail.php
include('../../../inc/includes.php');
$dropdown = new PluginBadgesBadgeAccessDetail();
include(GLPI_ROOT . "/front/dropdown.common.php");
badgeaccessdetail.form.php
include('../../../inc/includes.php');
$dropdown = new PluginBadgesBadgeAccessDetail();
include(GLPI_ROOT . "/front/dropdown.common.form.php");
Offline
The only reason the name field shows is because it is a common field that all dropdowns have and therefore is automatically handled.
See the "showForm" method in src/CommonDropdown.php (GLPI source code) to see how dropdown forms are shown by default.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Thank you for your reply.
I looked at how "showForm" is used. I don't understand how this function can allow me to add a field to my form.
Do you have an example?
Offline
Pages: 1