You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Navigation: Split Link block into Post, Page, Category, Link, etc. #22919
Right now linking to a WordPress entity (post, page, category, etc.) is done by inserting a Link block. The user then selects the entity and the URL of the entity is stored in the Link block's url attribute. This is not ideal, though, as an entity's URL may change.
Instead of selecting a Link, we should allow the user to select a Post, Page, Category, etc. The ID of the entity would then be stored instead of the URL. The correct URL would still be rendered on the frontend using the block's render_callback.
This is necessary for the flow described in #22096.
Each innerBlock of the Navigation block could be a certain type (page, post, link, category etc.) and even showing their own icon? Maybe each of these is a variation of the Link block.
changed the title [-][ Navigation screen ] All menu items end up as custom links[/-][+]Navigation: Split Link block into Post, Page, Category, Link, etc.[/+]on Jul 14, 2020
We could implement this using block variations. For example, Link could support a type attribute which is set to "page", "post", etc. Inserting a Page variation would insert a Link block with { type: "page", "id": null }. This would make the Link block prompt the user to pick a page. Picking a page would set id and cause the render_callback to display the correct URL.
Activity
draganescu commentedon Jun 15, 2020
Each innerBlock of the Navigation block could be a certain type (page, post, link, category etc.) and even showing their own icon? Maybe each of these is a variation of the Link block.
[-][ Navigation screen ] All menu items end up as custom links[/-][+]Navigation: Split Link block into Post, Page, Category, Link, etc.[/+]noisysocks commentedon Jul 14, 2020
I updated the title and description to reflect that this is a subtask of #22096.
draganescu commentedon Jul 16, 2020
#21050 is also related to this by allowing LinkControl so store ID with no URL.
noisysocks commentedon Aug 5, 2020
We could implement this using block variations. For example, Link could support a
typeattribute which is set to"page","post", etc. Inserting a Page variation would insert a Link block with{ type: "page", "id": null }. This would make the Link block prompt the user to pick a page. Picking a page would setidand cause therender_callbackto display the correct URL.