0

In a form_alter hook I'm trying to target the buttons to add a new paragraph but can't seem to target the specific buttons. The buttons are multiple entity references with unlimited cardinality, but for my use case I would like for once one entity is chosen, only that entity can be chosen again in the repeater, which is why I'm trying to disable the other buttons. I want to allow unlimited cardinality but only one paragraph type to be chosen at a time. This works to unset the entire row of buttons...

$form['field_select_card_type']['widget']['add_more']

But this does not work to target the specific button...

$form['field_select_card_type']['widget']['add_more']['add_more_button_grey_card_w_image']

Any help or suggestions?

2
  • I don't understand exactly what you are trying to do, where, and how. In a form alter hook you try to target a button. To add a new paragraph. I don't get the connection. Can you please add more detailed info? 🙏🏻
    – leymannx
    Nov 9, 2022 at 20:25
  • Yes, in a form alter hook, I've updated my question.
    – Shawn W
    Nov 9, 2022 at 22:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.