Hi, I have a custom config entity form.
In that, I am adding a reference to block by inline entity form.
I would love to show the complex version of the widget for users.

      $form[$block_data['block_name']] = [
        '#type' => 'inline_entity_form',
        '#title' => $this->t($block_data['title']),
        '#entity_type' => 'block_content',
        '#bundle' => $block_data['bundle'],
        '#form_mode' => 'default',
        '#default_value' => $block_data['block'],
        '#save_entity' => true
      ];

Is there any way how to do it? If so, can anybody please just point me in the right direction? :)
I already tried a lot of ideas, but nothing works for me.

Thank you

Comments

neonode created an issue. See original summary.

mortona2k’s picture

#type => inline_entity_form refers to the InlineEntityForm render element.

InlineEntityFormSimple and InlineEntityFormComplex are field widgets, so only applicable to content entity fields.

I don't see a way to use them in a config form unfortunately. The render element works, but you have to write your own code to switch between new and existing entities, and add additional items.

bramdriesen’s picture

+1 for this! It would be a huge added value if you can set the form display settings for a field which you can add using the render array.

bramdriesen’s picture

Version: 8.x-1.0-rc9 » 3.x-dev
Category: Support request » Feature request
marelpup’s picture