You are not logged in.
Bonjour,
Sur la documentation : glpi-developer-documentation.readthedocs.io/en/master/plugins/objects.html
Dans l'exemple du fichier : inc/myobject.class.php
A quoi correspond la fonction autoName à la ligne 21 ?
<?php
class PluginMyExampleMyObject extends CommonDBTM {
public function showForm($ID, $options = []) {
global $CFG_GLPI;
$this->initForm($ID, $options);
$this->showFormHeader($options);
if (!isset($options['display'])) {
//display per default
$options['display'] = true;
}
$params = $options;
//do not display called elements per default; they'll be displayed or returned here
$params['display'] = false;
$out = '<tr>';
$out .= '<th>' . __('My label', 'myexampleplugin') . '</th>'
$objectName = autoName(
$this->fields["name"],
"name",
(isset($options['withtemplate']) && $options['withtemplate']==2),
$this->getType(),
$this->fields["entities_id"]
);
$out .= '<td>';
$out .= Html::autocompletionTextField(
$this,
'name',
[
'value' => $objectName,
'display' => false
]
);
$out .= '</td>';
$out .= $this->showFormButtons($params);
if ($options['display'] == true) {
echo $out;
} else {
return $out;
}
}
}
Last edited by Samuel33190 (2023-01-05 14:40:54)
Offline