Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

disable blockName update

default discord avatar
rrums2 years ago
4

Hello all, can I disable blockName (from block field) from being changed by users?


I want to set it programmatically

  • default discord avatar
    hades2000822 years ago

    You can use the access controls on the field. Use the create and update fields to set a function that will determine if access is allowed or not.



    https://payloadcms.com/docs/access-control/fields
  • default discord avatar
    rrums2 years ago

    hey

    @365498720726286349

    , thanks for replying



    In my case, I want to restrict users to input blockName manually, but users still able to update any kind of fields


    blockName is not accessible from access controls on the field, no?



    I want to have same behavior as array field, that we can't change the name, it's generated by payload

  • default discord avatar
    paulpopus2 years ago

    I don't think that part is currently customisable, it's intended just for editorial use though so you can label each block a little better

  • default discord avatar
    tais.mlast year

    but if we're trying to provide editors with specific blocks of fields and not generic layout blocks it would be very helpful to be able to programmatically set these (which from what I understand we can't currently?) and not have each instance "renamable". in our case, we're trying to use blocks to define different types of licenses for image copyright where each type has a different set of fields and it doesn't make sense to "label" them with anything else than the name of the type.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.