Problem/Motivation

When creating a new node with a menu link while using content moderation, an `InvalidArgumentException` is thrown:
InvalidArgumentException: The entity URI 'entity:node/' is invalid. You must specify the entity id in the URL. e.g., entity:node/1 for loading the canonical path to node entity with id 1.
The issue affects non-admin users who save nodes.

Steps to reproduce

1. Enable the Content Moderation module
2. Create a workflow with a default state that has `default_revision: false` (e.g., "Draft")
3. Apply the workflow to a content type (e.g., "Page")
4. Log in as a non-admin user with appropriate permissions (e.g., editor role)
5. Create a new node of that content type
6. Check "Provide a menu link" and fill in the menu link details
7. Save the node as "Draft"
8. **Result:** `InvalidArgumentException` is thrown

Proposed resolution

Add a check for `$node->id()` before attempting to use it in `token_node_menu_link_submit()`:

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork token-3569207

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

aren33k created an issue. See original summary.

aren33k’s picture

Assigned: aren33k » Unassigned
Status: Active » Needs review