Add per-field hide condition (new "Conditions to hide field" tab) - #1252
Open
UncleTomsCabi wants to merge 1 commit into
Open
Add per-field hide condition (new "Conditions to hide field" tab)#1252UncleTomsCabi wants to merge 1 commit into
UncleTomsCabi wants to merge 1 commit into
Conversation
Currently, PluginFieldsContainerDisplayCondition only lets you hide the whole block when the main object matches a condition. This PR adds a separate mechanism to hide a single field of the block instead, without affecting the rest of the block. A new tab, "Conditions to hide field", appears on the container's edit page next to the existing "Conditions to hide block" tab. The two are independent: a block-level condition still hides everything, a field-level condition only hides the one field you pick. What's new New table glpi_plugin_fields_fielddisplayconditions and new class PluginFieldsFieldDisplayCondition (CommonDBChild of PluginFieldsContainer), mirroring PluginFieldsContainerDisplayCondition and delegating to it for the parts that don't depend on the storage table. New required "Field to hide" dropdown on the condition form. PluginFieldsField::prepareHtmlFields() now filters out fields whose condition matches the current item, before rendering — covers tab, dom/domtab and massive-action paths through a single integration point. New ajax/field_display_condition.php and front/fielddisplaycondition.form.php controllers, two new Twig templates. container.class.php::defineTabs() registers the new tab.
stonebuzz
self-requested a review
August 28, 2026 14:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, PluginFieldsContainerDisplayCondition only lets you hide the whole block when the main object matches a condition. This PR adds a separate mechanism to hide a single field of the block instead, without affecting the rest of the block. A new tab, "Conditions to hide field", appears on the container's edit page next to the existing "Conditions to hide block" tab. The two are independent: a block-level condition still hides everything, a field-level condition only hides the one field you pick. What's new