Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion inc/container.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
if (!$item->isEntityAssign() || in_array($item->fields['entities_id'], $entities)) {
$display_condition = new PluginFieldsContainerDisplayCondition();
if ($display_condition->computeDisplayContainer($item, $data['id'])) {
$tabs_entries[$data['id']] = self::createTabEntry($data['label'], 0, null, PluginFieldsContainer::getIcon());
$tabs_entries[$data['id']] = self::createTabEntry(PluginFieldsLabelTranslation::getLabelFor(array_merge($data, ['itemtype' => 'PluginFieldsContainer'])), 0, null, PluginFieldsContainer::getIcon());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$tabs_entries[$data['id']] = self::createTabEntry(PluginFieldsLabelTranslation::getLabelFor(array_merge($data, ['itemtype' => 'PluginFieldsContainer'])), 0, null, PluginFieldsContainer::getIcon());
$label = PluginFieldsLabelTranslation::getLabelFor(
array_merge($data, ['itemtype' => PluginFieldsContainer::class])
);
$tabs_entries[$data['id']] = self::createTabEntry($label, 0, null, PluginFieldsContainer::getIcon());

improves readability

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTabNameForItem has no test in tests/Units/. Can you add a test case where a container has a translation for the active session language and verify the translated label is returned, and another where no translation exists and the raw label value is returned as fallback?

}
}
}
Expand Down