Adding complex widget to custom config entity form

Created on 13 August 2021, over 3 years ago
Updated 16 April 2024, 8 months ago

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

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡¨πŸ‡ΏCzech Republic neonode

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    #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.

  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    +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.

  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ
Production build 0.71.5 2024