Skip to content

Add per-field hide condition (new "Conditions to hide field" tab) - #1252

Open
UncleTomsCabi wants to merge 1 commit into
pluginsGLPI:mainfrom
UncleTomsCabi:feature/field-hide-condition
Open

Add per-field hide condition (new "Conditions to hide field" tab)#1252
UncleTomsCabi wants to merge 1 commit into
pluginsGLPI:mainfrom
UncleTomsCabi:feature/field-hide-condition

Conversation

@UncleTomsCabi

Copy link
Copy Markdown

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.
image image image image

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
stonebuzz self-requested a review August 28, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant