Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I would like to alter an entity-create/edit form, but only when it's used as an entity form in an entity browser. I've tried a hook_form_alter
and a hook_form_FORM_ID_alter
, but haven't found the built-out form array to alter, containing the actual fields of the target entity. What I specifically want to do is set the value of a select list and hide it. Could someone point me in the right direction for doing this type of alteration?
Comments
Comment #2
nadavoid CreditAttribution: nadavoid at Jackson River commentedComment #3
smartparty CreditAttribution: smartparty as a volunteer commentedSolution below worked out using form pre render.
Comment #4
karthikeyan-manivasagam CreditAttribution: karthikeyan-manivasagam commented#3 is not working for entity browser (EB) have two tabs one for selecting entities from EB and another to create a new entity from EB and the above method is not working
Comment #5
chucksimply CreditAttribution: chucksimply commentedI had a similar issue... and solved it myself by altering the inline entity form instead of the entity browser. Hope it helps.
https://www.drupal.org/project/entity_browser/issues/3198075