0

I have a custom field class. I would like to limit it to specific content types and bundles that I will choose when my custom module is installed and as other content types meet certain criteria. I don't want it to be available at /admin/structure/types/manage/article/fields/add-field

Is hook_form_alter on the add-field page form my only option or is there an Annotation or API I can use to mark my field as "not available to this content" similar to the way FieldWidgets can be marked as applicable to only certain field types?

Note: I was also planning to add a ConstraintValidator to the field so that it won't validate if added to the wrong content.

0

It is not possible to define field types which are only applicable to certain bundles. I think you need hook_form_alter for the form where the fields are chosen for a bundle to achieve that.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.