[SOLVED] Set node to hide in menu when creating with php

We creating nodes by php whats working, but i cant find a solution to set the to hidden in menus.

Its hidden by default when creating with the ui, cause the node got a mixin

'WG.BaseSite:Mixin.HideInNav':
  abstract: true
  properties:
    _hidden:
      ui:
        reloadPageIfChanged: true
    _hiddenInIndex:
      type: boolean
      defaultValue: true

but this doesn’t work if creating with php, i tried to set the property but it looks like its not the right way, cause this is not working:

  $nodeTemplate->setProperty('_hiddenInIndex', true);

The hiddenInIndex is not a “real” property. That’s why it’s prefixed with the underscore.

NodeTemplate provides a setHiddenInIndex().

1 Like

Thanks, this is working!

1 Like