Issue #3601907: Automated Drupal 12 compatibility fixes for paragraphs_inline_entity_form 1.x-dev

Follow-up to the Project Update Bot's Drupal 12 pass on #3601907. The module was built and exercised end to end against Drupal 10.6.15, 11.4.5 and 12.0-dev.

Where the module actually stands

Core Result
10.6.15 Works. Full test suite green, embed flow verified in the UI, watchdog clean.
11.4.5 Works. Full test suite green, embed flow verified in the UI.
12.0-dev Blocked upstream, not by this module.

Drupal 12 cannot be reached yet because the dependencies are not there: Paragraphs, Embed, Entity Embed and Inline Entity Form have no branch declaring ^12, so Drupal itself refuses to install them. With the constraints relaxed the way the next-major CI job does, Entity Reference Revisions then calls views_field_default_views_data() from a procedural entity_reference_revisions.views.inc, which Drupal 12 no longer loads, and every page returns a 500. This module's own code is fine on Drupal 12: ParagraphsIEFTest and the unit tests pass there today.

Bugs found and fixed

The test suite had never run. The only test file was ParagraphsIEFTests.php. PHPUnit collects *Test.php, so run-tests.sh reported "No valid tests were specified" and the CI phpunit jobs collected nothing, while the pipeline stayed green. Renaming it is what surfaced everything below.

The example module could not be installed on a profile that does not happen to provide the standard profile's fields, which includes the testing profile on every core version and the standard profile on Drupal 12 (it no longer creates content types at all):

UnmetDependenciesException: Configuration objects provided by
paragraphs_inline_entity_form_example have unmet dependencies:
core.entity_view_display.node.paragraphs_ief_example.search_result
  (core.entity_view_mode.node.search_result),
field.field.node.paragraphs_ief_example.body (field.storage.node.body)

The Body field is now the module's own field_ief_body with its own field storage, and the search_result display moved to config/optional so a missing view mode cannot block installation.

The example text editor config failed strict schema checking. With image_upload.status: false, editor.image_upload_settings.0 allows only status, so the stored scheme, directory, max_size and max_dimensions had no schema and every test installing the module errored with SchemaIncompleteException.

The embed step could fatal. formAlter() read $form['attributes']['data-entity-uuid']['#value'] unguarded and ran current() over the loaded paragraphs; when the UUID pointed at a deleted paragraph, current() returned FALSE and $paragraph->id() was a fatal. Both are now checked. A data-embed-button element without a #value no longer raises a warning either.

Two more unguarded dereferences in the widget. $embed_button was assigned only inside the entity-embed branch and then used unconditionally (phpstan: Variable $embed_button might not be defined), and a paragraph type or image style that fails to load was dereferenced.

The Entity API dependency was unused. Nothing references its namespace and nothing else requires it, but it registers hook_views_data() through a procedural entity.views.inc that Drupal 12 does not load, so it 500'd every page of a Drupal 12 site.

Tests

Each fix has coverage, and each regression test was confirmed to fail without its fix:

  • ParagraphsIEFTest — the shipped embed button and entity browser install and point at this module's widget, the widget plugin is discoverable, the admin pages render, and hook_form_alter() attaches the dialog library to entity forms.
  • ParagraphsIEFExampleTest — the example module installs on a bare profile and its content type, fields and editor are configured as intended.
  • ParagraphsInlineEntityFormHooksTest — the embed step survives a deleted paragraph and a missing UUID, and the embed values alter behaves.

14 tests, green on Drupal 10 and 11. On Drupal 12, ParagraphsIEFTest and the unit tests pass; ParagraphsIEFExampleTest cannot run until Entity Reference Revisions is fixed.

CI

OPT_IN_TEST_NEXT_MINOR and OPT_IN_TEST_NEXT_MAJOR were already set, but they only create the jobs. _AUTORUN_NEXT_MINOR and _AUTORUN_NEXT_MAJOR default to none, which leaves them manual, so they never ran and the pipeline still reported green. They are now set to all. phpcs and phpstan pass against current core (checked locally with the gitlab_templates assets/phpstan.neon ruleset), so they no longer allow failure.

Also here

The README documents the example submodule, the real core compatibility, and the local build commands, and fixes a broken link. build-local-11 and build-local-12 mount the per-core-version dependency folder the way build-local-10 now does; test-local no longer needs a TTY.

Edited by Marcelo Vani

Merge request reports

Loading
Loading