Problem/Motivation
When a paragraphs field is configured with a cardinality of 1, Drupal does not render an "Add more" button. As a result, the add_more key is absent from the widget element array. paragraphs_ee.module accesses this key unconditionally triggering a PHP warning during PHPUnit test runs:
Warning: Undefined array key "add_more" in paragraphs_ee/paragraphs_ee.module on line 85
PHPUnit treats unexpected output — including PHP warnings — as an error, causing the test to fail even though the underlying functionality may work correctly.
Steps to reproduce
- Install paragraphs and paragraphs_ee.
- Create a content type with a paragraphs field and set its cardinality to 1.
- Optionally pre-fill the field with a paragraph item (e.g. via default value).
- Write a PHPUnit ExistingSite test that renders the paragraph add/edit form for that paragraph type.
- Run the test and observe the failure mentioned above
Proposed resolution
- check for existence of
add_morekey before accessing it
User interface changes
- none
API changes
- none
Data model changes
- none
Issue fork paragraphs_ee-3590093
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
Comment #2
steffenrComment #4
steffenrComment #5
stborchertThank you! Merged into 10.1.x-dev.