[SOLVED] Remove properties from NodeType of included package


(George Dimitriadis) #1

Hello,

My Site package uses the Neos.NodeTypes:Page, which has the following properties configuration:

properties:
  'layout':
    ui:
      inspector:
        group: 'layout'
        editorOptions:
          values:
            'default':
              label: 'Neos.Demo:NodeTypes.Page:properties.layout.selectBoxEditor.values.default'
            'landingPage':
              label: 'Neos.Demo:NodeTypes.Page:properties.layout.selectBoxEditor.values.landingPage'
  'subpageLayout':
    ui:
      inspector:
        group: 'layout'
        editorOptions:
          values:
            'default':
              label: 'Neos.Demo:NodeTypes.Page:properties.subpageLayout.selectBoxEditor.values.default'
            'landingPage':
              label: 'Neos.Demo:NodeTypes.Page:properties.subpageLayout.selectBoxEditor.values.landingPage'
  'image':
    type: 'Neos\Media\Domain\Model\ImageInterface'
    ui:
      label: 'Neos.Demo:NodeTypes.Page:properties.image'
      reloadIfChanged: TRUE
      inspector:
        group: 'image'
        position: 50
        editorOptions:
          crop:
            aspectRatio:
              locked:
                width: 2
                height: 1
  'imageTitleText':
    type: string
    ui:
      label: 'Neos.Demo:NodeTypes.Page:properties.imageTitleText'
      reloadIfChanged: TRUE
      inspector:
        group: 'image'
        position: 100

I would like to exclude the properties ‘subpageLayout’, ‘image’ and ‘imageTitleText’. I tried setting them to false inside my own package NodeTypes.yaml, but that’s not helping, so how can I do this ?


(Aske Ertmann) #2

See http://neos.readthedocs.io/en/stable/ExtendingNeos/CustomizingInspector.html#remove-fields-from-an-existing-node-type

Also make sure your site package depends on the neos/node-types package to ensure configuration loading order is correct.


(George Dimitriadis) #3

Hello @aertmann,

thanks for the documentation reference, I have adjusted my configuration based on your suggestions like this:

 # NodeTypes.yaml
 'Neos.NodeTypes:Page':
    properties:
      layout:
        ui:
          inspector:
            group: 'layout'
            editorOptions:
              values:
                'default':
                  label: 'Default'
                'homepage':
                  label: 'Homepage'
      image: [ ]
      imageTitleText: [ ]

My Package’s Composer.json:

{
    "name": "repository/name",
    "description": "My description",
    "type": "neos-site",
    "require": {
        "neos/neos": "~3.2.0",
        "neos/nodetypes": "~3.2.0",
        "neos/demo": "~3.2.0",
        "neos/site-kickstarter": "~3.2.0",

        "neos/seo": "~2.0",
        "neos/setup": "~4.0",
        "neos/redirecthandler-neosadapter": "~2.0",
        "neos/redirecthandler-databasestorage": "~2.0",
        "flowpack/listable": "^2.0",
        "neos/form-builder": "^1.0"
    },
    "suggest": {
        "neos/seo": "*"
    },
    "autoload": {
        "psr-4": {
            "Vendor\\Site\\": "Classes/"
        }
    },
    "extra": {
        "neos": {
            "package-key": "Vendor.Site"
        }
    }
}

I can still see the image and image title fields in the backend right sidebar, did I do something wrong ? Already tries ./flow node:repair and ./flow flow:cache:flush --force without success


(George Dimitriadis) #4

Ah, I also had to run ./flow flow:package:rescan and now the properties are removed as expected, thanks for your help !


(George Dimitriadis) #5

Hey @aertmann ,

and how do you remove the values of a selectbox ?

See this post for details, I posted it in the wrong thread … is it possible to move it here ?


(George Dimitriadis) #6

From the documentation, the following configuration should remove the field parentNode from the targetMode selectbox in a shortcut nodeType :

'Neos.Neos:Shortcut':
  properties:
    targetMode:
      ui:
        inspector:
          editorOptions:
            values:
              parentNode: [ ]

However, if I apply it in my NodeTypes.yaml, the option is still there, but without a label:


(Aske Ertmann) #7

Try setting it to null or ~ (same) instead.


(George Dimitriadis) #8

Ah beautiful, thanks ! At this point I can’t recall how many different ways I tried :stuck_out_tongue: to get this working.

What do you mean by (same) ? Tilde translates to null ?


(Aske Ertmann) #9

Happy it helped.

Yes exactly.