Hello all, can I disable blockName (from block field) from being changed by users?
I want to set it programmatically
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
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
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
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
Discord
online
Get help straight from the Payload team with an Enterprise License.