Problem/Motivation

https://www.drupal.org/node/2406749#comment-9569221 - this patch left to use node path but we would like to use entity:uri.

Follow-up to #2406749-56: Use a link field for custom menu link

// Create a new menu_link_content entity.
        $entity = entity_create('menu_link_content', array(
          'title' => trim($definition['title']),
          'description' => trim($definition['description']),
          // @todo Replace it with entity: once possible.
          'link' => ['uri' => 'node/' . $node->id()],
          'menu_name' => $definition['menu_name'],
          'parent' => $definition['parent'],
          'weight' => isset($definition['weight']) ? $definition['weight'] : 0,
          'enabled' => 1,
          'langcode' => $node->getUntranslated()->language()->getId(),
        ));

#2411333: Create standard logic to handle a entity: URI scheme is in
so use it.

The tests around this could be tricky.

Proposed resolution

Use entity:

Remaining tasks

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Create a patch Instructions
Update the issue summary noting if allowed during the beta Instructions
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards Instructions

User interface changes

No

API changes

No

CommentFileSizeAuthor
#17 2417367-17.patch5.87 KBkgoel
#5 2417367.patch3.22 KBamateescu

Comments

yesct’s picture

Issue summary: View changes
Issue tags: -D8 upgrade path

html.

probably not upgrade path blocker

yesct’s picture

Title: Use entity: in MenuLinkContentAccessControlHandler instead of 'link' => ['uri' => 'node/' . $node->id()], » Use entity: in menu_ui_node_save() instead of 'link' => ['uri' => 'node/' . $node->id()],
Issue summary: View changes

oops wrong place.
should be menu_ui_node_save() in
core/modules/menu_ui/menu_ui.module

yesct’s picture

Issue tags: +D8 upgrade path

adding D8 upgrade path tag since this would change what is being stored.

RavindraSingh’s picture

please have a look before implementation
https://www.drupal.org/node/2406749#comment-9569795

amateescu’s picture

Title: Use entity: in menu_ui_node_save() instead of 'link' => ['uri' => 'node/' . $node->id()], » Use the new entity: URI scheme
Status: Active » Needs review
StatusFileSize
new3.22 KB

This is a start... doesn't seem to work yet :/

Status: Needs review » Needs work

The last submitted patch, 5: 2417367.patch, failed testing.

kgoel’s picture

I am at NJ sprint and working on this.

kgoel’s picture

Issue summary: View changes
kgoel’s picture

yesct’s picture

Status: Needs work » Needs review

amateescu queued 5: 2417367.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 5: 2417367.patch, failed testing.

yched’s picture

#2417783: Remove widget specific logic in MenuLinkContentForm was marked as a duplicate. Not familiar enough with the problem space to fully grasp how entity: will fix the issue pointed there, but following with interest :-)

yesct’s picture

@amateescu are you working on this right now? I was thinking of diving into it at the moment.

amateescu’s picture

@YesCT, nope, but I think @kgoel is working on it. I just asked for a retest on the initial patch to see if the recent commits brought any improvements.

kgoel’s picture

Assigned: Unassigned » kgoel

Yes, I am working on it right now.

kgoel’s picture

Status: Needs work » Needs review
StatusFileSize
new5.87 KB

This patch is going to fail. I am waiting for Wim to finish work on https://www.drupal.org/node/2417793 so I can apply his changes.

Status: Needs review » Needs work

The last submitted patch, 17: 2417367-17.patch, failed testing.

kgoel’s picture

Status: Needs work » Closed (duplicate)