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
- Install Inline Entity Form module
- Run Upgrade Status module scan
- 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.
| Comment | File | Size | Author |
|---|---|---|---|
| inline_entity_form-formElement-deprecated.patch | 688 bytes | titacvetkovic |
Issue fork inline_entity_form-3566408
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
bluegeek9 commentedWe should also include a class_alias for RenderElement to RenderElementBase for backwards compatibility.
Comment #3
anybodyAnd 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...
Comment #4
bluegeek9 commentedComment #6
bluegeek9 commentedComment #7
dwwThanks 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.
Comment #8
bluegeek9 commentedI added this to the .module file for backwards compatibility.
Comment #9
dwwDoesn't that need to happen in
src/Element/InlineEntityForm.phpnot the .module file?Comment #10
bluegeek9 commentedIt 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
Comment #12
dwwThanks 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.
Thanks again,
-Derek
Comment #13
dwwAlso, 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