Problem/Motivation

The inline entity form simple widget shows a table format for a single value when it should show single format.

Steps to reproduce

1) Create an entity reference field.
2) Set the default limit to unlimited.
3) Set the cardinality limit to 1.
4) Change the form widget to "Inline entity form - Simple".

Proposed resolution

Extend the \Drupal\inline_entity_form\Plugin\Field\FieldWidget\InlineEntityFormSimple like the other solution.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

madelyncruz created an issue. See original summary.

madelyncruz changed the visibility of the branch 8.x-1.x to hidden.

madelyncruz’s picture

Status: Active » Needs review
vijayavelr’s picture

Hi @madelyncruz , I reviewed the steps

Before :

before

After following the Steps to reproduce
1) Create an entity reference field.
2) Set the default limit to unlimited.
3) Set the cardinality limit to 1.
4) Go to the entity form.

after1
after2
after3

madelyncruz’s picture

Title: IEF simple widget shows a table format for a single value » Inline entity form simple widget shows a table format for a single value
Issue summary: View changes
madelyncruz’s picture

@vijayavelr, I edited #4 on how to replicate the issue. The form widget has to "Inline entity form - Simple (Cardinality)". could you please try again?

vijayavelr’s picture

vijayavelr’s picture

StatusFileSize
new79.33 KB

Hi @madelyncruz

Before :
before

I have done extend as you mentioned and checked the file from this commit 791ac1c3

and added in the file web\modules\contrib\field_config_cardinality\field_config_cardinality.module

use Drupal\field_config_cardinality\Plugin\Field\FieldWidget\CardinalityEntityReferenceIefSimpleWidget;

if (isset($info['inline_entity_form_simple'])) {
$info['inline_entity_form_simple']['class'] = CardinalityEntityReferenceIefSimpleWidget::class;
}

after
after
after
after

Its working fine.
Thank you.

vijayavelr’s picture

StatusFileSize
new184.35 KB
vijayavelr’s picture

StatusFileSize
new90.53 KB
vijayavelr’s picture

StatusFileSize
new63.5 KB
madelyncruz’s picture

Assigned: madelyncruz » Unassigned

smustgrave’s picture

Version: 3.0.1 » 4.0.x-dev
Status: Needs review » Needs work

Lets update the MR and use attribute

smustgrave’s picture

Status: Needs work » Fixed

Added test coverage

andre.bonon’s picture

Status: Fixed » Needs review

@smustgrave, not all sites have the inline_entity_form installed, so it needs to check if the module exists before executing.

https://git.drupalcode.org/project/field_config_cardinality/-/merge_requ...

smustgrave’s picture

Status: Needs review » Fixed

You can see in the test that the module is installed and was added to the require-dev so it will be there for the tests.

andre.bonon’s picture

Oh sorry, that makes sense.

smustgrave’s picture

No worries!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.