- Issue created by @jcnventura
- Assigned to akhil_01
- Issue was unassigned.
- 🇩🇪Germany Anybody Porta Westfalica
@jcnventura can you perhaps create the 2.x branch so we can create a MR against it?
- 🇵🇹Portugal jcnventura
I don't think that the 2.x branch is needed. RevisionableStorageInterface already exists since Drupal 8.
But of course, I'd need to see the actual implementation of the fix.
- 🇩🇪Germany Anybody Porta Westfalica
On the other hand the 2.x branch would introduce SemVer so I still think it wouldn't be bad and leave 8.x-1.x as-is?
- 🇵🇹Portugal jcnventura
Actually, 2.x would, by introducing semver actually break semver :)
Unless there's BC-breaking changes, a major version jump would not be semver-compliant.
- First commit to issue fork.
- Status changed to Needs review
6 months ago 2:17pm 3 July 2024 - 🇨🇦Canada m4olivei Grimsby, ON
Hey there 👋. I was attempting to use menu_link_attributes to test something on Drupal 11.x and found this issue. I don't believe there is an actual problem with the code in question on Drupal 11.x or any version.
First, it was not obvious to me how to reproduce the issue or trigger the code path in question. Here's what I found to work:
- Checkout the latest Drupal core 11.x
- Install Drupal w/ Umami demo (eg.
drush si -y demo_umami
- Clone the menu_link_attributes module
- Edit the menu_link_attributes.info.yml to add
|| 11
tocore_version_requirement
- Enable content translation for menus. Navigate to Configuration > Region and language > Content language and translation. Enable "Custom menu link". Expand "Custom menu link", enable "Translatable" next to "Custom menu link". Enable the "Hide non translatable fields on translation forms". Click "Save configuration"
- Create a custom menu link. Set some menu attributes.
- Translate the custom menu link and click Save.
After all that, the last step, saving the translated custom menu link will trigger the code path pointed out. There are no errors or warnings here when I run the module in Ddrupal 11.x. This makes sense, b/c the code here, eg.
\Drupal::entityTypeManager() ->getStorage($menu_link->getEntityTypeId())
Will load an object of type
\Drupal\menu_link_content\MenuLinkContentStorage
, and that class implements in it's interface hierarchy\Drupal\Core\Entity\RevisionableStorageInterface
, which has the legitloadRevision
method.I think the error you're getting is simply from static analysis. At runtime, there is no actual issue.
Marking as Needs Review. Suggesting to Close as works as designed, and then open a follow up to get to 11.x support.
- Assigned to Grevil
- First commit to issue fork.
- Issue was unassigned.
- 🇩🇪Germany Grevil
Yep @m4olivei is right!
Thanks for the steps to reproduce! :)
I added a few variable comments (and typing to menu_link_attributes_menu_link_content_form_entity_builder()), tested it and checked the upgrade_status output. Everything still works as expected and upgrade status succeeds now!
Output before:
FILE: web/modules/custom/menu_link_attributes/menu_link_attributes.module STATUS LINE MESSAGE -------------------------------------------------------------------------------- Ignore 185 Call to deprecated method loadRevision() of interface Drupal\Core\Entity\EntityStorageInterface. Deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use Drupal\Core\Entity\RevisionableStorageInterface::loadRevisio n instead. --------------------------------------------------------------------------------
Output after:
[notice] Processing /var/www/html/web/modules/custom/menu_link_attributes. ================================================================================ Menu Link Attributes, -- Scanned on Mon, 08/19/2024 - 10:16 No known issues found.
Please review!
- Merge request !18Issue #3447090: [Drupal 11] Call to deprecated method loadRevision() → (Merged) created by Grevil
- Status changed to RTBC
4 months ago 8:29am 19 August 2024 - 🇩🇪Germany Anybody Porta Westfalica
Great work @Grevil! Changes LGTM and make sense. It also makes sense to add the parameter Interface type to make things more clear and safe. Hope there won't be any drawbacks or wrong legacy use...
- 🇩🇪Germany Anybody Porta Westfalica
Just ensured that the method already exists in Drupal 8: https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Revisionab...
So we can keep the compatibility.
- Status changed to Fixed
4 months ago 8:33am 19 August 2024 Automatically closed - issue fixed for 2 weeks with no activity.