We need a way for supporting Menu Item Extras in menu items
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | Screenshot 2024-02-16 at 4.31.15 pm.png | 62.01 KB | almunnings |
| #6 | Screenshot 2024-02-16 at 4.30.21 pm.png | 70.57 KB | almunnings |
| #2 | viva_menu_item_extras.zip | 6.74 KB | cedricl |
Issue fork graphql_compose-3415306
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
cedricl commentedWe did this, but made it hardcoded only for the fields we needed, you can take a look in our module for inspiration.
Comment #3
mcortes19 commentedThanks @CedricL, I'll definitely use it as inspiration and hopefully as a basis for contributing.
Comment #6
almunningsHowdy, MR is in, please test and let me know.
Because we don't "out of the box" support a union of MenuItem types, I've added it to an `extras` field.
Then I messed about with some of the form UX to make it less.. crap to work with.
Enable the MenuLinkContent entity fields on Menu in the GraphQL Compose schema form.
Query on the
MenuItem.extrasunion.Also added on
MenuItem.langcode→LanguageComment #7
almunningsComment #8
mcortes19 commented@almunnings I tested on the D10.8 site and it returned the following error:
For error #0: Error: Call to protected method Drupal\menu_link_content\Plugin\Menu\MenuLinkContent::getEntity() from scope Drupal\graphql_compose_menus\Plugin\GraphQL\DataProducer\MenuTreeLinkEntity in Drupal\graphql_compose_menus\Plugin\GraphQL\DataProducer\MenuTreeLinkEntity->resolve() (line 45 of /app/web/modules/contrib/graphql_compose/modules/graphql_compose_menus/src/Plugin/GraphQL/DataProducer/MenuTreeLinkEntity.php)Seems like the `getEntity()` method is public until D10.2 and many sites are not ready to move to D10.2
Comment #9
almunningsComment #10
almunningsOk,
So thats updated now to use a buffer again.
Wondering if the semantics are now correct.
is
extrasok?should it be
fieldsOr do we completely mess with the menu system and clean it up to make more sense if this is an actual entity now.
Keen for feedback, as i dont feel like going...
Does it really mean anything to anyone? It feels like a total after thought. Theres gotta be an "if i didn't have to support any legacy stuff, this is the ideal structure" moment, somewhere?
Its a strange one, because without the module, the menu item isn't really an entity, its got no unique properties by type.
Maybe hijacking the attributes field is a better usage.
Have a play
Keen on feedback
Worm regards
Comment #11
almunningsWill write up some tests tonight and get this in.
Comment #12
almunningsComment #14
almunningsBeta 2 tagged, thanks all