Problem/Motivation

`InlineEntityForm` class in the Inline Entity Form module extends the deprecated `Drupal\Core\Render\Element\FormElement` class, which causes deprecation warnings when running Upgrade Status or preparing for Drupal 11:
`Class Drupal\inline_entity_form\Element\InlineEntityForm extends deprecated class Drupal\Core\Render\Element\RenderElement. Deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use Drupal\Core\Render\Element\RenderElementBase instead.`

Steps to reproduce

  1. Install Inline Entity Form module
  2. Run Upgrade Status module scan
  3. Review deprecation warnings for Inline Entity Form

Proposed resolution

Replace FormElement with FormElementBase in the element class:

  • The use statement
  • The class declaration
  • The annotation

Remaining tasks

I am attaching a patch that can provide a workaround until this is fixed.

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

titacvetkovic created an issue. See original summary.

bluegeek9’s picture

Category: Bug report » Task

We should also include a class_alias for RenderElement to RenderElementBase for backwards compatibility.

anybody’s picture

And this should please go into a MR.

Would be great if a maintainer could have a look at all the RTBC'd issues after that. Maybe you could contact them or request co-maintainership @bluegeek9?

I already maintain too many projects...

bluegeek9’s picture

Assigned: Unassigned » bluegeek9

bluegeek9’s picture

Assigned: bluegeek9 » Unassigned
Status: Active » Needs review
dww’s picture

Status: Needs review » Needs work

Thanks for working on this! The fix in the MR depends on core 10.3.x. So this either needs to be postponed on #3413233: Update module compatibility statements (which I think we should defer until after 3.0.0), or we need to explore #2 and alias the class on older versions of core.

p.s. Wow, thanks for the expanded test coverage in here! Looks like a great addition.

bluegeek9’s picture

I added this to the .module file for backwards compatibility.

if (!class_exists('Drupal\Core\Render\Element\RenderElementBase')) {
  class_alias('Drupal\Core\Render\Element\RenderElement', 'Drupal\Core\Render\Element\RenderElementBase');
}
dww’s picture

Doesn't that need to happen in src/Element/InlineEntityForm.php not the .module file?

bluegeek9’s picture

It works in the module file. I have done this for other projects to address this change.

If the core requirement changes, the code can be removed.

core_version_requirement: ^10.3 || ^11

bluegeek9 changed the visibility of the branch 3.x to hidden.

dww’s picture

Version: 3.0.0-rc21 » 3.x-dev

Thanks for working on this!

https://git.drupalcode.org/issue/inline_entity_form-3566408/-/jobs/10080774 is a new test failure which needs fixing. NW is the right status.

There was 1 failure:
1) Drupal\Tests\inline_entity_form\Unit\Element\InlineEntityFormTest::testGetInlineFormHandlerMissing
Failed asserting that exception of type "InvalidArgumentException" is thrown.

Thanks again,
-Derek

dww’s picture

Also, since we're fixing the deprecation, we need to remove the phpstan-baseline (this error is the only entry in there) per https://git.drupalcode.org/issue/inline_entity_form-3566408/-/jobs/10080771