Skip to content

TangibleFieldsRenderer: Add support for visibility conditions#50

Merged
nicolas-jaussaud merged 1 commit into
mainfrom
fix/fields-renderer-visibility-conditions
Jun 26, 2026
Merged

TangibleFieldsRenderer: Add support for visibility conditions#50
nicolas-jaussaud merged 1 commit into
mainfrom
fix/fields-renderer-visibility-conditions

Conversation

@nicolas-jaussaud

Copy link
Copy Markdown
Contributor

Hi @zinigor!

This pull request adds support for visibility conditions in the TangibleFieldsRenderer

Tangible fields has a visibility conditions system (evaluated on the frontend), that can be defined with the following syntax:

  $fields->render_field( 'field-name', [
      'type'      => 'text',
      'condition' => [
          'action'    => 'show',
          'condition' => [ 'another-field-name' => [ '_eq' => 'value' ] ],
      ],
  ] );

  $fields->render_field( 'another-field-name', [
      'type' => 'text',
  ] );

Currently if we try to set those conditions in the DataView config, they won't be passed to $fields->render_field():

 new DataView([
      // ...
      'fields' => [
          'field-name' => [
              'type'      => 'text',
              // ...
              'condition' => [
                  'action'    => 'show',
                  'condition' => [ 'another-field-name' => [ '_eq' => 'value' ] ],
              ],
          ],
          'another-field-name' => 'string',
      ],
      // ...
  ]);

The changes just make sure we pass the conditions when they are defined

@zinigor zinigor left a comment

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.

Yeah, makes sense, thanks for also covering it with tests!

@nicolas-jaussaud nicolas-jaussaud merged commit 58134fe into main Jun 26, 2026
3 checks passed
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.

2 participants