You are not logged in.
Pages: 1
Hello,
I have this code in my file /plugins/licensemanager/front/licensecontract.php:
<?php
use GlpiPlugin\Licensemanager\LicenseContract;
include ("../../../inc/includes.php");
Html::header(__('License Contracts', 'licensemanager'), $_SERVER['PHP_SELF'], 'management', 'glpiplugin\licensemanager\menu');
Search::show(LicenseContract::class);
Html::footer();
If I click on the created menu entry 'License Contracts' it shows the view and the correct path at the top ("Home" -> "Management" -> "License Contracts").
Now I have added a dropdown to the config section which is displayed on an own accordion/tab named by the name of the plugin. For better structure I moved the entries for dropdowns in a subfolder of src: src/Dropdowns.
In the file /plugins/licensemanager/front/dropdowns/status.php I added the path similar to the other menu:
<?php
use GlpiPlugin\Licensemanager\Dropdowns\Status;
include ("../../../../inc/includes.php");
Html::header(__('License & Contracts Mgmt', 'licensemanager'), $_SERVER['PHP_SELF'], 'config', 'commondropdown', 'glpiplugin\licensemanager\dropdowns\status');
Search::show(Status::class);
Html::footer();
But at the top it only shows "Home" -> "Setup" -> "Dropdowns" without "Status".
This is the content of the status class:
<?php
namespace GlpiPlugin\Licensemanager\Dropdowns;
use \CommonDropdown;
class Status extends CommonDropdown {
public static $table = 'glpi_plugin_licensemanager_dropdowns_statuses';
public static function getTypeName($nb = 0) {
return __('Status', 'licensemanager');
}
public static function getTable($classname = null): string {
return self::$table;
}
public static function canView(): bool {
return true;
}
}
The table exists and has 1 entry.
What is missing/wrong here?
Last edited by DeveloperLabs (2025-02-03 11:05:23)
Offline
Change
<?php
use GlpiPlugin\Licensemanager\Dropdowns\Status;
include ("../../../../inc/includes.php");
Html::header(__('License & Contracts Mgmt', 'licensemanager'), $_SERVER['PHP_SELF'], 'config', 'commondropdown', 'glpiplugin\licensemanager\dropdowns\status');
Search::show(Status::class);
Html::footer();
to
<?php
// Include the necessary class
use GlpiPlugin\Licensemanager\Dropdowns\Status;
// Include the core GLPI initialization file
require_once __DIR__ . "/../../../../inc/includes.php";
// Create a new instance of the Status class.
// This object is used to manage status entries within the GLPI plugin.
// It allows retrieving, displaying, and handling status-related data.
$dropdown = new Status();
// Include the GLPI common dropdown handler.
// This script is responsible for rendering and processing dropdown elements,
// ensuring proper integration within GLPI’s UI. It also handles form submissions,
// permissions, and data validation.
require_once GLPI_ROOT . "/front/dropdown.common.php";
Offline
Pages: 1