-
Notifications
You must be signed in to change notification settings - Fork 71
Fixed issue with hiding conditions not hiding containers in simple ticket view #942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
akstis-typer
commented
Apr 10, 2025
- It fixes Hiding fields depending on category does not work #847
I was trying to solve issue with display conditions when using simple view in ticket menu The issue was that when you add a container, field to it, and then create display condition, the condition will not work as expected in simple view of ticket creation. The condition will never be satisfied and your field will always stay visible, no matter what condition you created Turned out, GLPI_POST_ITEM HOOK send item parameter without 'type' and 'itilcategory_id', those fields were contained in options parameter. This is small work around, works fine for my use case
Just to clarify: in my fresh installation (latest versions of everything), I had to place the code inside the $display_condition = new PluginFieldsContainerDisplayCondition(); like this: ...
$display_condition = new PluginFieldsContainerDisplayCondition();
// @akstis-typer code starts here ------
if($item->fields['type'] == "")
{
$item->fields['type'] = $params['options']['type'];
}
if($item->fields['itilcategories_id'] == "")
{
$item->fields['itilcategories_id'] = $params['options']['itilcategories_id'];
}
// @akstis-typer code ends here ------
if ($display_condition->computeDisplayContainer($item, $c_id)) {
... Otherwise, it didn’t work properly in my environment |
Moved code after new Display Condition
I've been testing this code and works correctly except for one more issue: When a custom field is shown and you edit another field (e.g. title), the custom field's alignment breaks again. My solution was to add $display_condition = new PluginFieldsContainerDisplayCondition();
if ($display_condition->computeDisplayContainer($item, $containers_id)) {
$field_options = [
'label_class' => 'col-lg-3',
'input_class' => 'col-lg-9',
];
echo "<div class='offset-md-1 col-md-8 col-xxl-6'>";
PluginFieldsField::showDomContainer(
$containers_id,
$item,
$type,
$subtype,
$field_options
);
echo "</div>";
} else {
echo '';
} After the |
can you rebase ? |
Hi, you mean I need to add last changes of original repository? Or something else? |