Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation: Split Link block into Post, Page, Category, Link, etc. #22919

Closed
draganescu opened this issue Jun 4, 2020 · 4 comments · Fixed by #24670
Closed

Navigation: Split Link block into Post, Page, Category, Link, etc. #22919

draganescu opened this issue Jun 4, 2020 · 4 comments · Fixed by #24670
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Status] In Progress Tracking issues with work in progress

Comments

@draganescu
Copy link
Contributor

draganescu commented Jun 4, 2020

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.

@draganescu draganescu added [Type] Bug An existing feature does not function as intended [Feature] Navigation Screen labels Jun 4, 2020
@draganescu
Copy link
Contributor Author

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.

@noisysocks noisysocks changed the title [ Navigation screen ] All menu items end up as custom links Navigation: Split Link block into Post, Page, Category, Link, etc. Jul 14, 2020
@noisysocks noisysocks added [Block] Navigation Affects the Navigation Block and removed [Type] Bug An existing feature does not function as intended labels Jul 14, 2020
@noisysocks
Copy link
Member

I updated the title and description to reflect that this is a subtask of #22096.

@draganescu
Copy link
Contributor Author

#21050 is also related to this by allowing LinkControl so store ID with no URL.

@noisysocks noisysocks removed their assignment Jul 29, 2020
@noisysocks
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Status] In Progress Tracking issues with work in progress
Projects
None yet
2 participants