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.
How do I force an inline form to open programmatically?
Currently the form displays an add button for the inline form element and the user has to click on this button before the inline entity form will be displayed. I'd like the inline entity form to be opened by default, without the user clicking on the button. Is there a way to accomplish this programmatically?
Comments
Comment #1
plong0 CreditAttribution: plong0 commentedSorry thought I had a solution, but it isn't working properly... don't see where to delete comment.
Comment #2
ovidenov CreditAttribution: ovidenov commentedSame question.
+1
Comment #3
woprrr CreditAttribution: woprrr as a volunteer commentedThis operation is the "single" widget. So just change the formatting of multiple field and a single form will be displayed without any additional actions of the user.
Comment #4
ovidenov CreditAttribution: ovidenov commentedI see that using jQuery .mousedown() method (instead of .click() ).
Hopefully that helps someone.
Regards,
Oleg
Comment #5
a.milkovskyTo open ief both $element['form'] and $form_state['inline_entity_form'][$ief_id]['entities'][$delta]['form'] should be set.
You can check discussion at https://www.drupal.org/node/1757410#comment-10473522
Also check inline_entity_form_field_widget_form() after "// There's a form open, show it." line.
Comment #6
dcam CreditAttribution: dcam as a volunteer commentedClosing since there was no response to the given answer.