Problem/Motivation

Steps to reproduce

When we use "entity browser" with "inline entity form" we will get an error when "entity browser" try to get field cardinality.

Proposed resolution

Change "->get('cardinality')" to "->getCardinality()"

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

r_cheh created an issue. See original summary.

r_cheh’s picture

r_cheh’s picture

Status: Active » Needs review
benstallings’s picture

Status: Needs review » Reviewed & tested by the community

Claude Code says:

This is correct:
- getCardinality() is the proper API method defined on FieldStorageDefinitionInterface
- ->get() is a generic property accessor on config entities that bypasses any logic in the getter — if getCardinality() ever adds processing (e.g., normalizing values), get() would miss it
- Better for static analysis and IDE support — get('cardinality') returns mixed, while getCardinality() has a proper return type

No functional change in current Drupal core (both return the same integer), but it's the right API to use.

Verdict: Trivial, correct fix. Good to merge.

anybody made their first commit to this issue’s fork.

anybody’s picture

anybody’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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