Skip to content
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

BUG: Hidden Property of node type configuration does only work in the inspector but not in the node creation dialog #3483

Closed
theDex opened this issue May 4, 2023 · 5 comments
Labels
7.3 8.0 Bug Label to mark the change as bugfix

Comments

@theDex
Copy link
Contributor

theDex commented May 4, 2023

Description

In the inspector you can hide properties with the ui.inspector.hidden property, e.g.

'Package:NodeType':
  properties:
    hiddenProperty:
      ui:
        showInCreationDialog: true
        inspector:
          hidden: true

This does not show the property in the Inspector, but it still appears in the creation dialog. This might be useful for setting properties in the creation process but not showing them afterwards in the inspector, but for me this is not the expected behaviour because other inspector options like editor and editorOptions.dataSourceIdentifier for example also work in the node creation dialog.

We use the hidden property in a few cases to hide or show properties with ClientEval based on other properties as described in https://docs.neos.io/guide/manual/content-repository/nodetype-properties and the problem is, as soon as we add showInCreationDialog: true they are shown in the creation dialog weather the other property is set or not.

I would like to start a discussion, if this is actually a bug and should be fixed or if this is the intended behaviour and there should be another option to dynamically hide and show fields in the creation dialog based on ClientEval statements.

Steps to Reproduce

Create a nodetype with a hidden property (possibly based on another property with ClientEval) and showInCreationDialog: true
e.g. sth. like:

'Package:NodeType':
  properties:
    firstProperty:
      ui:
        showInCreationDialog: true
    secondProperty:
      ui:
        showInCreationDialog: true
        inspector:
          hidden: 'ClientEval:!node.properties.firstProperty'

Expected behavior

The secondProperty is hidden in both the inspector and the node creation dialog as long as the firstProperty is empty

Actual behavior

The second property is shown in the node creation dialog even if the firstProperty is not set yet

Affected Versions

Tested with:
Neos: 8.1.2
UI: 8.1.9

@crydotsnake crydotsnake added Enhancement Feature Label to mark the change as feature labels May 4, 2023
@crydotsnake crydotsnake self-assigned this May 8, 2023
@crydotsnake
Copy link
Member

crydotsnake commented May 15, 2023

This functionality has been implemented in #3344 afaik.
Since #3304 is already merged, we could create a fresh PR and implement the functionality of #3344.
Or as an alternative: rebase #3344 and implement the functionality.

What are your opinions on this? @markusguenther @mhsdesign @JamesAlias @Sebobo

@mhsdesign
Copy link
Member

@Sebobo

@crydotsnake
Copy link
Member

crydotsnake commented May 15, 2023

I wasn't sure in the first moment if this was a bugfix or a new feature. In the first moment, I assumed a feature.

@mhsdesign mhsdesign changed the title Hidden Property of node type configuration does only work in the inspector but not in the node creation dialog BUG: Hidden Property of node type configuration does only work in the inspector but not in the node creation dialog May 23, 2023
@mhsdesign mhsdesign added Bug Label to mark the change as bugfix and removed Enhancement Feature Label to mark the change as feature labels May 23, 2023
@mhsdesign
Copy link
Member

mhsdesign commented May 23, 2023

we actually have following problems:

the preprocessor that creates the creationDialog entries based on showInCreationDialog doesnt copy the hidden property from the inspector array:
https://github.com/neos/neos-development-collection/blob/072186e1601d82a8565942a05c9fe7253cf7f85d/Neos.Neos/Classes/NodeTypePostprocessor/CreationDialogPostprocessor.php#L100-L135

but even if it would do so, the creationDialog wouldnt know what to do with it yet:

creationDialog?: {
elements?: {
[propName: string]: {
type?: string;
ui?: {
label?: string;
editor?: string;
editorOptions?: {
[propName: string]: any;
};
};
validation?: {
[propName: string]: {
[propName: string]: any;
};
};
};
};
};

in the inspector we filter out all items based on if inspector.hidden is false.

const visibleItems = items ? items.filter(item => !$get('hidden', item)) : [];

The mentioned pr #3304 is only relevant in that we will get ClientEval support for the hidden property once we introduce it in the creationDialog out of the box. I think since this feature/bug was only recently introduced, it was previously not useful to handle the hidden option as its not as useful as with ClientEval.

so while currently

properties:
  hiddenProperty:
    ui:
      showInCreationDialog: true
      inspector:
        hidden: true
        editorOptions:
          disabled: true
          any: thing
        editor: FooBar
        position: start

is expanded to
(note how i also included position and editorOptions in my example to show that these keys are already kept)

ui:
  creationDialog:
    elements:
      hiddenProperty:
        type: string
        ui:
          editor: FooBar
          editorOptions:
            disabled: true
            any: thing
        position: start

we can just add support here for hidden aswell

ui:
  creationDialog:
    elements:
      hiddenProperty:
        type: string
        ui:
          hidden: true

or one level higher? (i think we were just inconsistent with moving position up, so i rather say no)

ui:
  creationDialog:
    elements:
      hiddenProperty:
        type: string
        hidden: true
        ui: { }

@crydotsnake
Copy link
Member

I will close this. Since #3507 and neos/neos-development-collection#4297 have been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.3 8.0 Bug Label to mark the change as bugfix
Projects
None yet
Development

No branches or pull requests

3 participants