disable blockName update

default discord avatar
rrumslast year
4

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


I want to set it programmatically

  • default discord avatar
    hades200082last year

    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
    rrumslast year

    hey @Kyr, 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

    Screenshot_2023-05-10_at_11.20.15.png
    Screenshot_2023-05-10_at_11.23.40.png
  • default discord avatar
    paulpopuslast year

    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.m10 months ago

    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 help straight from the Payload team with an Enterprise License.