Skip to content

Commit

Permalink
Display YAML export button only on existing items, and move it in ite…
Browse files Browse the repository at this point in the history
…m toolbar
  • Loading branch information
cedric-anne committed Dec 17, 2021
1 parent f2f5268 commit 631aa1b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions inc/container.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,22 @@ static function getTypeName($nb = 0) {
}

public function showForm($ID, $options = []) {
global $CFG_GLPI;

echo "<div class='center'><a class='vsubmit' href='export_to_yaml.php?id=".$ID."'><i class='pointer fa fa-refresh'></i>&nbsp;".
__("Export to YAML", "fields")."</a></div><br>";

$this->initForm($ID, $options);

if (!$this->isNewID($ID)) {
$btn_url = Plugin::getWebDir('fields') . '/front/export_to_yaml.php?id=' . $ID;
$btn_label = __("Export to YAML", "fields");
$export_btn = <<<HTML
<a href="{$btn_url}" class="btn btn-ghost-secondary"
title="{$btn_label}"
data-bs-toggle="tooltip" data-bs-placement="bottom">
<i class="fas fa-file-export fa-lg"></i>
</a>
HTML;
$options['header_toolbar'] = [$export_btn];
}

$this->showFormHeader($options);
$rand = mt_rand();

Expand Down

0 comments on commit 631aa1b

Please sign in to comment.