InvalidArgumentException when adding menu link to new node with content moderation
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.
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
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