Skip to content

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

Closed

Description

@draganescu

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.

Activity

  1. added
    [Type] Bug
    on Jun 4, 2020
  2. draganescu commented on Jun 15, 2020

    @draganescu
    ContributorAuthor

    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.

  3. 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
  4. added
    [Block] Navigation
    and removed
    [Type] Bug
    on Jul 14, 2020
  5. noisysocks commented on Jul 14, 2020

    @noisysocks
    Member

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

  6. draganescu commented on Jul 16, 2020

    @draganescu
    ContributorAuthor

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

  7. removed their assignment
    on Jul 29, 2020
  8. noisysocks commented on Aug 5, 2020

    @noisysocks
    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.

  9. self-assigned this
    on Aug 18, 2020
  10. added
    [Status] In Progress
    on Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Block] Navigation[Status] In Progress

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions